diff --git a/product_pricelist_supplierinfo/README.rst b/product_pricelist_supplierinfo/README.rst new file mode 100644 index 000000000000..e432de8f0b07 --- /dev/null +++ b/product_pricelist_supplierinfo/README.rst @@ -0,0 +1,132 @@ +======================================== +Supplier info prices in sales pricelists +======================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/11.0/product_pricelist_supplierinfo + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-11-0/sale-workflow-11-0-product_pricelist_supplierinfo + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/167/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to create a sales pricelist based on product +supplierinfo prices. If you want, you can bypass minimum quantity in pricelist +item. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +Although this module doesn't depend technically on **Sales Management**, you +must install it for configuring and seeing the effects of it. + +Configuration +============= + +To configure pricelists with the new feature of this module, you need to: + +#. Go to *Sales > Configuration > Settings* and check + "Multiple Sales Prices per Product" option and + "Prices computed from formulas" after that. You must have correct + permissions and you must install **Sales Management** app (sale) to see + these settings. +#. Create or edit a Sales Pricelist at *Sales > Catalog > Pricelists*. +#. Add or edit a pricelist item and check "Formula" option in + "Price Computation" section. +#. You will see the new option "Prices based on supplier info". +#. If you want to bypass the "Min.Quantity" field of the supplier info and + always select the lowest quantity price, check the option + "Ignore Supplier Info Min. Quantity". + +Usage +===== + +For adding supplier info: + +#. Go to *Sales > Catalog > Products* +#. Open or create a product. +#. Go to "Purchase" page. +#. On "Vendors" section, add the supplier and prices. +#. You can drag and drop for reordering these lines. + +Check the remark in known issues about the supplier info line selection. + +For checking pricelists in action, you can (with `sale` module installed): + +#. Go to *Sales > Orders > Quotations* +#. Create or edit a quotation. +#. Add a line. +#. Select a product with the criteria to match the pricelist from supplier + info. +#. See the proper price appears in the line. + +Known issues / Roadmap +====================== + +* First line that matches by minimum quantity criteria, independently from the + supplier, will be the one that provides the price for the pricelist. +* There's no mechanism for selecting the supplier from possible sources like + sales orders. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Vicent Cubells + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_pricelist_supplierinfo/__init__.py b/product_pricelist_supplierinfo/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/product_pricelist_supplierinfo/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_pricelist_supplierinfo/__manifest__.py b/product_pricelist_supplierinfo/__manifest__.py new file mode 100644 index 000000000000..e44084cf3c1c --- /dev/null +++ b/product_pricelist_supplierinfo/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Supplier info prices in sales pricelists", + "summary": "Allows to create priceslists based on supplier info", + "version": "11.0.1.0.0", + "category": "Sales", + "website": "https://github.com/OCA/sale-workflow", + "author": "Tecnativa," + " Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "product", + ], + "data": [ + "views/product_pricelist_item_views.xml", + ], + "installable": True, +} diff --git a/product_pricelist_supplierinfo/i18n/es.po b/product_pricelist_supplierinfo/i18n/es.po new file mode 100644 index 000000000000..d1371ba00fbe --- /dev/null +++ b/product_pricelist_supplierinfo/i18n/es.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_pricelist_supplierinfo +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-10-31 17:35+0000\n" +"PO-Revision-Date: 2018-10-31 17:35+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_pricelist_supplierinfo +#: model:ir.ui.view,arch_db:product_pricelist_supplierinfo.product_pricelist_supplier_item_form_view +msgid "Supplier price - " +msgstr "Precio de proveedor - " + +#. module: product_pricelist_supplierinfo +#: model:ir.model.fields,field_description:product_pricelist_supplierinfo.field_product_pricelist_item_no_supplierinfo_min_quantity +msgid "Ignore Supplier Info Min. Quantity" +msgstr "Ignorar cantidad mínima de la info de proveedor" + +#. module: product_pricelist_supplierinfo +#: model:ir.model,name:product_pricelist_supplierinfo.model_product_pricelist +msgid "Pricelist" +msgstr "Lista de precios" + +#. module: product_pricelist_supplierinfo +#: model:ir.model,name:product_pricelist_supplierinfo.model_product_pricelist_item +msgid "Pricelist item" +msgstr "Item de Lista de precios" + +#. module: product_pricelist_supplierinfo +#: model:ir.model,name:product_pricelist_supplierinfo.model_product_product +msgid "Product" +msgstr "Producto" diff --git a/product_pricelist_supplierinfo/i18n/product_pricelist_supplierinfo.pot b/product_pricelist_supplierinfo/i18n/product_pricelist_supplierinfo.pot new file mode 100644 index 000000000000..7ebeab393bf9 --- /dev/null +++ b/product_pricelist_supplierinfo/i18n/product_pricelist_supplierinfo.pot @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_pricelist_supplierinfo +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-10-31 17:37+0000\n" +"PO-Revision-Date: 2018-10-31 17:37+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_pricelist_supplierinfo +#: model:ir.ui.view,arch_db:product_pricelist_supplierinfo.product_pricelist_supplier_item_form_view +msgid "Supplier price - " +msgstr "" + +#. module: product_pricelist_supplierinfo +#: model:ir.model.fields,field_description:product_pricelist_supplierinfo.field_product_pricelist_item_no_supplierinfo_min_quantity +msgid "Ignore Supplier Info Min. Quantity" +msgstr "" + +#. module: product_pricelist_supplierinfo +#: model:ir.model,name:product_pricelist_supplierinfo.model_product_pricelist +msgid "Pricelist" +msgstr "" + +#. module: product_pricelist_supplierinfo +#: model:ir.model,name:product_pricelist_supplierinfo.model_product_pricelist_item +msgid "Pricelist item" +msgstr "" + +#. module: product_pricelist_supplierinfo +#: model:ir.model,name:product_pricelist_supplierinfo.model_product_product +msgid "Product" +msgstr "" + diff --git a/product_pricelist_supplierinfo/models/__init__.py b/product_pricelist_supplierinfo/models/__init__.py new file mode 100644 index 000000000000..399ac6389c81 --- /dev/null +++ b/product_pricelist_supplierinfo/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_product +from . import product_pricelist diff --git a/product_pricelist_supplierinfo/models/product_pricelist.py b/product_pricelist_supplierinfo/models/product_pricelist.py new file mode 100644 index 000000000000..0bc892d3af37 --- /dev/null +++ b/product_pricelist_supplierinfo/models/product_pricelist.py @@ -0,0 +1,43 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class ProductPricelist(models.Model): + _inherit = 'product.pricelist' + + @api.multi + def _compute_price_rule(self, products_qty_partner, date=False, + uom_id=False): + """Recompute price after calling the atomic super method for + getting proper prices when based on supplier info. + """ + rule_obj = self.env['product.pricelist.item'] + result = super(ProductPricelist, self)._compute_price_rule( + products_qty_partner, date, uom_id) + # Make sure all rule records are fetched at once at put in cache + rule_obj.browse(x[1] for x in result.values()).mapped('price_discount') + for product, qty, _partner in products_qty_partner: + rule = rule_obj.browse(result[product.id][1]) + if rule.base == 'supplierinfo': + result[product.id] = ( + product._get_supplierinfo_pricelist_price( + rule, date=date, quantity=qty, + ), rule.id, + ) + return result + + +class ProductPricelistItem(models.Model): + _inherit = 'product.pricelist.item' + + base = fields.Selection( + selection_add=[ + ('supplierinfo', 'Prices based on supplier info'), + ], + ) + no_supplierinfo_min_quantity = fields.Boolean( + string='Ignore Supplier Info Min. Quantity', + ) diff --git a/product_pricelist_supplierinfo/models/product_product.py b/product_pricelist_supplierinfo/models/product_product.py new file mode 100644 index 000000000000..3f274eea7890 --- /dev/null +++ b/product_pricelist_supplierinfo/models/product_product.py @@ -0,0 +1,75 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models, tools + + +class ProductProduct(models.Model): + _inherit = 'product.product' + + def _get_supplierinfo_pricelist_price(self, rule, date=None, + quantity=None): + """Method for getting the price from supplier info.""" + self.ensure_one() + domain = [ + '|', + ('product_id', '=', self.id), + ('product_tmpl_id', '=', self.product_tmpl_id.id), + ] + if not rule.no_supplierinfo_min_quantity and quantity: + domain += [ + '|', + ('min_qty', '=', False), + ('min_qty', '>=', quantity), + ] + if date: + domain += [ + '|', + ('date_start', '=', False), + ('date_start', '<=', date), + '|', + ('date_end', '=', False), + ('date_end', '>=', date), + ] + # We use a different default order because we are interested in getting + # the price for lowest minimum quantity + price = self.env['product.supplierinfo'].search( + domain, limit=1, order='sequence, min_qty, price', + )[-1:].price + if price: + # We have to replicate this logic in this method as pricelist + # method are atomic and we can't hack inside. + # Verbatim copy of part of product.pricelist._compute_price_rule. + qty_uom_id = self._context.get('uom') or self.uom_id.id + price_uom = self.env['product.uom'].browse([qty_uom_id]) + convert_to_price_uom = ( + lambda price: self.uom_id._compute_price( + price, price_uom)) + price_limit = price + price = (price - (price * (rule.price_discount / 100))) or 0.0 + if rule.price_round: + price = tools.float_round( + price, precision_rounding=rule.price_round) + if rule.price_surcharge: + price_surcharge = convert_to_price_uom(rule.price_surcharge) + price += price_surcharge + if rule.price_min_margin: + price_min_margin = convert_to_price_uom(rule.price_min_margin) + price = max(price, price_limit + price_min_margin) + if rule.price_max_margin: + price_max_margin = convert_to_price_uom(rule.price_max_margin) + price = min(price, price_limit + price_max_margin) + return price + + @api.multi + def price_compute(self, price_type, uom=False, currency=False, + company=False): + """Return dummy not falsy prices when computation is done from supplier + info for avoiding error on super method. We will later fill these with + correct values. + """ + if price_type == 'supplierinfo': + return dict.fromkeys(self.ids, 1.0) + return super(ProductProduct, self).price_compute( + price_type, uom=uom, currency=currency, company=company) diff --git a/product_pricelist_supplierinfo/readme/CONFIGURE.rst b/product_pricelist_supplierinfo/readme/CONFIGURE.rst new file mode 100644 index 000000000000..61b870c79d07 --- /dev/null +++ b/product_pricelist_supplierinfo/readme/CONFIGURE.rst @@ -0,0 +1,14 @@ +To configure pricelists with the new feature of this module, you need to: + +#. Go to *Sales > Configuration > Settings* and check + "Multiple Sales Prices per Product" option and + "Prices computed from formulas" after that. You must have correct + permissions and you must install **Sales Management** app (sale) to see + these settings. +#. Create or edit a Sales Pricelist at *Sales > Catalog > Pricelists*. +#. Add or edit a pricelist item and check "Formula" option in + "Price Computation" section. +#. You will see the new option "Prices based on supplier info". +#. If you want to bypass the "Min.Quantity" field of the supplier info and + always select the lowest quantity price, check the option + "Ignore Supplier Info Min. Quantity". diff --git a/product_pricelist_supplierinfo/readme/CONTRIBUTORS.rst b/product_pricelist_supplierinfo/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..8f893b71dc04 --- /dev/null +++ b/product_pricelist_supplierinfo/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Vicent Cubells + * Pedro M. Baeza diff --git a/product_pricelist_supplierinfo/readme/DESCRIPTION.rst b/product_pricelist_supplierinfo/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..7881283a0c3c --- /dev/null +++ b/product_pricelist_supplierinfo/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows you to create a sales pricelist based on product +supplierinfo prices. If you want, you can bypass minimum quantity in pricelist +item. diff --git a/product_pricelist_supplierinfo/readme/INSTALL.rst b/product_pricelist_supplierinfo/readme/INSTALL.rst new file mode 100644 index 000000000000..6e98804bdeba --- /dev/null +++ b/product_pricelist_supplierinfo/readme/INSTALL.rst @@ -0,0 +1,2 @@ +Although this module doesn't depend technically on **Sales Management**, you +must install it for configuring and seeing the effects of it. diff --git a/product_pricelist_supplierinfo/readme/ROADMAP.rst b/product_pricelist_supplierinfo/readme/ROADMAP.rst new file mode 100644 index 000000000000..a3d583eed884 --- /dev/null +++ b/product_pricelist_supplierinfo/readme/ROADMAP.rst @@ -0,0 +1,4 @@ +* First line that matches by minimum quantity criteria, independently from the + supplier, will be the one that provides the price for the pricelist. +* There's no mechanism for selecting the supplier from possible sources like + sales orders. diff --git a/product_pricelist_supplierinfo/readme/USAGE.rst b/product_pricelist_supplierinfo/readme/USAGE.rst new file mode 100644 index 000000000000..56738e097c4b --- /dev/null +++ b/product_pricelist_supplierinfo/readme/USAGE.rst @@ -0,0 +1,18 @@ +For adding supplier info: + +#. Go to *Sales > Catalog > Products* +#. Open or create a product. +#. Go to "Purchase" page. +#. On "Vendors" section, add the supplier and prices. +#. You can drag and drop for reordering these lines. + +Check the remark in known issues about the supplier info line selection. + +For checking pricelists in action, you can (with `sale` module installed): + +#. Go to *Sales > Orders > Quotations* +#. Create or edit a quotation. +#. Add a line. +#. Select a product with the criteria to match the pricelist from supplier + info. +#. See the proper price appears in the line. diff --git a/product_pricelist_supplierinfo/static/description/index.html b/product_pricelist_supplierinfo/static/description/index.html new file mode 100644 index 000000000000..5867e67ef0de --- /dev/null +++ b/product_pricelist_supplierinfo/static/description/index.html @@ -0,0 +1,482 @@ + + + + + + +Supplier info prices in sales pricelists + + + +
+

