Migrate to 6.0
This commit is contained in:
parent
818f16445c
commit
97854b409b
|
@ -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')
|
||||
|
|
15
timesheet.py
15
timesheet.py
|
@ -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():
|
||||
|
|
|
@ -13,5 +13,5 @@
|
|||
<label name="costless"/>
|
||||
<field name="costless"/>
|
||||
<newline/>
|
||||
<field name="companies" colspan="4" widget="many2many"/>
|
||||
<field name="companies" colspan="4"/>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue