add parent project in timesheet

This commit is contained in:
Pawan Kumar 2021-01-29 10:58:30 +05:30
parent b9ac23e9a1
commit bd73f37e75
2 changed files with 12 additions and 2 deletions

View File

@ -16,7 +16,17 @@ class AccountAnalyticLine(models.Model):
start_time = fields.Float(string='Start Time', digits=(16, 2))
end_time = fields.Float(string='End Time', digits=(16, 2))
unit_amount = fields.Float('Duration', default=0.0)
sub_project = fields.Many2one('project.project', string='Sub Project', related='project_id.sub_project', readonly=True)
parent_project = fields.Many2one('project.project', string='Parent Project')
#sub_project = fields.Many2one('project.project', string='Sub Project')
@api.onchange('project_id')
def _onchange_parent_project_id(self):
if self.project_id and self.project_id.sub_project:
self.parent_project = self.project_id.sub_project.id
else:
self.parent_project = False
@api.onchange('employee_id')
def _onchange_employee_id(self):

View File

@ -51,7 +51,7 @@
<field name="end_time" widget="float_time"/>
</xpath>
<xpath expr="//field[@name='unit_amount']" position="after">
<field name="sub_project"/>
<field name="parent_project"/>
</xpath>
</field>
</record>