Skip to content

Commit

Permalink
[IMP] project,*: display kanban view in project and task x2m notebook…
Browse files Browse the repository at this point in the history
… fields

display the kanban view instead of the list view on mobile for the following fields:
- project.task form view > sub-tasks
- project.task form view > blocked by
- project.project form view > invoicing

Task-3631847

Part-of: odoo#145612
  • Loading branch information
bastvdn committed Apr 13, 2024
1 parent 2c17bc5 commit 4d9357e
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 6 deletions.
2 changes: 1 addition & 1 deletion addons/hr_timesheet/views/project_task_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<div class="row">
<div class="col-6 d-flex">
<field name="employee_id" class="me-1" widget="many2one_avatar_employee" context="{'active_test': True}" readonly="readonly_timesheet"/>
<strong><span><t t-esc="record.employee_id.value"/></span></strong>
<strong><span class="ps-1"><t t-esc="record.employee_id.value"/></span></strong>
</div>
<div class="col-6 float-end text-end">
<strong><t t-esc="record.date.value"/></strong>
Expand Down
41 changes: 37 additions & 4 deletions addons/project/views/project_task_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,16 @@
</page>
<page name="sub_tasks_page" string="Sub-tasks" invisible="not project_id">
<field name="child_ids"
context="{'default_project_id': project_id, 'default_display_in_project': False, 'default_user_ids': user_ids, 'default_parent_id': id,
'default_partner_id': partner_id, 'default_milestone_id': allow_milestones and milestone_id}"
mode="tree,kanban"
context="{
'default_project_id': project_id,
'default_display_in_project': False,
'default_user_ids': user_ids,
'default_parent_id': id,
'default_partner_id': partner_id,
'default_milestone_id': allow_milestones and milestone_id,
'kanban_view_ref': 'project.project_sub_task_view_kanban_mobile',
}"
widget="subtasks_one2many">
<tree editable="bottom" decoration-muted="state in ['1_done','1_canceled']" open_form_view="True">
<field name="allow_milestones" column_invisible="True"/>
Expand Down Expand Up @@ -452,8 +460,17 @@
</field>
</page>
<page name="task_dependencies" string="Blocked By" invisible="not allow_task_dependencies" groups="project.group_project_task_dependencies">
<field name="depend_on_ids" nolabel="1"
context="{'default_project_id': project_id, 'search_view_ref' : 'project.view_task_search_form', 'search_default_project_id': project_id, 'tree_view_ref': 'project.open_view_all_tasks_list_view', 'search_default_open_tasks': 1}">
<field name="depend_on_ids"
nolabel="1"
mode="tree,kanban"
context="{
'default_project_id': project_id,
'search_view_ref' : 'project.view_task_search_form',
'search_default_project_id': project_id,
'tree_view_ref': 'project.open_view_all_tasks_list_view',
'search_default_open_tasks': 1,
'kanban_view_ref': 'project.project_sub_task_view_kanban_mobile',
}">
<tree editable="bottom" decoration-muted="state in ['1_done','1_canceled']" open_form_view="True">
<field name="allow_milestones" column_invisible="True"/>
<field name="parent_id" column_invisible="True" />
Expand Down Expand Up @@ -685,6 +702,22 @@
</field>
</record>

<!-- View used in the Sub-tasks, Blocked by notebook page in the task form view in mobile -->
<record id="project_sub_task_view_kanban_mobile" model="ir.ui.view">
<field name="name">project.task.kanban</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_kanban"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('o_kanban_record_headings')]/span[@t-if='record.parent_id.raw_value']" position="after">
<span invisible="project_id == context.get('active_id', False)" class="d-block mt-1">
<field name="project_id" options="{'no_open': True}"/>
</span>
</xpath>
<xpath expr="//div[hasclass('o_kanban_record_headings')]/span[@t-if='record.parent_id.raw_value']" position="replace"/>
</field>
</record>

