[IMP] hr_timesheet, project, hr_expense: Introduce multi-edit lists

closes odoo/odoo#40048

Taskid: 2078161
Related: odoo/enterprise#6633
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Yannick Tivisse
2019-12-09 11:29:18 +00:00
parent 6cbe824871
commit 4efe0e3b16
5 changed files with 21 additions and 15 deletions
+4 -4
View File
@@ -38,12 +38,12 @@
<field name="name">hr.expense.tree</field>
<field name="model">hr.expense</field>
<field name="arch" type="xml">
<tree string="Expenses" decoration-bf="message_unread == True" class="o_expense_tree" js_class="hr_expense_tree" decoration-info="state == 'draft'" decoration-muted="state == 'cancel'">
<tree string="Expenses" decoration-bf="message_unread == True" class="o_expense_tree" js_class="hr_expense_tree" decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" multi_edit="1">
<field name="attachment_number" invisible="True"/>
<field name="date" optional="show"/>
<field name="name"/>
<field name="employee_id"/>
<field name="sheet_id" optional="show" invisible="not context.get('show_report', False)"/>
<field name="sheet_id" optional="show" invisible="not context.get('show_report', False)" readonly="1"/>
<field name="payment_mode" optional="show"/>
<field name="reference" optional="hide"/>
<field name="analytic_account_id" optional="show" groups="analytic.group_analytic_accounting"/>
@@ -56,8 +56,8 @@
<field name="total_amount" optional="show" sum="Total Amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<button name="action_get_attachment_view" string="View Attached Documents" type="object" icon="fa-paperclip" attrs="{'invisible': [('attachment_number', '=', 0)]}"/>
<field name="message_unread" invisible="1"/>
<field name="state" optional="show"/>
<field name="company_id" optional="show" groups="base.group_multi_company"/>
<field name="state" optional="show" readonly="1"/>
<field name="company_id" optional="show" groups="base.group_multi_company" readonly="1"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
</tree>
</field>
+1 -2
View File
@@ -174,9 +174,8 @@
<field name="user_id" position="after">
<field name="planned_hours" widget="float_time" sum="Initially Planned Hours" optional="show"/>
<field name="effective_hours" widget="float_time" sum="Effective Hours" optional="show"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" readonly="1" optional="show"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" optional="show"/>
<field name="progress" widget="progressbar" optional="show" groups="hr_timesheet.group_hr_timesheet_user"/>
<field name="effective_hours" widget="float_time" sum="Spent Hours" invisible="1"/>
</field>
</field>
</record>
+7
View File
@@ -531,6 +531,11 @@ class Task(models.Model):
# customer portal: include comment and incoming emails in communication history
website_message_ids = fields.One2many(domain=lambda self: [('model', '=', self._name), ('message_type', 'in', ['email', 'comment'])])
@api.constrains('parent_id')
def _check_parent_id(self):
if not self._check_recursion():
raise ValidationError(_('Error! You cannot create recursive hierarchy of tasks.'))
@api.depends('date_deadline')
def _compute_date_deadline_formatted(self):
for task in self:
@@ -699,6 +704,8 @@ class Task(models.Model):
def write(self, vals):
now = fields.Datetime.now()
if 'parent_id' in vals and vals['parent_id'] in self.ids:
raise UserError(_("Sorry. You can't set a task as its parent task."))
# stage change: update date_last_stage_update
if 'stage_id' in vals:
vals.update(self.update_date_end(vals['stage_id']))
+7 -7
View File
@@ -672,20 +672,20 @@
<field name="model">project.task</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<tree decoration-bf="message_needaction==True" decoration-danger="date_deadline and (date_deadline&lt;current_date)" string="Tasks">
<field name="message_needaction" invisible="1"/>
<field name="sequence" invisible="not context.get('seq_visible', False)"/>
<field name="name"/>
<tree decoration-bf="message_needaction==True" decoration-danger="date_deadline and (date_deadline&lt;current_date)" string="Tasks" multi_edit="1">
<field name="message_needaction" invisible="1" readonly="1"/>
<field name="sequence" invisible="not context.get('seq_visible', False)" readonly="1"/>
<field name="name"/>
<!-- YTI TODO user_invisible and seq_visible seem to be useless -->
<field name="project_id" invisible="context.get('user_invisible', False)" optional="show"/>
<field name="project_id" invisible="context.get('user_invisible', False)" optional="show" readonly="1"/>
<field name="partner_id" optional="hide"/>
<field name="parent_id" groups="project.group_subtask_project" optional="show"/>
<field name="user_id" invisible="context.get('user_invisible', False)" optional="show"/>
<field name="date_deadline" optional="hide"/>
<field name="stage_id" invisible="context.get('set_visible',False)" optional="show"/>
<field name="stage_id" invisible="context.get('set_visible',False)" optional="show" readonly="1"/>
<field name="tag_ids" optional="hide" widget="many2many_tags"/>
<field name="company_id" groups="base.group_multi_company" optional="show"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
<field name="activity_exception_decoration" widget="activity_exception" readonly="1"/>
</tree>
</field>
</record>
@@ -18,8 +18,8 @@
<field name="inherit_id" ref="hr_expense.view_expenses_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='reference']" position="after">
<field name="sale_order_id" optional="hide" attrs="{'invisible': [('can_be_reinvoiced', '=', False)]}" options="{'no_create_edit': True, 'no_create': True, 'no_open': True}" context="{'sale_show_partner_name': True, 'sale_expense_all_order': True}"/>
<field name="can_be_reinvoiced" invisible="1"/>
<field name="sale_order_id" optional="hide" attrs="{'invisible': [('can_be_reinvoiced', '=', False)]}" options="{'no_create_edit': True, 'no_create': True, 'no_open': True}" context="{'sale_show_partner_name': True, 'sale_expense_all_order': True}" readonly="1"/>
<field name="can_be_reinvoiced" invisible="1" readonly="1"/>
</xpath>
</field>
</record>