Skip to content

Commit

Permalink
[IMP] various: Update list views with new widgets
Browse files Browse the repository at this point in the history
Purpose
=======

The following task implemented new widgets/features in the listview for better UI.
https://www.odoo.com/web#id=2195254&action=327&model=project.task&view_type=form&cids=1&menu_id=4720

The goal of the current task is to use those to upgrade our listviews

Specification
=============

Below are change requests on various listviews.

Remove decoration-bf="message_needaction==True" from every listview in every module.

PRODUCT - stock.view_stock_product_template_tree (product template)

remove all decorations from <tree>
set the following decorations on 'virtual_available' and 'qty_available'
decoration-danger="virtual_available&lt;0"
decoration-warning="virtual_available==0"
also set decoration-bf on 'virtual_available'
apply the same modifications on stock.view_stock_product_tree for product variants

SUBSCRIPTION - sale_subscription.sale_subscription_view_list

remove all decorations from <tree>
'stage_id' field
set <field name="stage_id" widget="badge" decoration-info="stage_category == 'draft'" decoration-success="stage_category == 'progress'"/>
'recurring_next_date' field
set <field name="recurring_next_date" string="Next Invoice" widget="remaining_days" attrs="{'invisible': [('stage_category', '!=', 'progress')]}"/>
set decoration-bf on 'code' and 'recurring_total_incl'
move 'percentage_satisfaction' before 'recurring_total_incl'
set widget="many2one_avatar_user" on 'user_id'
add <field name="activity_ids" widget="list_activity"/> after 'user_id'

ELEARNING - website_slides.slide_channel_view_tree

set widget="many2one_avatar_user" on 'user_id'
'enroll' field
set <field name="enroll" widget="badge" decoration-success="enroll == 'public'" decoration-info="enroll == 'invite'" decoration-warning="enroll == 'payment'"/>

POS - point_of_sale.view_pos_order_tree

remove all decorations from <tree>
'state' field
make visible and move it at the end of the view
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state not in ('draft','cancel')"/>
set decoration-bf on 'name'

APPRAISAL - hr_appraisal.view_hr_appraisal_tree

'state' field
set <field name="state" widget="badge" decoration-info="state in ('new','pending')" decoration-success="state == 'done'"/>
'date_close' field
set <field name="date_close" widget="remaining_days" attrs="{'invisible': ['|',('state','=','done'),('state','=','cancel')]}"/>

PAYMENT - account.view_account_payment_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'posted'"/>
move 'company_id' before 'amount'

CONTRACT - hr_contract.hr_contract_view_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state == 'close'" decoration-success="state == 'open'"/>
set widget="many2one_avatar_employee" on 'employee_id'

PAYSLIPS - hr_payroll.view_hr_payslip_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state == 'verify'" decoration-success="state in ('done','paid')"/>
set decoration-bf on 'number' and 'net_wage'
move 'company_id' before 'basic_wage'
set widget="many2one_avatar_employee" on 'employee_id'

SURVEY - survey.survey_tree

'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'open'"/>

APPLICATION - hr_recruitment.crm_case_tree_view_job

set widget="date' on 'create_date'
set widget="priority' on 'priority'
set widget="many2one_avatar_user" on 'user_id'

TIME OFF - hr_holidays.hr_leave_view_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state in ('confirm','validate1')" decoration-success="state == 'validate'"/>
apply the same changes in hr_holidays.hr_leave_allocation_view_tree

closes odoo#51305

Taskid: 2256589
Related: odoo/enterprise#10614
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
  • Loading branch information
