From 0c81eeee62ffbed0f75edecc5d572fb6a1614f54 Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Fri, 17 Sep 2021 09:36:51 -0400 Subject: [PATCH 01/17] [ADD] purchase_order_supplierinfo_update: new module --- purchase_order_supplierinfo_update/README.rst | 107 +++++ .../__init__.py | 1 + .../__manifest__.py | 13 + .../purchase_order_supplierinfo_update.pot | 24 + .../models/__init__.py | 2 + .../models/purchase_order.py | 70 +++ .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 4 + .../readme/ROADMAP.rst | 1 + .../readme/USAGE.rst | 11 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 451 ++++++++++++++++++ .../tests/__init__.py | 2 + ...test_purchase_order_supplierinfo_update.py | 111 +++++ 14 files changed, 801 insertions(+) create mode 100644 purchase_order_supplierinfo_update/README.rst create mode 100644 purchase_order_supplierinfo_update/__init__.py create mode 100644 purchase_order_supplierinfo_update/__manifest__.py create mode 100644 purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot create mode 100644 purchase_order_supplierinfo_update/models/__init__.py create mode 100644 purchase_order_supplierinfo_update/models/purchase_order.py create mode 100644 purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst create mode 100644 purchase_order_supplierinfo_update/readme/DESCRIPTION.rst create mode 100644 purchase_order_supplierinfo_update/readme/ROADMAP.rst create mode 100644 purchase_order_supplierinfo_update/readme/USAGE.rst create mode 100644 purchase_order_supplierinfo_update/static/description/icon.png create mode 100644 purchase_order_supplierinfo_update/static/description/index.html create mode 100644 purchase_order_supplierinfo_update/tests/__init__.py create mode 100644 purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py diff --git a/purchase_order_supplierinfo_update/README.rst b/purchase_order_supplierinfo_update/README.rst new file mode 100644 index 00000000000..d14acbb84cb --- /dev/null +++ b/purchase_order_supplierinfo_update/README.rst @@ -0,0 +1,107 @@ +================================== +Purchase Order Supplierinfo Update +================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_order_supplierinfo_update + :alt: OCA/purchase-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_order_supplierinfo_update + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/142/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of purchase to allow the price +of the supplier-info to be updated automatically for each product of the +a purchase when it is confirmed. This will allow that when a purchase order +is created, the suggested price for those products is the last one purchased. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Go to *Purchase > Orders > Requests for Quotation* and create a new + Requests for Quotation with several products. +#. Confirm that quotation and the unit prices defined on the lines will + be stored in the supplier-info (related to the quotation supplier) + of the products. +#. By default the suggested price for the products is the one stored in + supplier-info, so in this way, if you create another quotation with + the same supplier and the same products, the suggested price for each + product will be the same price at which the product was last purchased. + +Known issues / Roadmap +====================== + +* Refactor that module to share algorithm with similar module `account_invoice_supplierinfo_update`. + +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 `_: + + * Ernesto Tejeda + * Carlos Dauden + +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-ernestotejeda| image:: https://github.com/ernestotejeda.png?size=40px + :target: https://github.com/ernestotejeda + :alt: ernestotejeda + +Current `maintainer `__: + +|maintainer-ernestotejeda| + +This module is part of the `OCA/purchase-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_order_supplierinfo_update/__init__.py b/purchase_order_supplierinfo_update/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/purchase_order_supplierinfo_update/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/purchase_order_supplierinfo_update/__manifest__.py b/purchase_order_supplierinfo_update/__manifest__.py new file mode 100644 index 00000000000..e5c0ea732f5 --- /dev/null +++ b/purchase_order_supplierinfo_update/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2021 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Purchase Order Supplierinfo Update", + "summary": "Update product supplierinfo with the last purchase price", + "version": "13.0.1.0.0", + "category": "Purchase", + "website": "https://github.com/OCA/purchase-workflow", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["ernestotejeda"], + "license": "AGPL-3", + "depends": ["purchase"], +} diff --git a/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot b/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot new file mode 100644 index 00000000000..cf179d4b407 --- /dev/null +++ b/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_order_supplierinfo_update +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.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: purchase_order_supplierinfo_update +#: model:ir.model,name:purchase_order_supplierinfo_update.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_order_supplierinfo_update +#: model:ir.model,name:purchase_order_supplierinfo_update.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" diff --git a/purchase_order_supplierinfo_update/models/__init__.py b/purchase_order_supplierinfo_update/models/__init__.py new file mode 100644 index 00000000000..9a32d2efa63 --- /dev/null +++ b/purchase_order_supplierinfo_update/models/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import purchase_order diff --git a/purchase_order_supplierinfo_update/models/purchase_order.py b/purchase_order_supplierinfo_update/models/purchase_order.py new file mode 100644 index 00000000000..7602776edb7 --- /dev/null +++ b/purchase_order_supplierinfo_update/models/purchase_order.py @@ -0,0 +1,70 @@ +# Copyright 2021 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + def write(self, vals): + no_updated = self.filtered(lambda r: r.state not in ["purchase", "done"]) + res = super().write(vals) + if vals.get("state", "") in ["purchase", "done"]: + no_updated.mapped("order_line").update_supplierinfo_price() + return res + + +class PurchaseOrderLine(models.Model): + _inherit = "purchase.order.line" + + @api.model_create_multi + def create(self, vals_list): + res = super().create(vals_list) + res.update_supplierinfo_price() + return res + + def write(self, vals): + res = super().write(vals) + if vals.get("price_unit"): + self.update_supplierinfo_price() + return res + + def update_supplierinfo_price(self): + for line in self.filtered(lambda r: r.order_id.state in ["purchase", "done"]): + domain = [ + ("partner_id", "=", line.partner_id.id), + ("product_id", "=", line.product_id.id), + ("date_order", ">", line.date_order), + ] + if not self.env["purchase.order.line"].search(domain, limit=1): + params = {"order_id": line.order_id} + seller = line.product_id._select_seller( + partner_id=line.partner_id, + quantity=line.product_qty, + date=line.order_id.date_order and line.order_id.date_order.date(), + uom_id=line.product_uom, + params=params, + ) + if seller: + line._update_supplierinfo(seller) + + def _update_supplierinfo(self, seller): + self.ensure_one() + new_seller_price = self.price_unit + # convert according to the currency if necessary + if self.currency_id and self.currency_id != seller.currency_id: + new_seller_price = self.currency_id._convert( + new_seller_price, + seller.currency_id, + seller.company_id, + self.date_order or fields.Date.today(), + ) + # convert according to the UoM if necessary + if self.product_uom and self.product_uom != seller.product_uom: + new_seller_price = self.product_uom._compute_price( + new_seller_price, seller.product_uom + ) + # Set price + if new_seller_price != seller.price: + seller.sudo().price = new_seller_price diff --git a/purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst b/purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..aeee56ea468 --- /dev/null +++ b/purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Ernesto Tejeda + * Carlos Dauden diff --git a/purchase_order_supplierinfo_update/readme/DESCRIPTION.rst b/purchase_order_supplierinfo_update/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..e7858c93314 --- /dev/null +++ b/purchase_order_supplierinfo_update/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module extends the functionality of purchase to allow the price +of the supplier-info to be updated automatically for each product of the +a purchase when it is confirmed. This will allow that when a purchase order +is created, the suggested price for those products is the last one purchased. diff --git a/purchase_order_supplierinfo_update/readme/ROADMAP.rst b/purchase_order_supplierinfo_update/readme/ROADMAP.rst new file mode 100644 index 00000000000..b061f134561 --- /dev/null +++ b/purchase_order_supplierinfo_update/readme/ROADMAP.rst @@ -0,0 +1 @@ +* Refactor that module to share algorithm with similar module `account_invoice_supplierinfo_update`. diff --git a/purchase_order_supplierinfo_update/readme/USAGE.rst b/purchase_order_supplierinfo_update/readme/USAGE.rst new file mode 100644 index 00000000000..68f444b1f93 --- /dev/null +++ b/purchase_order_supplierinfo_update/readme/USAGE.rst @@ -0,0 +1,11 @@ +To use this module, you need to: + +#. Go to *Purchase > Orders > Requests for Quotation* and create a new + Requests for Quotation with several products. +#. Confirm that quotation and the unit prices defined on the lines will + be stored in the supplier-info (related to the quotation supplier) + of the products. +#. By default the suggested price for the products is the one stored in + supplier-info, so in this way, if you create another quotation with + the same supplier and the same products, the suggested price for each + product will be the same price at which the product was last purchased. diff --git a/purchase_order_supplierinfo_update/static/description/icon.png b/purchase_order_supplierinfo_update/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz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YT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/purchase_order_supplierinfo_update/static/description/index.html b/purchase_order_supplierinfo_update/static/description/index.html new file mode 100644 index 00000000000..5c28c2343b8 --- /dev/null +++ b/purchase_order_supplierinfo_update/static/description/index.html @@ -0,0 +1,451 @@ + + + + + + +Purchase Order Supplierinfo Update + + + +
+

