diff --git a/product_supplierinfo_stock_picking_type/README.rst b/product_supplierinfo_stock_picking_type/README.rst new file mode 100644 index 00000000000..28c031b0789 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/README.rst @@ -0,0 +1,135 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +======================================= +Product supplierinfo stock picking type +======================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7d3f0fa9ca558a7f87c668f11bec9a1f9a9752857ae2c36cfd5a580672ba0662 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fproduct--attribute-lightgray.png?logo=github + :target: https://github.com/OCA/product-attribute/tree/19.0/product_supplierinfo_stock_picking_type + :alt: OCA/product-attribute +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-attribute-19-0/product-attribute-19-0-product_supplierinfo_stock_picking_type + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to set picking types in 'Vendors' of 'Purchase' tab. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +1. Go to *Inventory > Configuration > Settings*. +2. Check 'Storage Locations' checkbox in *Warehouse* section. + +Usage +===== + +1. Go to *Inventory > Configuration > Operations types* and create two + records named 'Incoming A' and 'Incoming B' with 'Type of Operation' + equal to 'Receipt'. +2. Go to *Inventory > Products > Products*, then create a product named + 'Test product' and set 'Purchase' tab as follows: +3. [Vendor line 1] Vendor: Azure Interior, Picking type: Incoming A, + Price: 5. +4. [Vendor line 2] Vendor: Azure Interior, Picking type: Incoming B, + Price: 10. +5. Then click on 'Save'. + +Next steps: + +Purchase order flow A: #. Go to *Purchase > Orders > Requests for +Quotation* and create a new order as follows: #. Vendor: Azure Interior; +Product: Test product; Deliver To: Incoming A (add the user to the +Manage Multiple Stock Locations permission group to see this field.) #. +The unit price of the product will be 5. + +Purchase order flow B: #. Go to *Purchase > Orders > Requests for +Quotation* and create a new order as follows: #. Vendor: Azure Interior; +Product: Test product; Deliver To: Incoming B (add the user to the +Manage Multiple Stock Locations permission group to see this field.) #. +The unit price of the product will be 10. + +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 to smash 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 `__: + + - Víctor Martínez + - Pedro M. Baeza + +- `Trobz `__: + + - Chau Le + +Other credits +------------- + +The migration of this module from 18.0 to 19.0 was financially supported +by PLEDRA NETCOM S.R.L + +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. + +.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px + :target: https://github.com/victoralmau + :alt: victoralmau + +Current `maintainer `__: + +|maintainer-victoralmau| + +This module is part of the `OCA/product-attribute `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_supplierinfo_stock_picking_type/__init__.py b/product_supplierinfo_stock_picking_type/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/product_supplierinfo_stock_picking_type/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_supplierinfo_stock_picking_type/__manifest__.py b/product_supplierinfo_stock_picking_type/__manifest__.py new file mode 100644 index 00000000000..007c4dc69a9 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Product supplierinfo stock picking type", + "version": "19.0.1.0.0", + "category": "Product", + "website": "https://github.com/OCA/product-attribute", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["purchase_stock"], + "installable": True, + "data": [ + "views/product_supplierinfo_view.xml", + ], + "maintainers": ["victoralmau"], +} diff --git a/product_supplierinfo_stock_picking_type/i18n/es.po b/product_supplierinfo_stock_picking_type/i18n/es.po new file mode 100644 index 00000000000..20951fb8a43 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/i18n/es.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_stock_picking_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-09-01 16:08+0000\n" +"PO-Revision-Date: 2024-03-26 22:36+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model.fields,field_description:product_supplierinfo_stock_picking_type.field_product_customerinfo__picking_type_id +#: model:ir.model.fields,field_description:product_supplierinfo_stock_picking_type.field_product_supplierinfo__picking_type_id +msgid "Picking Type" +msgstr "Tipo de albarán" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_product_product +msgid "Product Variant" +msgstr "Variante del Producto" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_purchase_order +msgid "Purchase Order" +msgstr "Orden de Compra" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_product_supplierinfo +msgid "Supplier Pricelist" +msgstr "Tarifa de proveedor" + +#~ msgid "Display Name" +#~ msgstr "Nombre mostrado" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Última modificación el" + +#~ msgid "Product" +#~ msgstr "Producto" diff --git a/product_supplierinfo_stock_picking_type/i18n/it.po b/product_supplierinfo_stock_picking_type/i18n/it.po new file mode 100644 index 00000000000..527c7deae64 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/i18n/it.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_stock_picking_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-08-22 10:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model.fields,field_description:product_supplierinfo_stock_picking_type.field_product_customerinfo__picking_type_id +#: model:ir.model.fields,field_description:product_supplierinfo_stock_picking_type.field_product_supplierinfo__picking_type_id +msgid "Picking Type" +msgstr "Tipo prelievo" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_product_product +msgid "Product Variant" +msgstr "Variante prodotto" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_purchase_order +msgid "Purchase Order" +msgstr "Ordine di acquisto" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_product_supplierinfo +msgid "Supplier Pricelist" +msgstr "Listino prezzi fornitore" + +#~ msgid "Display Name" +#~ msgstr "Nome visualizzato" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" + +#~ msgid "Product" +#~ msgstr "Prodotto" diff --git a/product_supplierinfo_stock_picking_type/i18n/product_supplierinfo_stock_picking_type.pot b/product_supplierinfo_stock_picking_type/i18n/product_supplierinfo_stock_picking_type.pot new file mode 100644 index 00000000000..253d2cd70b5 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/i18n/product_supplierinfo_stock_picking_type.pot @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_stock_picking_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \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_supplierinfo_stock_picking_type +#: model:ir.model.fields,field_description:product_supplierinfo_stock_picking_type.field_product_customerinfo__picking_type_id +#: model:ir.model.fields,field_description:product_supplierinfo_stock_picking_type.field_product_supplierinfo__picking_type_id +msgid "Picking Type" +msgstr "" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_product_product +msgid "Product Variant" +msgstr "" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: product_supplierinfo_stock_picking_type +#: model:ir.model,name:product_supplierinfo_stock_picking_type.model_product_supplierinfo +msgid "Supplier Pricelist" +msgstr "" diff --git a/product_supplierinfo_stock_picking_type/models/__init__.py b/product_supplierinfo_stock_picking_type/models/__init__.py new file mode 100644 index 00000000000..e8bea447ded --- /dev/null +++ b/product_supplierinfo_stock_picking_type/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import product_product +from . import product_supplierinfo +from . import purchase_order diff --git a/product_supplierinfo_stock_picking_type/models/product_product.py b/product_supplierinfo_stock_picking_type/models/product_product.py new file mode 100644 index 00000000000..5afe86a47f6 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/models/product_product.py @@ -0,0 +1,16 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + def _prepare_sellers(self, params=False): + res = super()._prepare_sellers(params) + if params and params.get("order_id"): + return res.filtered( + lambda x: not x.picking_type_id + or x.picking_type_id == params.get("order_id").picking_type_id + ) + return res diff --git a/product_supplierinfo_stock_picking_type/models/product_supplierinfo.py b/product_supplierinfo_stock_picking_type/models/product_supplierinfo.py new file mode 100644 index 00000000000..580c3546e85 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/models/product_supplierinfo.py @@ -0,0 +1,9 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class ProductSupplierinfo(models.Model): + _inherit = "product.supplierinfo" + + picking_type_id = fields.Many2one(comodel_name="stock.picking.type") diff --git a/product_supplierinfo_stock_picking_type/models/purchase_order.py b/product_supplierinfo_stock_picking_type/models/purchase_order.py new file mode 100644 index 00000000000..57ac5c31553 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/models/purchase_order.py @@ -0,0 +1,12 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import api, models + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + @api.onchange("picking_type_id") + def _onchange_picking_type_id(self): + for line in self.order_line: + line.onchange_product_id() diff --git a/product_supplierinfo_stock_picking_type/pyproject.toml b/product_supplierinfo_stock_picking_type/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/product_supplierinfo_stock_picking_type/readme/CONFIGURE.md b/product_supplierinfo_stock_picking_type/readme/CONFIGURE.md new file mode 100644 index 00000000000..2760e842d35 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/readme/CONFIGURE.md @@ -0,0 +1,2 @@ +1. Go to *Inventory \> Configuration \> Settings*. +2. Check 'Storage Locations' checkbox in *Warehouse* section. diff --git a/product_supplierinfo_stock_picking_type/readme/CONTRIBUTORS.md b/product_supplierinfo_stock_picking_type/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..13a582cf964 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- [Tecnativa](https://www.tecnativa.com): + - Víctor Martínez + - Pedro M. Baeza +- [Trobz](https://trobz.com): + - Chau Le \<\> diff --git a/product_supplierinfo_stock_picking_type/readme/CREDITS.md b/product_supplierinfo_stock_picking_type/readme/CREDITS.md new file mode 100644 index 00000000000..d1fe200da03 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/readme/CREDITS.md @@ -0,0 +1 @@ +The migration of this module from 18.0 to 19.0 was financially supported by PLEDRA NETCOM S.R.L diff --git a/product_supplierinfo_stock_picking_type/readme/DESCRIPTION.md b/product_supplierinfo_stock_picking_type/readme/DESCRIPTION.md new file mode 100644 index 00000000000..8412f02f43f --- /dev/null +++ b/product_supplierinfo_stock_picking_type/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to set picking types in 'Vendors' of 'Purchase' tab. diff --git a/product_supplierinfo_stock_picking_type/readme/USAGE.md b/product_supplierinfo_stock_picking_type/readme/USAGE.md new file mode 100644 index 00000000000..f00962bb54c --- /dev/null +++ b/product_supplierinfo_stock_picking_type/readme/USAGE.md @@ -0,0 +1,20 @@ +1. Go to *Inventory \> Configuration \> Operations types* and create + two records named 'Incoming A' and 'Incoming B' with 'Type of + Operation' equal to 'Receipt'. +2. Go to *Inventory \> Products \> Products*, then create a product + named 'Test product' and set 'Purchase' tab as follows: +3. \[Vendor line 1\] Vendor: Azure Interior, Picking type: Incoming A, + Price: 5. +4. \[Vendor line 2\] Vendor: Azure Interior, Picking type: Incoming B, + Price: 10. +5. Then click on 'Save'. + +Next steps: + +Purchase order flow A: \#. Go to *Purchase \> Orders \> Requests for +Quotation* and create a new order as follows: \#. Vendor: Azure +Interior; Product: Test product; Deliver To: Incoming A (add the user to the Manage Multiple Stock Locations permission group to see this field.) \#. The unit price of the product will be 5. + +Purchase order flow B: \#. Go to *Purchase \> Orders \> Requests for +Quotation* and create a new order as follows: \#. Vendor: Azure +Interior; Product: Test product; Deliver To: Incoming B (add the user to the Manage Multiple Stock Locations permission group to see this field.) \#. The unit price of the product will be 10. diff --git a/product_supplierinfo_stock_picking_type/static/description/icon.png b/product_supplierinfo_stock_picking_type/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/product_supplierinfo_stock_picking_type/static/description/icon.png differ diff --git a/product_supplierinfo_stock_picking_type/static/description/index.html b/product_supplierinfo_stock_picking_type/static/description/index.html new file mode 100644 index 00000000000..353bbfa67e4 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/static/description/index.html @@ -0,0 +1,480 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Product supplierinfo stock picking type

