summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaa <laa@odoo.com>2019-10-28 12:28:35 +0000
committerYannick Tivisse <yti@odoo.com>2019-11-18 12:56:10 +0000
commit70c370b01ecfdeab51611e09d6efeec683833887 (patch)
treebacaf231dfa886ebe398e12ae885caf87b2236b4
parent4c28667efd3a6d7560be9fe656a0f48328f6c1ea (diff)
[IMP] project,hr_expense,hr_timeshee: Add optional fields in list view
Add and modify multiple fields in tree view for next next model: - hr.expense - hr.expense.sheet - project.project - planning.slot - Field Service project.task closes odoo/odoo#39441 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
-rw-r--r--addons/hr_expense/views/hr_expense_views.xml61
-rw-r--r--addons/hr_timesheet/views/project_views.xml1
-rw-r--r--addons/project/views/project_views.xml17
-rw-r--r--addons/sale_expense/views/hr_expense_views.xml11
-rw-r--r--addons/sale_timesheet/views/project_task_views.xml12
5 files changed, 71 insertions, 31 deletions
diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml
index f79e266ef68..08b88107ac9 100644
--- a/addons/hr_expense/views/hr_expense_views.xml
+++ b/addons/hr_expense/views/hr_expense_views.xml
@@ -28,21 +28,26 @@
<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'">
- <field name="currency_id" invisible="True"/>
<field name="attachment_number" invisible="True"/>
- <field name="date"/>
+ <field name="date" optional="show"/>
<field name="name"/>
<field name="employee_id"/>
- <field name="sheet_id" invisible="not context.get('show_report', False)"/>
- <field name="payment_mode"/>
- <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
- <field name="company_id" groups="base.group_multi_company"/>
- <field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags"/>
- <field name="total_amount" sum="Total Amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
+ <field name="sheet_id" optional="show" invisible="not context.get('show_report', False)"/>
+ <field name="payment_mode" optional="show"/>
+ <field name="reference" optional="hide"/>
+ <field name="analytic_account_id" optional="show" groups="analytic.group_analytic_accounting"/>
+ <field name="analytic_tag_ids" optional="hide" widget="many2many_tags" groups="analytic.group_analytic_tags"/>
+ <field name="account_id" optional="hide"/>
+ <field name="unit_amount" optional="hide"/>
+ <field name="currency_id" optional="hide"/>
+ <field name="quantity" optional="hide"/>
+ <field name="tax_ids" optional="hide" widget="many2many_tags" groups="account.group_account_user"/>
+ <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"/>
- <field name="activity_exception_decoration" widget="activity_exception"/>
+ <field name="state" optional="show"/>
+ <field name="company_id" optional="show" groups="base.group_multi_company"/>
+ <field name="activity_exception_decoration" widget="activity_exception"/>
</tree>
</field>
</record>
@@ -443,15 +448,17 @@
<field name="model">hr.expense.sheet</field>
<field name="arch" type="xml">
<tree string="Expense Reports" decoration-warning="state=='draft'" decoration-bf="message_unread == True" decoration-danger="state=='cancel'">
+ <field name="accounting_date" optional="show" groups="account.group_account_manager"/>
+ <field name="create_date" optional="hide"/>
<field name="name" string="Expense Report"/>
<field name="employee_id"/>
- <field name="create_date"/>
- <field name="accounting_date" groups="account.group_account_manager"/>
- <field name="total_amount" sum="Total Amount"/>
- <field name="currency_id" invisible="1"/>
- <field name="state"/>
+ <field name="user_id" optional="show"/>
+ <field name="total_amount" optional="show" sum="Total Amount"/>
+ <field name="currency_id" optional="hide"/>
+ <field name="journal_id" optional="hide"/>
+ <field name="state" optional="show"/>
+ <field name="company_id" optional="show" groups="base.group_multi_company"/>
<field name="message_unread" invisible="1"/>
- <field name="company_id" groups="base.group_multi_company"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
</tree>
</field>
@@ -502,19 +509,23 @@
<page name="expenses" string="Expense">
<field name="expense_line_ids" nolabel="1" widget="many2many" domain="[('state', '=', 'draft'), ('employee_id', '=', employee_id), ('company_id', '=', company_id)]" options="{'reload_on_button': True}" context="{'form_view_ref' : 'hr_expense.hr_expense_view_form_without_header'}">
<tree decoration-danger="is_refused">
- <field name="date"/>
+ <field name="date" optional="show"/>
<field name="name"/>
<field name="state" invisible="1"/>
- <field name="analytic_account_id" domain="['|', ('company_id', '=', parent.company_id), ('company_id', '=', False)]" groups="analytic.group_analytic_accounting"/>
- <field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags"/>
+ <field name="reference" optional="hide"/>
+ <field name="analytic_account_id" optional="show" domain="['|', ('company_id', '=', parent.company_id), ('company_id', '=', False)]" groups="analytic.group_analytic_accounting"/>
+ <field name="analytic_tag_ids" optional="hide" widget="many2many_tags" groups="analytic.group_analytic_tags"/>
+ <field name="account_id" optional="hide"/>
<field name="message_unread" invisible="1"/>
- <field name="attachment_number" string=" "/>
- <button name="action_get_attachment_view" string="View Attachments" type="object" icon="fa-paperclip" attrs="{'invisible': ['&amp;', ('attachment_number', '=', 0), ('state', '!=', 'draft')]}"/>
- <field name="tax_ids" widget="many2many_tags" groups="account.group_account_user"/>
- <field name="currency_id" invisible="1"/>
- <field name="total_amount"/>
+ <field name="attachment_number" optional="show" string=" "/>
+ <button name="action_get_attachment_view" string="View Attachments" type="object" icon="fa-paperclip" attrs="{'invisible': ['&amp;', ('attachment_number', '=', 0), ('state', '!=', 'draft')]}"/>
+ <field name="unit_amount" optional="hide"/>
+ <field name="currency_id" optional="hide"/>
+ <field name="quantity" optional="hide"/>
+ <field name="tax_ids" optional="hide" widget="many2many_tags" groups="account.group_account_user"/>
+ <field name="total_amount" optional="show"/>
<field name="company_currency_id" invisible="1"/>
- <field name="total_amount_company" groups="base.group_multi_currency"/>
+ <field name="total_amount_company" optional="show" groups="base.group_multi_currency"/>
<field name="is_refused" invisible="True"/>
</tree>
</field>
diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml
index de2c9365aff..facbb67f4e5 100644
--- a/addons/hr_timesheet/views/project_views.xml
+++ b/addons/hr_timesheet/views/project_views.xml
@@ -163,6 +163,7 @@
<field name="arch" type="xml">
<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="progress" widget="progressbar" optional="show" groups="hr_timesheet.group_hr_timesheet_user"/>
<field name="effective_hours" widget="float_time" sum="Spent Hours" invisible="1"/>
diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml
index 376706bc75a..5b9adae0dd7 100644
--- a/addons/project/views/project_views.xml
+++ b/addons/project/views/project_views.xml
@@ -218,13 +218,18 @@
<field name="model">project.project</field>
<field name="arch" type="xml">
<tree decoration-bf="message_needaction==True" decoration-muted="active == False" string="Projects">
- <field name="sequence" widget="handle"/>
+ <field name="sequence" optional="show" widget="handle"/>
<field name="message_needaction" invisible="1"/>
<field name="active" invisible="1"/>
<field name="name" string="Project Name"/>
- <field name="user_id" string="Project Manager"/>
- <field name="partner_id" string="Contact"/>
- <field name="company_id" groups="base.group_multi_company"/>
+ <field name="user_id" optional="show" string="Project Manager"/>
+ <field name="partner_id" optional="show" string="Contact"/>
+ <field name="analytic_account_id" optional="hide"/>
+ <field name="privacy_visibility" optional="hide"/>
+ <field name="subtask_project_id" optional="hide"/>
+ <field name="resource_calendar_id" optional="hide"/>
+ <field name="label_tasks" optional="hide"/>
+ <field name="company_id" optional="show" groups="base.group_multi_company"/>
</tree>
</field>
</record>
@@ -667,11 +672,11 @@
<field name="sequence" invisible="not context.get('seq_visible', False)"/>
<field name="name"/>
<field name="project_id" invisible="context.get('user_invisible', False)" optional="show"/>
+ <field name="partner_id" optional="hide"/>
<field name="user_id" invisible="context.get('user_invisible', False)" optional="show"/>
<field name="date_deadline" optional="hide"/>
- <field name="partner_id" optional="hide"/>
- <field name="tag_ids" optional="hide" widget="many2many_tags"/>
<field name="stage_id" invisible="context.get('set_visible',False)" optional="show"/>
+ <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"/>
</tree>
diff --git a/addons/sale_expense/views/hr_expense_views.xml b/addons/sale_expense/views/hr_expense_views.xml
index 11bee076710..a108cbf3aa2 100644
--- a/addons/sale_expense/views/hr_expense_views.xml
+++ b/addons/sale_expense/views/hr_expense_views.xml
@@ -12,6 +12,17 @@
</xpath>
</field>
</record>
+ <record id="hr_expense_tree_view_inherit_sale_expense" model="ir.ui.view">
+ <field name="name">hr.expense.tree.inherit.sale.expense</field>
+ <field name="model">hr.expense</field>
+ <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"/>
+ </xpath>
+ </field>
+ </record>
<record id="hr_expense_form_view_inherit_account_manager" model="ir.ui.view">
<field name="name">hr.expense.form.inherit.sale.expense</field>
<field name="model">hr.expense</field>
diff --git a/addons/sale_timesheet/views/project_task_views.xml b/addons/sale_timesheet/views/project_task_views.xml
index 52e4aa9133b..591a8efa712 100644
--- a/addons/sale_timesheet/views/project_task_views.xml
+++ b/addons/sale_timesheet/views/project_task_views.xml
@@ -28,6 +28,18 @@
</field>
</record>
+ <record id="project_project_view_tree_inherit_sale_timesheet" model="ir.ui.view">
+ <field name="name">project.project.tree.inherit.sale.timesheet</field>
+ <field name="model">project.project</field>
+ <field name="inherit_id" ref="project.view_project"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='analytic_account_id']" position="after">
+ <field name="sale_order_id" optional="hide" widget="sale_order_many2one"/>
+ <field name="sale_line_id" optional="hide" widget="sale_order_many2one"/>
+ </xpath>
+ </field>
+ </record>
+
<record id="project_project_view_kanban_inherit_sale_timesheet" model="ir.ui.view">
<field name="name">project.project.kanban.inherit.sale.timesheet</field>
<field name="model">project.project</field>