Purchase Order Supplierinfo Update

+ + +

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

+

This module extends the functionality of purchase to allow the price +of the supplier-info to be updated automatically for each product of the +a purchase when it is confirmed. This will allow that when a purchase order +is created, the suggested price for those products is the last one purchased.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Purchase > Orders > Requests for Quotation and create a new +Requests for Quotation with several products.
  2. +
  3. Confirm that quotation and the unit prices defined on the lines will +be stored in the supplier-info (related to the quotation supplier) +of the products.
  4. +
  5. By default the suggested price for the products is the one stored in +supplier-info, so in this way, if you create another quotation with +the same supplier and the same products, the suggested price for each +product will be the same price at which the product was last purchased.
  6. +
+
+
+

Known issues / Roadmap

+
    +
  • Refactor that module to share algorithm with similar module account_invoice_supplierinfo_update.
  • +
+
+
+

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:
      +
    • Ernesto Tejeda
    • +
    • Carlos Dauden
    • +
    +
  • +
+
+
+

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:

+

ernestotejeda

+

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

+

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

+
+
+
+ + diff --git a/purchase_order_supplierinfo_update/tests/__init__.py b/purchase_order_supplierinfo_update/tests/__init__.py new file mode 100644 index 00000000000..a21274de57c --- /dev/null +++ b/purchase_order_supplierinfo_update/tests/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import test_purchase_order_supplierinfo_update diff --git a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py new file mode 100644 index 00000000000..a6fe0cc1e4e --- /dev/null +++ b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py @@ -0,0 +1,111 @@ +# Copyright 2021 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests import Form, SavepointCase + + +class TestPurchaseOrderSupplierinfoUpdate(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product = cls.env["product.product"].create( + {"name": "Product Test", "type": "product"} + ) + cls.supplier = cls.env["res.partner"].create({"name": "Supplier Test"}) + cls.supplierinfo = cls.env["product.supplierinfo"].create( + { + "name": cls.supplier.id, + "product_tmpl_id": cls.product.product_tmpl_id.id, + "price": 100, + } + ) + + def test_confirn_purchase_order(self): + # Create a PO, confirm it and check the supplierinfo is updated + po_form = Form(self.env["purchase.order"]) + po_form.partner_id = self.supplier + with po_form.order_line.new() as po_line_form: + po_line_form.product_id = self.product + self.assertEqual(po_line_form.price_unit, 100) + po_line_form.price_unit = 150 + po_line_form.taxes_id.clear() + purchase_order = po_form.save() + purchase_order.button_confirm() + self.assertEqual(self.supplierinfo.price, 150) + # Create another PO, confirm it and check the supplierinfo is updated + po_form = Form(self.env["purchase.order"]) + po_form.partner_id = self.supplier + with po_form.order_line.new() as po_line_form: + po_line_form.product_id = self.product + self.assertEqual(po_line_form.price_unit, 150) + po_line_form.price_unit = 200 + po_line_form.taxes_id.clear() + purchase_order = po_form.save() + purchase_order.button_confirm() + self.assertEqual(self.supplierinfo.price, 200) + + def test_change_price_in_confirmed_po(self): + # Create first purchase + po_form_1 = Form(self.env["purchase.order"]) + po_form_1.partner_id = self.supplier + with po_form_1.order_line.new() as po_line_form: + po_line_form.product_id = self.product + po_line_form.taxes_id.clear() + purchase_order_1 = po_form_1.save() + purchase_order_1.button_confirm() + # Create second purchase + po_form_2 = Form(self.env["purchase.order"]) + po_form_2.partner_id = self.supplier + with po_form_2.order_line.new() as po_line_form: + po_line_form.product_id = self.product + po_line_form.price_unit = 200 + po_line_form.taxes_id.clear() + purchase_order_2 = po_form_2.save() + purchase_order_2.button_confirm() + # Change price in second purchase + with Form(purchase_order_2) as po_form_2: + with po_form_2.order_line.edit(0) as po_line_form: + po_line_form.price_unit = 300 + self.assertEqual(self.supplierinfo.price, 300) + # Change price in first purchase. This doesn't update supplierinfo + # because it isn't the last purchase of this product by this supplier + with Form(purchase_order_1) as po_form_1: + with po_form_1.order_line.edit(0) as po_line_form: + po_line_form.price_unit = 400 + self.assertEqual(self.supplierinfo.price, 300) + + def test_create_new_line_in_a_confirmed_po(self): + # Create first purchase + po_form_1 = Form(self.env["purchase.order"]) + po_form_1.partner_id = self.supplier + with po_form_1.order_line.new() as po_line_form: + po_line_form.product_id = self.product + po_line_form.taxes_id.clear() + purchase_order_1 = po_form_1.save() + purchase_order_1.button_confirm() + # Create second purchase + po_form_2 = Form(self.env["purchase.order"]) + po_form_2.partner_id = self.supplier + with po_form_2.order_line.new() as po_line_form: + po_line_form.product_id = self.product + po_line_form.price_unit = 200 + po_line_form.taxes_id.clear() + purchase_order_2 = po_form_2.save() + purchase_order_2.button_confirm() + # Create a new line in the first purchase (that is already confirmed) + # with another product. + product_2 = self.env["product.product"].create( + {"name": "Product Test 2", "type": "product"} + ) + supplierinfo_2 = self.env["product.supplierinfo"].create( + { + "name": self.supplier.id, + "product_tmpl_id": product_2.product_tmpl_id.id, + "price": 10, + } + ) + with Form(purchase_order_1) as po_form: + with po_form.order_line.new() as po_line_form: + po_line_form.product_id = product_2 + po_line_form.price_unit = 20 + self.assertEqual(supplierinfo_2.price, 20) From 0ca625c0f62b220c89c6e8f98a396b6450272b34 Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Thu, 21 Oct 2021 01:52:08 +0200 Subject: [PATCH 02/17] [IMP] purchase_order_supplierinfo_update: Fix random test failure --- purchase_order_supplierinfo_update/__manifest__.py | 2 +- .../tests/test_purchase_order_supplierinfo_update.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/purchase_order_supplierinfo_update/__manifest__.py b/purchase_order_supplierinfo_update/__manifest__.py index e5c0ea732f5..5809238dc58 100644 --- a/purchase_order_supplierinfo_update/__manifest__.py +++ b/purchase_order_supplierinfo_update/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Purchase Order Supplierinfo Update", "summary": "Update product supplierinfo with the last purchase price", - "version": "13.0.1.0.0", + "version": "13.0.1.0.1", "category": "Purchase", "website": "https://github.com/OCA/purchase-workflow", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py index a6fe0cc1e4e..7f3f44bbf5c 100644 --- a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py +++ b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py @@ -1,6 +1,9 @@ # Copyright 2021 Tecnativa - Ernesto Tejeda # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from dateutil.relativedelta import relativedelta + +from odoo import fields from odoo.tests import Form, SavepointCase @@ -48,6 +51,8 @@ def test_change_price_in_confirmed_po(self): # Create first purchase po_form_1 = Form(self.env["purchase.order"]) po_form_1.partner_id = self.supplier + now = fields.Datetime.now() + po_form_1.date_order = now - relativedelta(days=1) with po_form_1.order_line.new() as po_line_form: po_line_form.product_id = self.product po_line_form.taxes_id.clear() From aa69091971bb901a7ac46fcda2e13e25706f343d Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Wed, 17 Nov 2021 11:53:46 +0000 Subject: [PATCH 03/17] [MIG] purchase_order_supplierinfo_update: Migration to 14.0 --- .../__manifest__.py | 2 +- .../readme/CONTRIBUTORS.rst | 2 ++ ...test_purchase_order_supplierinfo_update.py | 26 +++++++++---------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/purchase_order_supplierinfo_update/__manifest__.py b/purchase_order_supplierinfo_update/__manifest__.py index 5809238dc58..28e35b2b16d 100644 --- a/purchase_order_supplierinfo_update/__manifest__.py +++ b/purchase_order_supplierinfo_update/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Purchase Order Supplierinfo Update", "summary": "Update product supplierinfo with the last purchase price", - "version": "13.0.1.0.1", + "version": "14.0.1.0.1", "category": "Purchase", "website": "https://github.com/OCA/purchase-workflow", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst b/purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst index aeee56ea468..ef26eb8b062 100644 --- a/purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst +++ b/purchase_order_supplierinfo_update/readme/CONTRIBUTORS.rst @@ -2,3 +2,5 @@ * Ernesto Tejeda * Carlos Dauden + +* Daniel Reis , `Open Source Integrators `_: diff --git a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py index 7f3f44bbf5c..687ef4ed19f 100644 --- a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py +++ b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py @@ -12,7 +12,7 @@ class TestPurchaseOrderSupplierinfoUpdate(SavepointCase): def setUpClass(cls): super().setUpClass() cls.product = cls.env["product.product"].create( - {"name": "Product Test", "type": "product"} + {"name": "Product Test", "type": "consu"} # do not depend on stock module ) cls.supplier = cls.env["res.partner"].create({"name": "Supplier Test"}) cls.supplierinfo = cls.env["product.supplierinfo"].create( @@ -22,6 +22,16 @@ def setUpClass(cls): "price": 100, } ) + cls.product_2 = cls.env["product.product"].create( + {"name": "Product Test 2", "type": "consu"} + ) + cls.supplierinfo_2 = cls.env["product.supplierinfo"].create( + { + "name": cls.supplier.id, + "product_tmpl_id": cls.product_2.product_tmpl_id.id, + "price": 10, + } + ) def test_confirn_purchase_order(self): # Create a PO, confirm it and check the supplierinfo is updated @@ -99,18 +109,8 @@ def test_create_new_line_in_a_confirmed_po(self): purchase_order_2.button_confirm() # Create a new line in the first purchase (that is already confirmed) # with another product. - product_2 = self.env["product.product"].create( - {"name": "Product Test 2", "type": "product"} - ) - supplierinfo_2 = self.env["product.supplierinfo"].create( - { - "name": self.supplier.id, - "product_tmpl_id": product_2.product_tmpl_id.id, - "price": 10, - } - ) with Form(purchase_order_1) as po_form: with po_form.order_line.new() as po_line_form: - po_line_form.product_id = product_2 + po_line_form.product_id = self.product_2 po_line_form.price_unit = 20 - self.assertEqual(supplierinfo_2.price, 20) + self.assertEqual(self.supplierinfo_2.price, 20) From bb0cde031606e71f6160c408cdeb22ff40f920d3 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Wed, 22 Dec 2021 15:34:58 +0100 Subject: [PATCH 04/17] [FIX] purchase_order_supplierinfo_update: Don't take into account sections --- purchase_order_supplierinfo_update/models/purchase_order.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/purchase_order_supplierinfo_update/models/purchase_order.py b/purchase_order_supplierinfo_update/models/purchase_order.py index 7602776edb7..cde2f72a3a5 100644 --- a/purchase_order_supplierinfo_update/models/purchase_order.py +++ b/purchase_order_supplierinfo_update/models/purchase_order.py @@ -31,7 +31,9 @@ def write(self, vals): return res def update_supplierinfo_price(self): - for line in self.filtered(lambda r: r.order_id.state in ["purchase", "done"]): + for line in self.filtered( + lambda r: not r.display_type and r.order_id.state in ["purchase", "done"] + ): domain = [ ("partner_id", "=", line.partner_id.id), ("product_id", "=", line.product_id.id), From a8a2cbf2d973bd846b6df4a70e4965c8637f29ae Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Thu, 28 Jul 2022 19:08:02 -0400 Subject: [PATCH 05/17] [MIG] purchase_order_supplierinfo_update: Migration to 15.0 --- purchase_order_supplierinfo_update/README.rst | 12 +++++---- .../__manifest__.py | 2 +- .../purchase_order_supplierinfo_update.pot | 2 +- .../static/description/index.html | 7 +++--- ...test_purchase_order_supplierinfo_update.py | 25 ++++++++++++++----- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/purchase_order_supplierinfo_update/README.rst b/purchase_order_supplierinfo_update/README.rst index d14acbb84cb..db9b97b3e89 100644 --- a/purchase_order_supplierinfo_update/README.rst +++ b/purchase_order_supplierinfo_update/README.rst @@ -14,13 +14,13 @@ Purchase Order Supplierinfo Update :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_order_supplierinfo_update + :target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_order_supplierinfo_update :alt: OCA/purchase-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_order_supplierinfo_update + :target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_order_supplierinfo_update :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/142/13.0 + :target: https://runbot.odoo-community.org/runbot/142/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -61,7 +61,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -81,6 +81,8 @@ Contributors * Ernesto Tejeda * Carlos Dauden +* Daniel Reis , `Open Source Integrators `_: + Maintainers ~~~~~~~~~~~ @@ -102,6 +104,6 @@ Current `maintainer `__: |maintainer-ernestotejeda| -This module is part of the `OCA/purchase-workflow `_ project on GitHub. +This module is part of the `OCA/purchase-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_order_supplierinfo_update/__manifest__.py b/purchase_order_supplierinfo_update/__manifest__.py index 28e35b2b16d..c70b1993bc5 100644 --- a/purchase_order_supplierinfo_update/__manifest__.py +++ b/purchase_order_supplierinfo_update/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Purchase Order Supplierinfo Update", "summary": "Update product supplierinfo with the last purchase price", - "version": "14.0.1.0.1", + "version": "15.0.1.0.0", "category": "Purchase", "website": "https://github.com/OCA/purchase-workflow", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot b/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot index cf179d4b407..ba1c67d7bb0 100644 --- a/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot +++ b/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/purchase_order_supplierinfo_update/static/description/index.html b/purchase_order_supplierinfo_update/static/description/index.html index 5c28c2343b8..f0b08043d38 100644 --- a/purchase_order_supplierinfo_update/static/description/index.html +++ b/purchase_order_supplierinfo_update/static/description/index.html @@ -367,7 +367,7 @@