Supplier info prices in sales pricelists

+ + +

Beta License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runbot

+

This module allows you to create a sales pricelist based on product +supplierinfo prices. If you want, you can bypass minimum quantity in pricelist +item.

+

Table of contents

+ +
+

Installation

+

Although this module doesn’t depend technically on Sales Management, you +must install it for configuring and seeing the effects of it.

+
+
+

Configuration

+

To configure pricelists with the new feature of this module, you need to:

+
    +
  1. Go to Sales > Configuration > Settings and check +“Multiple Sales Prices per Product” option and +“Prices computed from formulas” after that. You must have correct +permissions and you must install Sales Management app (sale) to see +these settings.
  2. +
  3. Create or edit a Sales Pricelist at Sales > Catalog > Pricelists.
  4. +
  5. Add or edit a pricelist item and check “Formula” option in +“Price Computation” section.
  6. +
  7. You will see the new option “Prices based on supplier info”.
  8. +
  9. If you want to bypass the “Min.Quantity” field of the supplier info and +always select the lowest quantity price, check the option +“Ignore Supplier Info Min. Quantity”.
  10. +
+
+
+

Usage

+

For adding supplier info:

+
    +
  1. Go to Sales > Catalog > Products
  2. +
  3. Open or create a product.
  4. +
  5. Go to “Purchase” page.
  6. +
  7. On “Vendors” section, add the supplier and prices.
  8. +
  9. You can drag and drop for reordering these lines.
  10. +
