Permalink
Browse files

[IMP] product: pricelists - multiple prices per product

currently, if the user selects Multiple prices per product
in Multiple Product Prices, the user cannot set product
directly from product.pricelist formview.

purpose of this commit is to make multiple prices par product
fromview quick editable and reflect that to the product.product formview.

Task: #1904777
Close: #30540
  • Loading branch information...
mgh-odoo committed Jan 25, 2019
1 parent 8f486db commit 6d241f0c7dd9b8d238b9a006d08ef9c2235a3fee
Showing with 31 additions and 7 deletions.
  1. +5 −4 addons/product/models/product_pricelist.py
  2. +26 −3 addons/product/views/product_pricelist_views.xml
@@ -18,10 +18,11 @@ def _get_default_currency_id(self):
return self.env.user.company_id.currency_id.id

def _get_default_item_ids(self):
ProductPricelistItem = self.env['product.pricelist.item']
vals = ProductPricelistItem.default_get(list(ProductPricelistItem._fields))
vals.update(compute_price='formula')
return [[0, False, vals]]
if self.user_has_groups('product.group_pricelist_item'):
ProductPricelistItem = self.env['product.pricelist.item']
vals = ProductPricelistItem.default_get(list(ProductPricelistItem._fields))
vals.update(compute_price='formula')
return [[0, False, vals]]

name = fields.Char('Pricelist Name', required=True, translate=True)
active = fields.Boolean('Active', default=True, help="If unchecked, it will allow you to hide the pricelist without removing it.")
@@ -149,9 +149,10 @@
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
<field name="country_group_ids"/>
</group>
<div groups="product.group_pricelist_item">
<separator string="Pricelist Items"/>
<field name="item_ids" nolabel="1" context="{'default_base':'list_price'}">
<div>
<separator string="Pricelist Items" groups="product.group_pricelist_item"/>
<separator string="Productlist Items" groups="product.group_product_pricelist"/>
<field name="item_ids" nolabel="1" context="{'default_base':'list_price'}" groups="product.group_pricelist_item">
<tree string="Pricelist Items">
<field name="name" string="Applicable On"/>
<field name="min_quantity"/>
@@ -169,6 +170,28 @@
</form>
</field>
</record>

<record id="product_pricelist_view_inherit" model="ir.ui.view">
<field name="name">product.pricelist.form.inherit</field>
<field name="model">product.pricelist</field>
<field name="inherit_id" ref="product.product_pricelist_view"/>
<field name="groups_id" eval="[(4, ref('product.group_product_pricelist'))]"/>
<field name="arch" type="xml">
<field name="item_ids" position="replace">
<field name="item_ids" nolabel="1" context="{'default_base':'list_price', 'default_applied_on' :'1_product'}">
<tree string="Pricelist Items" editable="bottom">
<field name="product_tmpl_id" string="Products" required="1"/>
<field name="fixed_price" string="Price" widget="monetary"/>
<field name="min_quantity"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="applied_on" invisible="1"/>
</tree>
</field>
</field>
</field>
</record>

<record model="ir.ui.view" id="inherits_website_sale_country_group_form">
<field name="name">website_sale.country_group.form</field>
<field name="model">res.country.group</field>

0 comments on commit 6d241f0

Please sign in to comment.