Purchase Order Supplierinfo Update

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module extends the functionality of purchase to allow the price of the supplier-info to be updated automatically for each product of the a purchase when it is confirmed. This will allow that when a purchase order @@ -412,7 +412,7 @@

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.

+feedback.

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

@@ -431,6 +431,7 @@

Contributors

  • Carlos Dauden
  • +
  • Daniel Reis <dreis@opensourceintegrators.com>, Open Source Integrators:
  • @@ -442,7 +443,7 @@

    Maintainers

    promote its widespread use.

    Current maintainer:

    ernestotejeda

    -

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

    +

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

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

    diff --git a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py index 687ef4ed19f..a092807dc2f 100644 --- a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py +++ b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py @@ -4,10 +4,10 @@ from dateutil.relativedelta import relativedelta from odoo import fields -from odoo.tests import Form, SavepointCase +from odoo.tests import Form, TransactionCase -class TestPurchaseOrderSupplierinfoUpdate(SavepointCase): +class TestPurchaseOrderSupplierinfoUpdate(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -109,8 +109,21 @@ def test_create_new_line_in_a_confirmed_po(self): purchase_order_2.button_confirm() # Create a new line in the first purchase (that is already confirmed) # with another product. - with Form(purchase_order_1) as po_form: - with po_form.order_line.new() as po_line_form: - po_line_form.product_id = self.product_2 - po_line_form.price_unit = 20 + # We can not use a Form due to a modifier restriction on purchase order view + # purchase/views/purchase_views.xml#L230 + purchase_order_1.write( + { + "order_line": [ + ( + 0, + 0, + { + "product_id": self.product_2.id, + "product_uom": self.product_2.uom_po_id.id, + "price_unit": 20.00, + }, + ) + ] + } + ) self.assertEqual(self.supplierinfo_2.price, 20) From 6b81df6a2124e671a51c4f99480fa92de4884d2f Mon Sep 17 00:00:00 2001 From: "Yadier A. De Quesada" Date: Fri, 12 May 2023 23:45:45 -0400 Subject: [PATCH 06/17] [MIG] purchase_order_supplierinfo_update: Migration to 16.0 --- purchase_order_supplierinfo_update/__manifest__.py | 2 +- .../tests/test_purchase_order_supplierinfo_update.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/purchase_order_supplierinfo_update/__manifest__.py b/purchase_order_supplierinfo_update/__manifest__.py index c70b1993bc5..b629b04a9c2 100644 --- a/purchase_order_supplierinfo_update/__manifest__.py +++ b/purchase_order_supplierinfo_update/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Purchase Order Supplierinfo Update", "summary": "Update product supplierinfo with the last purchase price", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "category": "Purchase", "website": "https://github.com/OCA/purchase-workflow", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py index a092807dc2f..d65b106c9e6 100644 --- a/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py +++ b/purchase_order_supplierinfo_update/tests/test_purchase_order_supplierinfo_update.py @@ -17,7 +17,7 @@ def setUpClass(cls): cls.supplier = cls.env["res.partner"].create({"name": "Supplier Test"}) cls.supplierinfo = cls.env["product.supplierinfo"].create( { - "name": cls.supplier.id, + "partner_id": cls.supplier.id, "product_tmpl_id": cls.product.product_tmpl_id.id, "price": 100, } @@ -27,7 +27,7 @@ def setUpClass(cls): ) cls.supplierinfo_2 = cls.env["product.supplierinfo"].create( { - "name": cls.supplier.id, + "partner_id": cls.supplier.id, "product_tmpl_id": cls.product_2.product_tmpl_id.id, "price": 10, } From 828fcbe9f6af4a9aa4cfedb491480d3279ffce4c Mon Sep 17 00:00:00 2001 From: oca-ci Date: Mon, 15 May 2023 08:09:37 +0000 Subject: [PATCH 07/17] [UPD] Update purchase_order_supplierinfo_update.pot --- .../i18n/purchase_order_supplierinfo_update.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot b/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot index ba1c67d7bb0..7ce74a75af7 100644 --- a/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot +++ b/purchase_order_supplierinfo_update/i18n/purchase_order_supplierinfo_update.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" From d9f519e609670bb4ff365b4786069fc87e147e7a Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 15 May 2023 08:14:07 +0000 Subject: [PATCH 08/17] [UPD] README.rst --- purchase_order_supplierinfo_update/README.rst | 10 +++++----- .../static/description/index.html | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/purchase_order_supplierinfo_update/README.rst b/purchase_order_supplierinfo_update/README.rst index db9b97b3e89..f2aa074e867 100644 --- a/purchase_order_supplierinfo_update/README.rst +++ b/purchase_order_supplierinfo_update/README.rst @@ -14,13 +14,13 @@ Purchase Order Supplierinfo Update :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_order_supplierinfo_update + :target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_supplierinfo_update :alt: OCA/purchase-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_order_supplierinfo_update + :target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_supplierinfo_update :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/142/15.0 + :target: https://runbot.odoo-community.org/runbot/142/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -61,7 +61,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -104,6 +104,6 @@ Current `maintainer `__: |maintainer-ernestotejeda| -This module is part of the `OCA/purchase-workflow `_ project on GitHub. +This module is part of the `OCA/purchase-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_order_supplierinfo_update/static/description/index.html b/purchase_order_supplierinfo_update/static/description/index.html index f0b08043d38..5754ade94af 100644 --- a/purchase_order_supplierinfo_update/static/description/index.html +++ b/purchase_order_supplierinfo_update/static/description/index.html @@ -367,7 +367,7 @@

    Purchase Order Supplierinfo Update

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

    +

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

    This module extends the functionality of purchase to allow the price of the supplier-info to be updated automatically for each product of the a purchase when it is confirmed. This will allow that when a purchase order @@ -412,7 +412,7 @@

    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.

    +feedback.

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

    @@ -443,7 +443,7 @@

    Maintainers

    promote its widespread use.

    Current maintainer:

    ernestotejeda

    -

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

    +

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

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

    From 3752a1d3779935b69d6b5df71ca27f0d2a728afe Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sun, 3 Sep 2023 15:50:22 +0000 Subject: [PATCH 09/17] [UPD] README.rst --- purchase_order_supplierinfo_update/README.rst | 15 ++++--- .../static/description/index.html | 44 ++++++++++--------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/purchase_order_supplierinfo_update/README.rst b/purchase_order_supplierinfo_update/README.rst index f2aa074e867..8557c2a92db 100644 --- a/purchase_order_supplierinfo_update/README.rst +++ b/purchase_order_supplierinfo_update/README.rst @@ -2,10 +2,13 @@ Purchase Order Supplierinfo Update ================================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ddd2ed9e340a050b1b7e9113a6be07decd399df32dab8e76b8a55670c3656fdf + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Purchase Order Supplierinfo Update .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_supplierinfo_update :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/142/16.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module extends the functionality of purchase to allow the price of the supplier-info to be updated automatically for each product of the @@ -60,7 +63,7 @@ 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 +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. diff --git a/purchase_order_supplierinfo_update/static/description/index.html b/purchase_order_supplierinfo_update/static/description/index.html index 5754ade94af..fb70278e8e0 100644 --- a/purchase_order_supplierinfo_update/static/description/index.html +++ b/purchase_order_supplierinfo_update/static/description/index.html @@ -1,20 +1,20 @@ - + - + Purchase Order Supplierinfo Update