File: tools.py

package info (click to toggle)
tryton-modules-account-stock-anglo-saxon 5.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 412 kB
  • sloc: python: 526; xml: 171; makefile: 6; sh: 3
file content (20 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This file is part of Tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from proteus import Model

from trytond.modules.company.tests.tools import get_company


def add_cogs_accounts(accounts, company=None, config=None):
    "Add COGS to accounts"
    Account = Model.get('account.account', config=config)

    if not company:
        company = get_company()

    accounts['cogs'], = Account.find([
            ('kind', '=', 'other'),
            ('company', '=', company.id),
            ('name', '=', 'COGS'),
            ])
    return accounts