Repository navigation
[19.0][MIG] purchase_stock_tier_validation: Migration to 19.0 #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yordyl
wants to merge
17
commits into
OCA:19.0
Choose a base branch
from
yordyl:19.0-mig-purchase_stock_tier_validation
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5cd9745
[13.0][ADD] purchase_stock_tier_validation: Exclude RFQs pending to v…
BernatPForgeFlow 2de907c
[UPD] Update purchase_stock_tier_validation.pot
048072f
[UPD] README.rst
OCA-git-bot 84c7001
[IMP] purchase_stock_tier_validation: pre-commit execution
8d151f7
[MIG] purchase_stock_tier_validation: Migration to 14.0
4e7b985
[UPD] Update purchase_stock_tier_validation.pot
7dd6b07
[UPD] README.rst
OCA-git-bot e7363f1
[MIG] purchase_stock_tier_validation: Migration to 15.0
957febd
[UPD] Update purchase_stock_tier_validation.pot
dbae8d2
[UPD] README.rst
OCA-git-bot 7d559d8
[UPD] README.rst
OCA-git-bot 6f29177
[IMP] purchase_stock_tier_validation: pre-commit stuff
CristianoMafraJunior 68b987d
[MIG] purchase_stock_tier_validation: Migration to 16.0
CristianoMafraJunior 3cb2195
[UPD] Update purchase_stock_tier_validation.pot
50356af
[BOT] post-merge updates
OCA-git-bot 7baf0fd
[MIG] purchase_stock_tier_validation: Migration to 19.0
yordyl 2a904f6
[IMP] purchase_stock_tier_validation: tests use the BaseCommon partne…
yordyl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| .. image:: https://odoo-community.org/readme-banner-image | ||
| :target: https://odoo-community.org/get-involved?utm_source=readme | ||
| :alt: Odoo Community Association | ||
|
|
||
| ============================== | ||
| Purchase Stock Tier Validation | ||
| ============================== | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:regenerate_with_oca_gen_addon_readme | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |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%2Ftier--validation-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/tier-validation/tree/19.0/purchase_stock_tier_validation | ||
| :alt: OCA/tier-validation | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/tier-validation-19-0/tier-validation-19-0-purchase_stock_tier_validation | ||
| :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/tier-validation&target_branch=19.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This module excludes RFQs pending to validate or validated when procuring a product. | ||
|
|
||
| If a RFQ, at some point, is requested to validate, it converts it immediately in something unmodifiable. | ||
| Then, taking this into account, if we procure a product with the same supplier as one open RFQ, it should | ||
| check if that is under validation or already validated and discard it on any of both cases. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Installation | ||
| ============ | ||
|
|
||
| This module depends on ``purchase_tier_validation``. You can find it in | ||
| this same repository, `OCA/tier-validation <https://github.com/OCA/tier-validation>`__. | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/tier-validation/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 <https://github.com/OCA/tier-validation/issues/new?body=module:%20purchase_stock_tier_validation%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ------- | ||
|
|
||
| * ForgeFlow | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| - Bernat Puig Font <bernat.puig@forgeflow.com> | ||
| - Giordano Loiaconi <giordanoloiaconi95@gmail.com> (migrate to v19) | ||
|
|
||
| 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/tier-validation <https://github.com/OCA/tier-validation/tree/19.0/purchase_stock_tier_validation>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Copyright 2022 ForgeFlow S.L. | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
| { | ||
| "name": "Purchase Stock Tier Validation", | ||
| "summary": "Exclude RFQs pending to validate when procuring", | ||
| "version": "19.0.1.0.0", | ||
| "category": "Purchase Management", | ||
| "website": "https://github.com/OCA/tier-validation", | ||
| "author": "ForgeFlow, Odoo Community Association (OCA)", | ||
| "maintainers": ["bosd"], | ||
| "license": "AGPL-3", | ||
| "application": False, | ||
| "installable": True, | ||
| "auto_install": True, | ||
| "depends": ["purchase_stock", "purchase_tier_validation"], | ||
| } |
19 changes: 19 additions & 0 deletions
19
purchase_stock_tier_validation/i18n/purchase_stock_tier_validation.pot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * purchase_stock_tier_validation | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 19.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_stock_tier_validation | ||
| #: model:ir.model,name:purchase_stock_tier_validation.model_stock_rule | ||
| msgid "Stock Rule" | ||
| msgstr "" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from . import stock_rule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) | ||
| # Part of ForgeFlow. See LICENSE file for full copyright and licensing details. | ||
|
|
||
| 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=company_id, values=values, partner=partner | ||
| ) | ||
| domain += (("review_ids", "=", False),) | ||
| return domain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [build-system] | ||
| requires = ["whool"] | ||
| build-backend = "whool.buildapi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - Bernat Puig Font \<<bernat.puig@forgeflow.com>\> | ||
| - Giordano Loiaconi \<<giordanoloiaconi95@gmail.com>\> (migrate to v19) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| This module excludes RFQs pending to validate or validated when procuring a product. | ||
|
|
||
| If a RFQ, at some point, is requested to validate, it converts it immediately in something unmodifiable. | ||
| Then, taking this into account, if we procure a product with the same supplier as one open RFQ, it should | ||
| check if that is under validation or already validated and discard it on any of both cases. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from . import test_purchase_stock_tier_validation |
102 changes: 102 additions & 0 deletions
102
purchase_stock_tier_validation/tests/test_purchase_stock_tier_validation.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Copyright 2017-2020 ForgeFlow S.L. | ||
| # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0). | ||
|
|
||
| from odoo import Command, fields | ||
| from odoo.tests import new_test_user, tagged | ||
|
|
||
| from odoo.addons.base.tests.common import BaseCommon | ||
|
|
||
|
|
||
| @tagged("-at_install", "post_install") | ||
| class TestPurchaseStockTierValidation(BaseCommon): | ||
| @classmethod | ||
| def setUpClass(cls): | ||
| super().setUpClass() | ||
| # Get purchase order model | ||
| cls.po_model = cls.env.ref("purchase.model_purchase_order") | ||
|
|
||
| # Create users | ||
| cls.test_user_1 = new_test_user( | ||
| cls.env, name="John", login="test1", groups="base.group_system" | ||
| ) | ||
|
|
||
| # Create tier definitions: | ||
| cls.tier_def_obj = cls.env["tier.definition"] | ||
| cls.tier_def_obj.create( | ||
| { | ||
| "model_id": cls.po_model.id, | ||
| "review_type": "individual", | ||
| "reviewer_id": cls.test_user_1.id, | ||
| } | ||
| ) | ||
|
|
||
| # Common models | ||
| cls.stock_loc = cls.env.ref("stock.stock_location_stock") | ||
| cls.warehouse = cls.env.ref("stock.warehouse0") | ||
|
|
||
| # Create product | ||
| route_buy = cls.env.ref("purchase_stock.route_warehouse0_buy").id | ||
| cls.test_product = cls.env["product.product"].create( | ||
| { | ||
| "name": "Test Scrap Component 1", | ||
| "type": "consu", | ||
| "is_storable": True, | ||
| "route_ids": [Command.set([route_buy])], | ||
| "seller_ids": [ | ||
| Command.create({"partner_id": cls.partner.id, "price": 20.0}) | ||
| ], | ||
| } | ||
| ) | ||
|
|
||
| def test_procurement_in_new_rfq(self): | ||
| """ | ||
| Procure a product with the same supplier as one open RFQ under validation | ||
| and check if it includes the procurement in that RFQ or in a new one. | ||
| """ | ||
| po = self.env["purchase.order"].create( | ||
| { | ||
| "partner_id": self.partner.id, | ||
| "order_line": [ | ||
| Command.create( | ||
| { | ||
| "name": "PO-Product", | ||
| "product_id": self.test_product.id, | ||
| "date_planned": fields.Datetime.now(), | ||
| "product_qty": 10, | ||
| "product_uom_id": self.test_product.uom_id.id, | ||
| "price_unit": 1000, | ||
| }, | ||
| ) | ||
| ], | ||
| } | ||
| ) | ||
| rfq_test_partner_before = self.env["purchase.order"].search( | ||
| [("partner_id", "=", self.partner.id)] | ||
| ) | ||
| self.assertEqual(len(po.mapped("order_line")), 1) | ||
| po.request_validation() | ||
| po.with_user(self.test_user_1).validate_tier() | ||
| date_planned = fields.Datetime.now() | ||
| values = { | ||
| "company_id": self.warehouse.company_id, | ||
| "date_planned": date_planned, | ||
| "warehouse_id": self.warehouse, | ||
| } | ||
| procurements = [ | ||
| self.env["stock.rule"].Procurement( | ||
| self.test_product, | ||
| 1, | ||
| self.env.ref("uom.product_uom_unit"), | ||
| self.stock_loc, | ||
| "test", | ||
| "TEST", | ||
| self.warehouse.company_id, | ||
| values, | ||
| ) | ||
| ] | ||
| self.env["stock.rule"].run(procurements) | ||
| self.assertEqual(len(po.mapped("order_line")), 1) | ||
| rfq_test_partner_after = self.env["purchase.order"].search( | ||
| [("partner_id", "=", self.partner.id)] | ||
| ) | ||
| self.assertEqual(len(rfq_test_partner_after), len(rfq_test_partner_before) + 1) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to update the version manually; it will be updated automatically by the OCA bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BhaveshHeliconia thanks. I wasn't sure what you meant here: this line is the
Project-Id-Versionheader of the.pot, generated by Odoo's export, and I haven't changed the manifest version by hand beyond the19.0.1.0.0that a[MIG]commit sets. Did you mean the manifest version, or something else in this file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yordyotl Yes, I meant the
.potfile itself (purchase_stock_tier_validation/i18n/purchase_stock_tier_validation.pot).In OCA,
.potfiles and their headers (Project-Id-Version) are generated and updated automatically by theoca-cibot post-merge (via automated[UPD] Update <module>.potcommits).To keep migration PRs minimal and avoid translation/Weblate conflicts, we usually don't include
.potfile updates in migration commits. Could you please revert/discard the changes to the.potfile from this PR?Other than that, the test updates look great! Thanks!