tivisse committed May 15, 2020
1 parent e8ca972 commit 7b714a3
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 53 deletions.
6 changes: 3 additions & 3 deletions addons/account/views/account_payment_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<field name="name">account.payment.tree</field>
<field name="model">account.payment</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancelled'" edit="false">
<tree edit="false">
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="payment_method_id"/>
<field name="partner_id" string="Customer"/>
<field name="amount" sum="Amount"/>
<field name="state"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="amount" sum="Amount"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'posted'"/>
<field name="currency_id" groups="base.group_multi_currency"/>
</tree>
</field>
Expand Down
2 changes: 1 addition & 1 deletion addons/calendar/views/calendar_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<field name="name">calendar.event.tree</field>
<field name="model">calendar.event</field>
<field name="arch" type="xml">
<tree string="Meetings" decoration-bf="message_needaction==True" multi_edit="1">
<tree string="Meetings" multi_edit="1">
<field name="name" string="Subject" readonly="1"/>
<field name="allday" invisible="True"/>
<field name="start" string="Start Date"/>
Expand Down
4 changes: 2 additions & 2 deletions addons/crm/views/crm_lead_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
<field name="name">crm.lead.tree.lead</field>
<field name="model">crm.lead</field>
<field name="arch" type="xml">
<tree string="Leads" decoration-bf="message_needaction==True" decoration-muted="probability == 100">
<tree string="Leads" decoration-muted="probability == 100">
<field name="date_deadline" invisible="1"/>
<field name="create_date" optional="hide"/>
<field name="name" string="Lead"/>
Expand Down Expand Up @@ -598,7 +598,7 @@
<field name="name">crm.lead.tree.opportunity</field>
<field name="model">crm.lead</field>
<field name="arch" type="xml">
<tree string="Opportunities" decoration-bf="message_needaction==True" decoration-muted="probability == 100" decoration-danger="activity_date_deadline and (activity_date_deadline &lt; current_date)">
<tree string="Opportunities" decoration-muted="probability == 100" decoration-danger="activity_date_deadline and (activity_date_deadline &lt; current_date)">
<field name="date_deadline" invisible="1"/>
<field name="create_date" optional="hide"/>
<field name="name" string="Opportunity"/>
Expand Down
3 changes: 1 addition & 2 deletions addons/event/views/event_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@
<field name="model">event.event</field>
<field name="arch" type="xml">
<tree string="Events"
decoration-bf="message_needaction==True"
decoration-danger="(seats_max and seats_max&lt;seats_reserved)"
multi_edit="1">
<field name="name"/>
Expand Down Expand Up @@ -481,7 +480,7 @@
<field name="name">event.registration.tree</field>
<field name="model">event.registration</field>
<field name="arch" type="xml">
<tree string="Registration" decoration-bf="message_needaction==True" multi_edit="1">
<tree string="Registration" multi_edit="1">
<field name="create_date" optional="hide"/>
<field name="date_open" optional="hide"/>
<field name="partner_id"/>
Expand Down
2 changes: 1 addition & 1 deletion addons/hr/views/hr_job_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<field name="name">hr.job.tree</field>
<field name="model">hr.job</field>
<field name="arch" type="xml">
<tree string="Job" decoration-bf="message_needaction==True">
<tree string="Job">
<field name="name"/>
<field name="department_id"/>
<field name="no_of_employee"/>
Expand Down
11 changes: 3 additions & 8 deletions addons/hr_contract/views/hr_contract_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,14 @@
<field name="name">hr.contract.tree</field>
<field name="model">hr.contract</field>
<field name="arch" type="xml">
<tree string="Contracts"
decoration-bf="message_needaction == True"
decoration-info="state == 'draft'"
decoration-muted="state in ('close', 'cancel')"
decoration-danger="state == 'pending'"
multi_edit="1">
<tree string="Contracts" multi_edit="1">
<field name="name" readonly="1"/>
<field name="employee_id" readonly="1"/>
<field name="employee_id" readonly="1" widget="many2one_avatar_employee"/>
<field name="job_id"/>
<field name="resource_calendar_id"/>
<field name="date_start" readonly="1"/>
<field name="date_end" readonly="1"/>
<field name="state"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state == 'close'" decoration-success="state == 'open'"/>
<field name="kanban_state" widget="state_selection" readonly="1"/>
<field name="wage" invisible="1"/>
<field name="message_needaction" invisible="1"/>
Expand Down
5 changes: 2 additions & 3 deletions addons/hr_holidays/views/hr_leave_allocation_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,14 @@
<field name="model">hr.leave.allocation</field>
<field name="priority">16</field>
<field name="arch" type="xml">
<tree decoration-danger="state == 'refuse'" decoration-info="state == 'draft'" string="Allocation Requests"
decoration-bf="message_needaction == True">
<tree string="Allocation Requests">
<field name="employee_id"/>
<field name="department_id" optional="hide"/>
<field name="holiday_status_id"/>
<field name="name"/>
<field name="duration_display"/>
<field name="message_needaction" invisible="1"/>
<field name="state"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state in ('confirm','validate1')" decoration-success="state == 'validate'"/>
<button string="Approve" name="action_approve" type="object"
icon="fa-thumbs-up"
states="confirm"
Expand Down
5 changes: 2 additions & 3 deletions addons/hr_holidays/views/hr_leave_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,7 @@
<field name="name">hr.holidays.view.tree</field>
<field name="model">hr.leave</field>
<field name="arch" type="xml">
<tree decoration-danger="state == 'refuse'" decoration-info="state == 'draft'" string="Time Off Requests"
decoration-bf="message_needaction == True">
<tree string="Time Off Requests">
<field name="employee_id"/>
<field name="department_id"/>
<field name="holiday_type" string="Mode" groups="base.group_no_one"/>
Expand All @@ -492,7 +491,7 @@
<field name="date_from"/>
<field name="date_to"/>
<field name="duration_display"/>
<field name="state"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state in ('confirm','validate1')" decoration-success="state == 'validate'"/>
<field name="payslip_status" widget="toggle_button" options='{"active": "Reported in last payslips", "inactive": "To Report in Payslip"}' groups="hr_holidays.group_hr_holidays_user"/>
<field name="category_id" invisible="1"/>
<field name="department_id" invisible="1"/>
Expand Down
8 changes: 4 additions & 4 deletions addons/hr_recruitment/views/hr_recruitment_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<field name="name">Applicants</field>
<field name="model">hr.applicant</field>
<field name="arch" type="xml">
<tree string="Applicants" decoration-bf="message_needaction==True" multi_edit="1">
<tree string="Applicants" multi_edit="1">
<field name="message_needaction" invisible="1"/>
<field name="last_stage_id" invisible="1"/>
<field name="create_date" readonly="1"/>
<field name="create_date" readonly="1" widget="date"/>
<field name="date_last_stage_update" invisible="1"/>
<field name="name" readonly="1"/>
<field name="partner_name" readonly="1"/>
Expand All @@ -37,11 +37,11 @@
<field name="stage_id"/>
<field name="medium_id"/>
<field name="source_id" readonly="1"/>
<field name="priority"/>
<field name="priority" widget="priority"/>
<field name="type_id" invisible="1"/>
<field name="availability" invisible="1"/>
<field name="department_id" invisible="context.get('invisible_department', True)" readonly="1"/>
<field name="user_id"/>
<field name="user_id" widget="many2one_avatar_user"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
</tree>
</field>
Expand Down
4 changes: 2 additions & 2 deletions addons/maintenance/views/maintenance_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
<field name="name">equipment.request.tree</field>
<field name="model">maintenance.request</field>
<field name="arch" type="xml">
<tree string="maintenance Request" multi_edit="1" decoration-bf="message_needaction==True">
<tree string="maintenance Request" multi_edit="1">
<field name="message_needaction" invisible="1"/>
<field name="name"/>
<field name="request_date" groups="base.group_no_one"/>
Expand Down Expand Up @@ -484,7 +484,7 @@
<field name="name">equipment.tree</field>
<field name="model">maintenance.equipment</field>
<field name="arch" type="xml">
<tree string="Assign To User" decoration-bf="message_needaction==True">
<tree string="Assign To User">
<field name="message_needaction" invisible="1"/>
<field name="name"/>
<!-- <field name="active" invisible="1"/> -->
Expand Down
2 changes: 1 addition & 1 deletion addons/mrp/views/mrp_production_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<field name="model">mrp.production</field>
<field name="arch" type="xml">
<tree string="Manufacturing Orders" default_order="date_planned_start desc"
decoration-bf="message_needaction==True" decoration-info="state=='confirmed'"
decoration-info="state=='confirmed'"
decoration-danger="date_planned_start&lt;current_date and state not in ('done','cancel')"
decoration-muted="state in ('done','cancel')" multi_edit="1">
<field name="message_needaction" invisible="1"/>
Expand Down
6 changes: 3 additions & 3 deletions addons/point_of_sale/views/pos_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,16 @@
<field name="name">pos.order.tree</field>
<field name="model">pos.order</field>
<field name="arch" type="xml">
<tree string="POS Orders" decoration-info="state == 'draft'" decoration-muted="state in ('done','cancel')" create="0">
<tree string="POS Orders" create="0">
<field name="currency_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="name"/>
<field name="name" decoration-bf="1"/>
<field name="session_id" />
<field name="date_order"/>
<field name="pos_reference"/>
<field name="partner_id"/>
<field string="Cashier" name="user_id"/>
<field name="amount_total" sum="Amount total" widget="monetary"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state not in ('draft','cancel')"/>
</tree>
</field>
</record>
Expand Down
4 changes: 2 additions & 2 deletions addons/project/views/project_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
<field name="name">project.project.tree</field>
<field name="model">project.project</field>
<field name="arch" type="xml">
<tree decoration-bf="message_needaction==True" decoration-muted="active == False" string="Projects" delete="0">
<tree decoration-muted="active == False" string="Projects" delete="0">
<field name="sequence" optional="show" widget="handle"/>
<field name="message_needaction" invisible="1"/>
<field name="active" invisible="1"/>
Expand Down Expand Up @@ -860,7 +860,7 @@
<field name="model">project.task</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<tree decoration-bf="message_needaction==True" decoration-danger="not is_closed and date_deadline and (date_deadline&lt;current_date)" string="Tasks" multi_edit="1">
<tree decoration-danger="not is_closed and date_deadline and (date_deadline&lt;current_date)" string="Tasks" multi_edit="1">
<field name="message_needaction" invisible="1" readonly="1"/>
<field name="is_closed" invisible="1" />
<field name="sequence" invisible="not context.get('seq_visible', False)" readonly="1"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
<field name="name">purchase.requisition.tree</field>
<field name="model">purchase.requisition</field>
<field name="arch" type="xml">
<tree decoration-bf="message_needaction==True" decoration-muted="state == 'cancel'" decoration-danger="date_end and date_end&lt;current_date" string="Purchase Agreements">
<tree decoration-muted="state == 'cancel'" decoration-danger="date_end and date_end&lt;current_date" string="Purchase Agreements">
<field name="message_needaction" invisible="1"/>
<field name="name"/>
<field name="user_id" optional="show"/>
Expand Down
4 changes: 2 additions & 2 deletions addons/sale/views/sale_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
<field name="model">sale.order</field>
<field name="priority">2</field>
<field name="arch" type="xml">
<tree string="Sales Orders" decoration-bf="message_needaction==True" multi_edit="1">
<tree string="Sales Orders" multi_edit="1">
<field name="message_needaction" invisible="1"/>
<field name="name" string="Number" readonly="1" decoration-bf="1"/>
<field name="date_order" string="Order Date" widget="date" optional="show"/>
Expand Down Expand Up @@ -223,7 +223,7 @@
<field name="model">sale.order</field>
<field name="priority">4</field>
<field name="arch" type="xml">
<tree string="Quotation" class="o_sale_order" decoration-bf="message_needaction==True" multi_edit="1">
<tree string="Quotation" class="o_sale_order" multi_edit="1">
<field name="name" string="Number" readonly="1" decoration-bf="1"/>
<field name="create_date" string="Creation Date" widget="date" optional="show"/>
<field name="commitment_date" widget="date" optional="hide"/>
Expand Down
16 changes: 4 additions & 12 deletions addons/stock/views/product_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,9 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view"/>
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="decoration-danger">type == 'product' and virtual_available&lt;0</attribute>
<attribute name="decoration-info">type != 'product' or virtual_available&gt;=0</attribute>
</tree>
<field name="price" position="after">
<field name="qty_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show"/>
<field name="virtual_available" attrs="{'invisible':[('type', '!=', 'product')]}" string="Forecasted Quantity" optional="show"/>
<field name="qty_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show" decoration-danger="virtual_available &lt; 0" decoration-warning="virtual_available == 0" decoration-bf="1"/>
<field name="virtual_available" attrs="{'invisible':[('type', '!=', 'product')]}" string="Forecasted Quantity" optional="show" decoration-danger="virtual_available &lt; 0" decoration-warning="virtual_available == 0"/>
</field>
</field>
</record>
Expand All @@ -53,13 +49,9 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="decoration-danger">type == 'product' and virtual_available&lt;0</attribute>
<attribute name="decoration-info">type != 'product' or virtual_available&gt;=0</attribute>
</tree>
<field name="uom_id" position="before">
<field name="qty_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show"/>
<field name="virtual_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show"/>
<field name="qty_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show" decoration-danger="virtual_available &lt; 0" decoration-warning="virtual_available == 0"/>
<field name="virtual_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show" decoration-danger="virtual_available &lt; 0" decoration-warning="virtual_available == 0" decoration-bf="1"/>
</field>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion addons/survey/views/survey_survey_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<field name="active" invisible="1"/>
<field name="certification" invisible="1"/>
<field name="title"/>
<field name="state"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'open'"/>
<field name="answer_count"/>
<field name="answer_done_count"/>
<field name="success_count"/>
Expand Down
4 changes: 2 additions & 2 deletions addons/website_slides/views/slide_channel_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
<field name="name"/>
<field name="channel_type"/>
<field name="visibility"/>
<field name="enroll"/>
<field name="user_id"/>
<field name="enroll" widget="badge" decoration-success="enroll == 'public'" decoration-info="enroll == 'invite'" decoration-warning="enroll == 'payment'"/>
<field name="user_id" widget="many2one_avatar_user"/>
<field name="website_id" groups="website.group_multi_website"/>
<field name="active" invisible="1"/>
</tree>
Expand Down

0 comments on commit 7b714a3

Please sign in to comment.