+ +

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

+

This module allows to set picking types in ‘Vendors’ of ‘Purchase’ tab.

+

Table of contents

+ +
+

Configuration

+
    +
  1. Go to Inventory > Configuration > Settings.
  2. +
  3. Check ‘Storage Locations’ checkbox in Warehouse section.
  4. +
+
+
+

Usage

+
    +
  1. Go to Inventory > Configuration > Operations types and create two +records named ‘Incoming A’ and ‘Incoming B’ with ‘Type of Operation’ +equal to ‘Receipt’.
  2. +
  3. Go to Inventory > Products > Products, then create a product named +‘Test product’ and set ‘Purchase’ tab as follows:
  4. +
  5. [Vendor line 1] Vendor: Azure Interior, Picking type: Incoming A, +Price: 5.
  6. +
  7. [Vendor line 2] Vendor: Azure Interior, Picking type: Incoming B, +Price: 10.
  8. +
  9. Then click on ‘Save’.
  10. +
+

Next steps:

+

Purchase order flow A: #. Go to Purchase > Orders > Requests for +Quotation and create a new order as follows: #. Vendor: Azure Interior; +Product: Test product; Deliver To: Incoming A (add the user to the +Manage Multiple Stock Locations permission group to see this field.) #. +The unit price of the product will be 5.

