From 8bbbc7ddc73f0e07b91402ca92dab9760e190230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?= Date: Sat, 24 Oct 2020 22:33:55 -0600 Subject: [PATCH 1/3] [ADD] purchase_supplierinfo_currency: module to split purchase orders by currency using supplierinfo currency --- purchase_supplierinfo_currency/README.rst | 77 ++++ purchase_supplierinfo_currency/__init__.py | 4 + .../__manifest__.py | 17 + .../models/__init__.py | 4 + .../models/stock_rule.py | 24 + .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 2 + .../static/description/index.html | 422 ++++++++++++++++++ 8 files changed, 551 insertions(+) create mode 100644 purchase_supplierinfo_currency/README.rst create mode 100644 purchase_supplierinfo_currency/__init__.py create mode 100644 purchase_supplierinfo_currency/__manifest__.py create mode 100644 purchase_supplierinfo_currency/models/__init__.py create mode 100644 purchase_supplierinfo_currency/models/stock_rule.py create mode 100644 purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst create mode 100644 purchase_supplierinfo_currency/readme/DESCRIPTION.rst create mode 100644 purchase_supplierinfo_currency/static/description/index.html diff --git a/purchase_supplierinfo_currency/README.rst b/purchase_supplierinfo_currency/README.rst new file mode 100644 index 00000000000..784b45214d5 --- /dev/null +++ b/purchase_supplierinfo_currency/README.rst @@ -0,0 +1,77 @@ +============================== +Purchase Supplierinfo Currency +============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c7fae92837c36b4918773abd5bddadd19717db17447d868d651d29768ab93162 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_supplierinfo_currency + :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-16-0/purchase-workflow-16-0-purchase_supplierinfo_currency + :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/purchase-workflow&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +If a purchase order is created from a stock rule we create that purchase order with the supplierinfo currency. +If no exist we create a new purchase order with that currency. + +**Table of contents** + +.. contents:: + :local: + +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 +~~~~~~~ + +* Jarsa + +Contributors +~~~~~~~~~~~~ + +* Alan Ramos + +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/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_supplierinfo_currency/__init__.py b/purchase_supplierinfo_currency/__init__.py new file mode 100644 index 00000000000..7327cd4f831 --- /dev/null +++ b/purchase_supplierinfo_currency/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2023 Jarsa +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +from . import models diff --git a/purchase_supplierinfo_currency/__manifest__.py b/purchase_supplierinfo_currency/__manifest__.py new file mode 100644 index 00000000000..3588ba74e69 --- /dev/null +++ b/purchase_supplierinfo_currency/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2023 Jarsa +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Purchase Supplierinfo Currency", + "version": "16.0.1.0.0", + "summary": "When a PO is created from an stock rule this module verifes " + "the product supplier info of the product to create PO per currency", + "author": "Jarsa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/purchase-workflow", + "category": "Purchase Management", + "license": "LGPL-3", + "depends": [ + "purchase_stock", + ], + "installable": True, +} diff --git a/purchase_supplierinfo_currency/models/__init__.py b/purchase_supplierinfo_currency/models/__init__.py new file mode 100644 index 00000000000..11ac3852e50 --- /dev/null +++ b/purchase_supplierinfo_currency/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2023 Jarsa +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +from . import stock_rule diff --git a/purchase_supplierinfo_currency/models/stock_rule.py b/purchase_supplierinfo_currency/models/stock_rule.py new file mode 100644 index 00000000000..fe8e5d8fae0 --- /dev/null +++ b/purchase_supplierinfo_currency/models/stock_rule.py @@ -0,0 +1,24 @@ +# Copyright 2023 Jarsa +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +from odoo import models + + +class StockRule(models.Model): + _inherit = "stock.rule" + + def _make_po_get_domain(self, company_id, values, partner): + domain = super()._make_po_get_domain(company_id, values, partner) + supplier = values.get("supplier") + if supplier and supplier.currency_id: + domain += (("currency_id", "=", supplier.currency_id.id),) + return domain + + def _prepare_purchase_order(self, company_id, origins, values): + res = super()._prepare_purchase_order(company_id, origins, values) + values = values[0] + seller = values.get("supplier") + seller_currency_id = seller.currency_id.id + company_currency_id = self.env.user.company_id.currency_id.id + res["currency_id"] = seller_currency_id or company_currency_id + return res diff --git a/purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst b/purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..9c31b0ce2d1 --- /dev/null +++ b/purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Alan Ramos diff --git a/purchase_supplierinfo_currency/readme/DESCRIPTION.rst b/purchase_supplierinfo_currency/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..d76f5bd6ba7 --- /dev/null +++ b/purchase_supplierinfo_currency/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +If a purchase order is created from a stock rule we create that purchase order with the supplierinfo currency. +If no exist we create a new purchase order with that currency. diff --git a/purchase_supplierinfo_currency/static/description/index.html b/purchase_supplierinfo_currency/static/description/index.html new file mode 100644 index 00000000000..ac6030a6fbf --- /dev/null +++ b/purchase_supplierinfo_currency/static/description/index.html @@ -0,0 +1,422 @@ + + + + + + +Purchase Supplierinfo Currency + + + +
+

Purchase Supplierinfo Currency

+ + +

Beta License: LGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runboat

+

If a purchase order is created from a stock rule we create that purchase order with the supplierinfo currency. +If no exist we create a new purchase order with that currency.

+

Table of contents

+ +
+

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

+
    +
  • Jarsa
  • +
+
+
+

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/purchase-workflow project on GitHub.

+

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