<!-- The main base of the project.task tree view -->
<record id="project_task_view_tree_main_base" model="ir.ui.view">
<field name="name">project.task.view.tree.main.base</field>
Expand Down
78 changes: 77 additions & 1 deletion addons/sale_timesheet/views/project_task_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</xpath>
<xpath expr="//page[@name='settings']" position="after">
<page name="billing_employee_rate" string="Invoicing" invisible="not allow_billable or not partner_id">
<field name="sale_line_employee_ids" context="{'default_sale_line_id': sale_line_id}">
<field name="sale_line_employee_ids" mode="tree,kanban" context="{'default_sale_line_id': sale_line_id}">
<tree editable="bottom">
<field name="company_id" column_invisible="True"/>
<field name="partner_id" column_invisible="True"/>
Expand All @@ -38,6 +38,64 @@
<field name="currency_id" column_invisible="True"/>
<field name="cost_currency_id" column_invisible="True"/>
</tree>
<kanban class="o_kanban_mobile">
<field name="employee_id"/>
<field name="sale_line_id"/>
<field name="existing_employee_ids"/>
<field name="partner_id"/>
<field name="currency_id"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div class="row">
<div class="col-8 d-flex">
<field name="employee_id" widget="many2one_avatar_employee"/>
<strong><span class="ps-1"><t t-esc="record.employee_id.value"/></span></strong>
</div>
<div class="col-4 float-end text-end">
<b>Unit Price: </b>
<field name="price_unit" widget="monetary" force_save="1" options="{'currency_field': 'currency_id'}"/>
</div>
</div>
<div class="row">
<div class="col-8 text-muted">
<span><t t-esc="record.sale_line_id.value"/></span>
</div>
<div class="col-4">
<span class="float-end text-end">
<b>Daily Cost: </b>
<field name="display_cost" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</span>
</div>
</div>
</div>
</t>
</templates>
</kanban>
<form string="Timesheet Activities">
<sheet>
<group>
<field name="existing_employee_ids" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="sale_order_id" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="employee_id" widget="many2one_avatar_employee" required="1"/>
<field name="sale_line_id" invisible="parent.id" options="{'no_create': True}" context="{'search_default_order_id': sale_order_id}"/>
<field name="sale_line_id" invisible="not parent.id" required="True" groups="!sales_team.group_sale_salesman" options="{'no_create': True}"
context="{'search_default_order_id': sale_order_id}"/>
<field name="sale_line_id" invisible="not parent.id" required="True" groups="sales_team.group_sale_salesman" options="{'no_quick_create': True}"
context="{
'search_default_order_id': sale_order_id,
'form_view_ref': 'sale_project.sale_order_line_view_form_editable',
'default_partner_id': parent.partner_id,
'default_company_id': parent.company_id,
'default_order_id': sale_order_id,
}"/>
<field name="price_unit" widget="monetary" readonly="True" force_save="1" options="{'currency_field': 'currency_id'}"/>
<field name="display_cost" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
</sheet>
</form>
</field>
<p class="text-muted">
<i class="fa fa-lightbulb-o"/>
Expand Down Expand Up @@ -140,6 +198,24 @@
domain="[('is_service', '=', True), ('order_partner_id', 'child_of', parent.partner_id), ('is_expense', '=', False), ('state', '=', 'sale'), ('is_downpayment', '=', False)]"
optional="hide"/>
</xpath>
<xpath expr="//field[@name='timesheet_ids']/form//field[@name='unit_amount']" position="after">
<field name="timesheet_invoice_id" invisible="1"/>
<field name="so_line" widget="so_line_field" groups="!sales_team.group_sale_salesman"
invisible="not parent.allow_billable"
readonly="readonly_timesheet"
context="{'with_remaining_hours': True, 'with_price_unit': True}" options="{'no_create': True, 'no_open': True}"
domain="[('is_service', '=', True), ('order_partner_id', 'child_of', parent.partner_id), ('is_expense', '=', False), ('state', '=', 'sale')]"
placeholder="Non-billable"
optional="hide"/>
<field
name="so_line" widget="so_line_field" groups="sales_team.group_sale_salesman"
options="{'no_create': True, 'no_open': True}"
context="{'create': False, 'edit': False, 'delete': False, 'with_price_unit': True}"
invisible="not parent.allow_billable"
domain="[('is_service', '=', True), ('order_partner_id', 'child_of', parent.partner_id), ('is_expense', '=', False), ('state', '=', 'sale')]"
readonly="readonly_timesheet"
placeholder="Non-billable"/>
</xpath>
<xpath expr="//field[@name='remaining_hours']" position="after">
<t groups="hr_timesheet.group_hr_timesheet_user">
<field name="sale_order_id" invisible="1"/>
Expand Down

0 comments on commit 4d9357e

Please sign in to comment.