Add origin reference to work
This commit is contained in:
1 parent
801a805ab6
commit
d5b308ffb3
9 files changed
+40
-3
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Add origin reference to work
|
||||
* Add number to the work efforts
|
||||
* Add support for Python 3.14
|
||||
* Remove support for Python 3.9
|
||||
|
||||
@@ -29,6 +29,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="timesheet_end_date" string="End:"/>
|
||||
<field name="timesheet_end_date" xexpand="0"/>
|
||||
</group>
|
||||
<label name="origin"/>
|
||||
<field name="origin"/>
|
||||
<newline/>
|
||||
<label name="effort_duration"/>
|
||||
<field name="effort_duration"/>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree sequence="sequence">
|
||||
<field name="company" expand="1" optional="1"/>
|
||||
<field name="origin" expand="1" optional="1"/>
|
||||
<field name="number"/>
|
||||
<field name="rec_name" expand="1"/>
|
||||
<field name="timesheet_duration" optional="0"/>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree sequence="sequence">
|
||||
<field name="origin" expand="1" optional="1"/>
|
||||
<field name="name" expand="1">
|
||||
<prefix name="number"/>
|
||||
</field>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="company" expand="1" optional="1"/>
|
||||
<field name="origin" expand="1" optional="1"/>
|
||||
<field name="number"/>
|
||||
<field name="rec_name" expand="1"/>
|
||||
<field name="type" optional="1"/>
|
||||
|
||||
@@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<prefix name="number"/>
|
||||
</field>
|
||||
<field name="company" expand="1" optional="1"/>
|
||||
<field name="origin" expand="1" optional="1"/>
|
||||
<field name="timesheet_duration" optional="0"/>
|
||||
<field name="total_effort" optional="0"/>
|
||||
<field name="type" optional="1"/>
|
||||
|
||||
@@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<prefix name="number"/>
|
||||
</field>
|
||||
<field name="company" expand="1" optional="1"/>
|
||||
<field name="origin" expand="1" optional="1"/>
|
||||
<field name="type" optional="1"/>
|
||||
<field name="status" optional="0"/>
|
||||
</tree>
|
||||
+25
-2
@@ -152,8 +152,17 @@ class Work(
|
||||
('project', 'Project'),
|
||||
('task', 'Task')
|
||||
],
|
||||
"Type", required=True)
|
||||
company = fields.Many2One('company.company', "Company", required=True)
|
||||
"Type", required=True,
|
||||
domain=[
|
||||
If(Eval('origin', None),
|
||||
('type', '=', 'task'),
|
||||
()),
|
||||
])
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True,
|
||||
states={
|
||||
'readonly': Bool(Eval('origin', None)),
|
||||
})
|
||||
number = fields.Char("Number", readonly=True)
|
||||
party = fields.Many2One('party.party', 'Party',
|
||||
states={
|
||||
@@ -168,6 +177,9 @@ class Work(
|
||||
states={
|
||||
'invisible': Eval('type') != 'project',
|
||||
})
|
||||
origin = fields.Reference(
|
||||
"Origin", selection='get_origins',
|
||||
help="The source of the task.")
|
||||
timesheet_works = fields.One2Many(
|
||||
'timesheet.work', 'origin', 'Timesheet Works', readonly=True, size=1)
|
||||
timesheet_available = fields.Function(fields.Boolean(
|
||||
@@ -260,6 +272,17 @@ class Work(
|
||||
def default_company(cls):
|
||||
return Transaction().context.get('company')
|
||||
|
||||
@classmethod
|
||||
def _get_origins(cls):
|
||||
return []
|
||||
|
||||
@classmethod
|
||||
def get_origins(cls):
|
||||
IrModel = Pool().get('ir.model')
|
||||
get_name = IrModel.get_name
|
||||
models = cls._get_origins()
|
||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||
|
||||
@classmethod
|
||||
def default_status(cls):
|
||||
pool = Pool()
|
||||
|
||||
@@ -12,7 +12,7 @@ from trytond.model import fields
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.product import price_digits, round_price
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Bool, Eval, If
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
@@ -21,7 +21,13 @@ class Work(metaclass=PoolMeta):
|
||||
product = fields.Many2One('product.product', 'Product',
|
||||
domain=[
|
||||
('type', '=', 'service'),
|
||||
If(Eval('origin', None),
|
||||
('id', '=', -1),
|
||||
()),
|
||||
],
|
||||
states={
|
||||
'invisible': Bool(Eval('origin', None)),
|
||||
},
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user