List view and read group added

This commit is contained in:
projectsodoo 2021-01-06 11:46:48 +05:30
parent 2f7f22407b
commit ec53a365d7
2 changed files with 10 additions and 2 deletions

View File

@ -23,6 +23,13 @@ class PlanningShift(models.Model):
('project_required_if_task', "CHECK( (task_id IS NOT NULL AND project_id IS NOT NULL) OR (task_id IS NULL) )", "If the planning is linked to a task, the project must be set too."),
]
@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
if 'budgeted_hours' in fields:
fields.remove('budgeted_hours')
return super(PlanningShift, self).read_group(domain, fields, groupby, offset, limit, orderby, lazy)
@api.depends('project_id', 'employee_id')
def _compute_budgeted_hours(self):
for slot in self:

View File

@ -8,8 +8,9 @@
<field name="inherit_id" ref="planning.planning_view_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='role_id']" position="after">
<field name="project_id" optional="hide"/>
<field name="task_id" optional="hide"/>
<field name="project_id"/> <!-- optional="hide" -->
<field name="task_id"/>
<field name="budgeted_hours"/>
</xpath>
</field>
</record>