[IMP] product, website_sale: small improvements on priority field

- Rename Priority to Favorite
- Move the priority field star icon in the kanban view
- Remove the sequence field from the list view
- (website_sale) make the favorite column optional in tree view
- (website_sale) keep same order in kanban view than in list view

task-2496758

closes odoo/odoo#69657

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Romain Derie
2021-06-03 12:26:09 +00:00
parent 864595901e
commit 01788decbb
3 changed files with 29 additions and 12 deletions
+1 -1
View File
@@ -143,7 +143,7 @@ class ProductTemplate(models.Model):
priority = fields.Selection([
('0', 'Normal'),
('1', 'Favorite'),
], default='0', string="Priority")
], default='0', string="Favorite")
def _compute_item_count(self):
for template in self:
@@ -9,9 +9,7 @@
<field name="sale_ok" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="cost_currency_id" invisible="1"/>
<field name="sequence" widget="handle" readonly="1"/>
<field name="priority" widget="priority" nolabel="1"/>
<field name="priority" widget="priority" optional="show" nolabel="1"/>
<field name="name" string="Product Name"/>
<field name="default_code" optional="show"/>
<field name="barcode" optional="hide" attrs="{'readonly': [('product_variant_count', '>', 1)]}"/>
@@ -82,15 +80,19 @@
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<div class="oe_kanban_card oe_kanban_global_click">
<div class="o_kanban_image mr-1">
<img t-att-src="kanban_image('product.template', 'image_128', record.id.raw_value)" alt="Product" class="o_image_64_contain"/>
</div>
<div class="oe_kanban_details">
<field name="priority" widget="priority"/>
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
<div class="o_kanban_record_top mb-0">
<div class="o_kanban_record_headings">
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
</div>
<field name="priority" widget="priority"/>
</div>
<t t-if="record.default_code.value">[<field name="default_code"/>]</t>
<div t-if="record.product_variant_count.value &gt; 1" groups="product.group_product_variant">
<strong>
+17 -2
View File
@@ -46,7 +46,7 @@
<xpath expr="/tree" position="attributes">
<attribute name="default_order">website_sequence</attribute>
</xpath>
<field name="sequence" position="replace">
<field name="priority" position="before">
<field name="website_sequence" widget="handle"/>
</field>
<field name="website_id" position="after">
@@ -55,13 +55,28 @@
</field>
</record>
<record model="ir.ui.view" id="product_template_view_kanban_website_sale">
<field name="name">product.template.view.kanban.website_sale</field>
<field name="mode">primary</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="/kanban" position="attributes">
<attribute name="default_order">website_sequence</attribute>
</xpath>
<field name="id" position="after">
<field name="website_sequence"/>
</field>
</field>
</record>
<record id="product_template_action_website" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="res_model">product.template</field>
<field name="view_mode">tree,kanban,form,activity</field>
<field name="view_id"/>
<field name="search_view_id" ref="product_template_search_view_website"/>
<field name="context">{'search_default_published': 1, 'tree_view_ref':'website_sale.product_template_view_tree_website_sale'}</field>
<field name="context">{'search_default_published': 1, 'tree_view_ref':'website_sale.product_template_view_tree_website_sale', 'kanban_view_ref':'website_sale.product_template_view_kanban_website_sale'}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product