Migrate to 6.0

This commit is contained in:
Sergio Morillo 2021-09-25 16:37:20 +02:00
parent 818f16445c
commit 97854b409b
3 changed files with 4 additions and 19 deletions

View File

@ -21,12 +21,6 @@ Create company::
>>> _ = create_company()
>>> company = get_company()
Reload the context::
>>> User = Model.get('res.user')
>>> Group = Model.get('res.group')
>>> config._context = User.get_preferences(True, config.context)
Create timesheet lines::
>>> Employee = Model.get('company.employee')

View File

@ -3,7 +3,6 @@
from trytond.model import ModelView
from trytond.pool import Pool
from trytond.model import fields
from trytond.pyson import Eval
from trytond.wizard import Button, StateTransition, StateView, Wizard
from trytond.transaction import Transaction
@ -20,20 +19,12 @@ class TimesheetSyncCostStart(ModelView):
employee = fields.Many2One('company.employee', 'Employee')
costless = fields.Boolean('Only costless',
help='Will compute cost only for lines without it.')
companies = fields.One2Many('company.company', None,
'Companies',
domain=[
('parent', 'child_of', Eval('context', {}).get('company'),
'parent')])
companies = fields.Many2Many('company.company', None, None, 'Companies')
@staticmethod
def default_companies():
Company = Pool().get('company.company')
companies = Company.search([
('parent', 'child_of', Transaction().context.get('company'),
'parent')
])
return list(map(int, companies))
if Transaction().context.get('company'):
return [Transaction().context.get('company')]
@staticmethod
def default_start_date():

View File

@ -13,5 +13,5 @@
<label name="costless"/>
<field name="costless"/>
<newline/>
<field name="companies" colspan="4" widget="many2many"/>
<field name="companies" colspan="4"/>
</form>