+
+
+
+ + From 1065647c7403eb5b6a745abf0600beba0b0bc3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Alan=20Ramos=20Rodri=CC=81guez?= Date: Thu, 14 Nov 2024 17:59:40 -0600 Subject: [PATCH 2/3] [IMP] purchase_supplierinfo_currency: pre-commit auto fixes --- purchase_supplierinfo_currency/README.rst | 23 ++++++++++--------- purchase_supplierinfo_currency/pyproject.toml | 3 +++ .../readme/CONTRIBUTORS.md | 1 + .../readme/CONTRIBUTORS.rst | 1 - .../readme/DESCRIPTION.md | 3 +++ .../readme/DESCRIPTION.rst | 2 -- .../static/description/index.html | 23 +++++++++++-------- 7 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 purchase_supplierinfo_currency/pyproject.toml create mode 100644 purchase_supplierinfo_currency/readme/CONTRIBUTORS.md delete mode 100644 purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst create mode 100644 purchase_supplierinfo_currency/readme/DESCRIPTION.md delete mode 100644 purchase_supplierinfo_currency/readme/DESCRIPTION.rst diff --git a/purchase_supplierinfo_currency/README.rst b/purchase_supplierinfo_currency/README.rst index 784b45214d5..98cee895c48 100644 --- a/purchase_supplierinfo_currency/README.rst +++ b/purchase_supplierinfo_currency/README.rst @@ -17,19 +17,20 @@ Purchase Supplierinfo Currency :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_supplierinfo_currency + :target: https://github.com/OCA/purchase-workflow/tree/17.0/purchase_supplierinfo_currency :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-16-0/purchase-workflow-16-0-purchase_supplierinfo_currency + :target: https://translation.odoo-community.org/projects/purchase-workflow-17-0/purchase-workflow-17-0-purchase_supplierinfo_currency :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/purchase-workflow&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -If a purchase order is created from a stock rule we create that purchase order with the supplierinfo currency. -If no exist we create a new purchase order with that currency. +If a purchase order is created from a stock rule we create that purchase +order with the supplierinfo currency. If no exist we create a new +purchase order with that currency. **Table of contents** @@ -42,7 +43,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -50,17 +51,17 @@ Credits ======= Authors -~~~~~~~ +------- * Jarsa Contributors -~~~~~~~~~~~~ +------------ -* Alan Ramos +- Alan Ramos Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -72,6 +73,6 @@ 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/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_supplierinfo_currency/pyproject.toml b/purchase_supplierinfo_currency/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/purchase_supplierinfo_currency/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/purchase_supplierinfo_currency/readme/CONTRIBUTORS.md b/purchase_supplierinfo_currency/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..4d45c3a1354 --- /dev/null +++ b/purchase_supplierinfo_currency/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Alan Ramos \<\> diff --git a/purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst b/purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst deleted file mode 100644 index 9c31b0ce2d1..00000000000 --- a/purchase_supplierinfo_currency/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1 +0,0 @@ -* Alan Ramos diff --git a/purchase_supplierinfo_currency/readme/DESCRIPTION.md b/purchase_supplierinfo_currency/readme/DESCRIPTION.md new file mode 100644 index 00000000000..145b7e4a7c2 --- /dev/null +++ b/purchase_supplierinfo_currency/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +If a purchase order is created from a stock rule we create that purchase +order with the supplierinfo currency. If no exist we create a new +purchase order with that currency. diff --git a/purchase_supplierinfo_currency/readme/DESCRIPTION.rst b/purchase_supplierinfo_currency/readme/DESCRIPTION.rst deleted file mode 100644 index d76f5bd6ba7..00000000000 --- a/purchase_supplierinfo_currency/readme/DESCRIPTION.rst +++ /dev/null @@ -1,2 +0,0 @@ -If a purchase order is created from a stock rule we create that purchase order with the supplierinfo currency. -If no exist we create a new purchase order with that currency. diff --git a/purchase_supplierinfo_currency/static/description/index.html b/purchase_supplierinfo_currency/static/description/index.html index ac6030a6fbf..5a3847d20aa 100644 --- a/purchase_supplierinfo_currency/static/description/index.html +++ b/purchase_supplierinfo_currency/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,9 +369,10 @@

Purchase Supplierinfo Currency

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:c7fae92837c36b4918773abd5bddadd19717db17447d868d651d29768ab93162 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runboat

-

If a purchase order is created from a stock rule we create that purchase order with the supplierinfo currency. -If no exist we create a new purchase order with that currency.

+

Beta License: LGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runboat

+

If a purchase order is created from a stock rule we create that purchase +order with the supplierinfo currency. If no exist we create a new +purchase order with that currency.

Table of contents

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

    +feedback.

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

@@ -409,11 +410,13 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +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/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 5dddc9b3c8459803d6a5488e83eb27306ac74b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Alan=20Ramos=20Rodri=CC=81guez?= Date: Thu, 14 Nov 2024 18:09:34 -0600 Subject: [PATCH 3/3] [MIG] purchase_supplierinfo_currency: Migration to 17.0 --- purchase_supplierinfo_currency/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/purchase_supplierinfo_currency/__manifest__.py b/purchase_supplierinfo_currency/__manifest__.py index 3588ba74e69..7cd927f1f20 100644 --- a/purchase_supplierinfo_currency/__manifest__.py +++ b/purchase_supplierinfo_currency/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Purchase Supplierinfo Currency", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "summary": "When a PO is created from an stock rule this module verifes " "the product supplier info of the product to create PO per currency", "author": "Jarsa, Odoo Community Association (OCA)",