/usr/lib/python3/dist-packages/trytond/modules/company/tests/tools.py is in tryton-modules-company 4.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # 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, Wizard
from proteus.config import get_config
from trytond.modules.currency.tests.tools import get_currency
__all__ = ['create_company', 'get_company']
def create_company(party=None, currency=None, config=None):
"Create the company using the proteus config"
Party = Model.get('party.party', config=config)
User = Model.get('res.user', config=config)
company_config = Wizard('company.company.config')
company_config.execute('company')
company = company_config.form
if not party:
party = Party(name='Dunder Mifflin')
party.save()
company.party = party
if not currency:
currency = get_currency()
company.currency = currency
company_config.execute('add')
if not config:
config = get_config()
config._context = User.get_preferences(True, {})
return company_config
def get_company(config=None):
"Return the only company"
Company = Model.get('company.company', config=config)
company, = Company.find()
return company
|