+

Check the remark in known issues about the supplier info line selection.

+

For checking pricelists in action, you can (with sale module installed):

+
    +
  1. Go to Sales > Orders > Quotations
  2. +
  3. Create or edit a quotation.
  4. +
  5. Add a line.
  6. +
  7. Select a product with the criteria to match the pricelist from supplier +info.
  8. +
  9. See the proper price appears in the line.
  10. +
+
+
+

Known issues / Roadmap

+
    +
  • First line that matches by minimum quantity criteria, independently from the +supplier, will be the one that provides the price for the pricelist.
  • +
  • There’s no mechanism for selecting the supplier from possible sources like +sales orders.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/sale-workflow project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/product_pricelist_supplierinfo/tests/__init__.py b/product_pricelist_supplierinfo/tests/__init__.py new file mode 100644 index 000000000000..0ff6e5eba5e6 --- /dev/null +++ b/product_pricelist_supplierinfo/tests/__init__.py @@ -0,0 +1 @@ +from . import test_product_supplierinfo diff --git a/product_pricelist_supplierinfo/tests/test_product_supplierinfo.py b/product_pricelist_supplierinfo/tests/test_product_supplierinfo.py new file mode 100644 index 000000000000..d63a6d3359d1 --- /dev/null +++ b/product_pricelist_supplierinfo/tests/test_product_supplierinfo.py @@ -0,0 +1,104 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo.tests import common + + +class TestProductSupplierinfo(common.SavepointCase): + @classmethod + def setUpClass(cls): + super(TestProductSupplierinfo, cls).setUpClass() + cls.partner = cls.env['res.partner'].create({ + 'name': 'Partner Test', + }) + cls.supplier1 = cls.env['res.partner'].create({ + 'name': 'Supplier #1', + }) + cls.supplier2 = cls.env['res.partner'].create({ + 'name': 'Supplier #2', + }) + cls.product = cls.env['product.product'].create({ + 'name': 'Product Test', + 'seller_ids': [ + (0, 0, { + 'name': cls.supplier1.id, + 'min_qty': 5, + 'price': 50, + }), + (0, 0, { + 'name': cls.supplier2.id, + 'min_qty': 1, + 'price': 10, + }), + ], + }) + cls.pricelist = cls.env['product.pricelist'].create({ + 'name': 'Supplierinfo Pricelist', + 'discount_policy': 'without_discount', + 'item_ids': [ + (0, 0, { + 'compute_price': 'formula', + 'base': 'supplierinfo', + 'price_discount': 0, + 'min_quantity': 1.0, + }), + ], + }) + + def test_pricelist_based_on_product_category(self): + self.pricelist.item_ids[0].write({ + 'price_discount': 50, + 'applied_on': '2_product_category', + 'categ_id': self.env.ref('product.product_category_all').id, + }) + self.assertAlmostEqual( + self.pricelist.get_product_price(self.product, 1, False), 5.0, + ) + + def test_pricelist_based_on_product(self): + self.pricelist.item_ids[0].write({ + 'applied_on': '1_product', + 'product_tmpl_id': self.product.product_tmpl_id.id, + }) + self.assertAlmostEqual( + self.pricelist.get_product_price(self.product, 1, False), 10.0, + ) + + def test_pricelist_based_on_product_variant(self): + self.pricelist.item_ids[0].write({ + 'price_discount': -25, + 'applied_on': '0_product_variant', + 'product_id': self.product.id, + }) + self.assertAlmostEqual( + self.pricelist.get_product_price(self.product, 1, False), 12.5, + ) + + def test_pricelist_min_quantity(self): + self.assertAlmostEqual( + self.pricelist.get_product_price(self.product, 1, False), 10, + ) + self.assertAlmostEqual( + self.pricelist.get_product_price(self.product, 5, False), 50, + ) + self.pricelist.item_ids[0].no_supplierinfo_min_quantity = True + self.assertAlmostEqual( + self.pricelist.get_product_price(self.product, 5, False), 10, + ) + + def test_pricelist_dates(self): + """ Test pricelist and supplierinfo dates """ + self.product.seller_ids.filtered( + lambda x: x.min_qty == 5 + ).date_start = '2018-12-31' + self.assertAlmostEqual( + self.pricelist.get_product_price( + self.product, 5, False, date='2018-10-01', + ), 0, + ) + self.assertAlmostEqual( + self.pricelist.get_product_price( + self.product, 5, False, date='2019-01-01', + ), 50, + ) diff --git a/product_pricelist_supplierinfo/views/product_pricelist_item_views.xml b/product_pricelist_supplierinfo/views/product_pricelist_item_views.xml new file mode 100644 index 000000000000..2eef46fd679c --- /dev/null +++ b/product_pricelist_supplierinfo/views/product_pricelist_item_views.xml @@ -0,0 +1,18 @@ + + + + + product.pricelist.item.form + product.pricelist.item + + + + Supplier price - + + + + + + + +