+

Purchase order flow B: #. Go to Purchase > Orders > Requests for +Quotation and create a new order as follows: #. Vendor: Azure Interior; +Product: Test product; Deliver To: Incoming B (add the user to the +Manage Multiple Stock Locations permission group to see this field.) #. +The unit price of the product will be 10.

+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 18.0 to 19.0 was financially supported +by PLEDRA NETCOM S.R.L

+
+
+

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.

+

Current maintainer:

+

victoralmau

+

This module is part of the OCA/product-attribute project on GitHub.

+

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

+
+
+
+
+ + diff --git a/product_supplierinfo_stock_picking_type/tests/__init__.py b/product_supplierinfo_stock_picking_type/tests/__init__.py new file mode 100644 index 00000000000..c863441a2fd --- /dev/null +++ b/product_supplierinfo_stock_picking_type/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_product_supplierinfo_stock_picking_type diff --git a/product_supplierinfo_stock_picking_type/tests/test_product_supplierinfo_stock_picking_type.py b/product_supplierinfo_stock_picking_type/tests/test_product_supplierinfo_stock_picking_type.py new file mode 100644 index 00000000000..5a528374647 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/tests/test_product_supplierinfo_stock_picking_type.py @@ -0,0 +1,106 @@ +# Copyright 2022-2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import Form, new_test_user +from odoo.tests.common import users + +from odoo.addons.base.tests.common import BaseCommon + + +class TestProductSupplierinfoStockPickingType(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.warehouse = cls.env.ref("stock.warehouse0") + cls.supplier = cls.env["res.partner"].create({"name": "Supplier"}) + cls.picking_in_a = cls.env["stock.picking.type"].create( + { + "name": "Incoming A", + "code": "incoming", + "sequence_code": "IN-A", + "warehouse_id": cls.warehouse.id, + } + ) + cls.picking_in_b = cls.env["stock.picking.type"].create( + { + "name": "Incoming B", + "code": "incoming", + "sequence_code": "IN-B", + "warehouse_id": cls.warehouse.id, + } + ) + cls.picking_in_c = cls.env["stock.picking.type"].create( + { + "name": "Incoming C", + "code": "incoming", + "sequence_code": "IN-C", + "warehouse_id": cls.warehouse.id, + } + ) + cls.product = cls.env["product.product"].create( + { + "name": "Test product", + "is_storable": True, + "seller_ids": [ + ( + 0, + 0, + { + "partner_id": cls.supplier.id, + "min_qty": 1, + "price": 5, + "picking_type_id": cls.picking_in_a.id, + }, + ), + ( + 0, + 0, + { + "partner_id": cls.supplier.id, + "min_qty": 1, + "price": 10, + "picking_type_id": cls.picking_in_b.id, + }, + ), + ( + 0, + 0, + { + "partner_id": cls.supplier.id, + "min_qty": 1, + "price": 20, + }, + ), + ], + } + ) + new_test_user( + cls.env, + login="test_purchase_user", + groups="purchase.group_purchase_user,stock.group_stock_multi_locations", + ) + + def _create_purchase_order(self, picking_type_id): + order_form = Form(self.env["purchase.order"]) + order_form.partner_id = self.supplier + order_form.picking_type_id = picking_type_id + with order_form.order_line.new() as line_form: + line_form.product_id = self.product + return order_form.save() + + @users("test_purchase_user") + def test_product_picking_type_a(self): + po = self._create_purchase_order(self.picking_in_a) + self.assertEqual(po.order_line.price_unit, 5) + + @users("test_purchase_user") + def test_product_picking_type_b(self): + po = self._create_purchase_order(self.picking_in_b) + self.assertEqual(po.order_line.price_unit, 10) + + @users("test_purchase_user") + def test_product_picking_type_c(self): + po = self._create_purchase_order(self.picking_in_c) + self.assertEqual(po.order_line.price_unit, 20) + po.picking_type_id = self.picking_in_a + po._onchange_picking_type_id() + self.assertEqual(po.order_line.price_unit, 5) diff --git a/product_supplierinfo_stock_picking_type/views/product_supplierinfo_view.xml b/product_supplierinfo_stock_picking_type/views/product_supplierinfo_view.xml new file mode 100644 index 00000000000..8f4b62220e1 --- /dev/null +++ b/product_supplierinfo_stock_picking_type/views/product_supplierinfo_view.xml @@ -0,0 +1,22 @@ + + + product.supplierinfo.list.view + product.supplierinfo + + + + + + + + + product.supplierinfo.form.view + product.supplierinfo + + + + + + + +