-
-
Notifications
You must be signed in to change notification settings - Fork 715
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
[MIG] product_pricelist_supplierinfo: Migration to 18.0 #1837
base: 18.0
Are you sure you want to change the base?
[MIG] product_pricelist_supplierinfo: Migration to 18.0 #1837
Conversation
* Don't depend on sales * Extended README * Tests focused on module specific features * Code optimization * Don't mix pricelist info with supplier info on criteria
Date order is passed by context, so we have to take this into account for computing properly available supplierinfo records.
If not, you can twist the order in the form and rules won't be applied according criteria
If you set the value "Based on" for using supplier info, but then you change the computation type to another one (like fixed price or discount), this code is still acting, so we should check both fields.
OCA#436) Previously, only worked fine with product.product.
Currently translated at 93.3% (14 of 15 strings) Translation: product-attribute-12.0/product-attribute-12.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_pricelist_supplierinfo/es/
When having price per qty at the supplier level and if you want to base your pricelist on the supplier price, now you can define a margin on the product.supplierinfo
Use standard way to select the seller. As a result a bug in previous solution is fixed also: before this, all supplierinfo records having product_tmpl_id set, were considered as possible price for all product variants, even if product_id was set also. That resulted in same price for all variants even if supplierinfo records had different price for all variants.
If we have suppliers in two or more currencies, and we have a pricelist with an item that is selected the "Prices based on supplier info" option but the pricelist is in a currency different from the supplierinfo the compute of the price get the price on the same amount but with a different currency. With these changes, we are converting the price to the currency on the pricelist that is being used. Also, a test was added to prove the previous behaviour.
Currently translated at 100.0% (20 of 20 strings) Translation: product-attribute-12.0/product-attribute-12.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_pricelist_supplierinfo/fr/
It is possible that this method is called on an inactive template, in which case product_variant_id returns empty recordset and _select_seller will raise expected singleton error.
If we have a product with a supplier with a UOM "A" but the product is sold with a UOM "B" the price we are getting is the same no matter the UOM. For example: Product with the price 1200 per Dozen and we sell a 1 unit we are getting the price of 1200 for that unit when we should be obtaining 100. With these changes, we are converting the price to the UOM that is being used on the sale or the default on the product. Also, a test was added to prove the previous behaviour.
[UPD] Update product_pricelist_supplierinfo.pot [UPD] README.rst
… when date is datetime. date may come from context
When we check the price of any product, the date that we pass on the context has to be a Datetime value or None. With this change we avoid to pass a False. Here you have the reference to the code that check that https://github.com/OCA/OCB/blob/13.0/addons/product/models/product.py#L599-L600 TT29935 product_pricelist_supplierinfo 13.0.1.0.2
TT31816 [UPD] Update product_pricelist_supplierinfo.pot [UPD] README.rst [IMP] update dotfiles [ci skip]
In the e-commerce, if we have a pricelist with a rule based on supplierinfo for a determined supplier partner, such partner could be not accesible for public users and the affected products could not be reached. TT31476
If we don't have a supplierinfo that below 1 unit we won't get any seller. We want to ensure that the condition is fully ignored to get whatever price given the other criterias. TT33659
…sers 0581b66 is not enough on v13 for avoiding the access error, so we sudoed the whole price fetch operation. TT36898
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-attribute-16.0/product-attribute-16.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_pricelist_supplierinfo/
Currently translated at 100.0% (14 of 14 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_pricelist_supplierinfo/es/
Currently translated at 100.0% (14 of 14 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_pricelist_supplierinfo/pt_BR/
Currently translated at 100.0% (14 of 14 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_pricelist_supplierinfo/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-attribute-17.0/product-attribute-17.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_pricelist_supplierinfo/
Currently translated at 100.0% (14 of 14 strings) Translation: product-attribute-17.0/product-attribute-17.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_pricelist_supplierinfo/it/
Update the sale margin string on the field to match the format of the discount field [1], which is located beside it in the list view. [1]: https://github.com/odoo/odoo/blob/e947c589/addons/product/models/product_supplierinfo.py#L65
…in price Introduce a new field to optionally exclude the discount set in the product supplier info when calculating the product's price. Additionally, add a test to validate the new functionality.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-attribute-17.0/product-attribute-17.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_pricelist_supplierinfo/
4fc6bf7
to
abbc972
Compare
Hello @luisg123v @pedrobaeza @florian-dacosta Could you please review this PR? It already includes the implementation of the two comments from #1745, which were merged in 17.0 here: #1836. Best regards. |
25e8f5a
to
0f1a8e9
Compare
#. module: product_pricelist_supplierinfo | ||
#: model:ir.model.fields,field_description:product_pricelist_supplierinfo.field_product_pricelist_item__no_supplierinfo_discount | ||
msgid "Ignore Supplier Info Discount" | ||
msgstr "" |
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.
Missing commit 7217428
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.
Added.
@@ -1,9 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<odoo> | |||
|
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.
Is this done by precommit? :(
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.
Yes :'(
@@ -17,13 +17,13 @@ Supplier info prices in sales pricelists | |||
: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/17.0/product_pricelist_supplierinfo | |||
:target: https://github.com/OCA/product-attribute/tree/18.0/product_pricelist_supplierinfo |
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.
This is part of the precommit autofixes, hence it should be in that commit.
Same for other autoformatting changes.
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.
This is not done by the precommit autofixes.
@@ -27,7 +27,7 @@ def _get_supplierinfo_pricelist_price( | |||
# The product_variant_id returns empty recordset if template is not | |||
# active, so we must ensure variant exists or _select_seller fails. | |||
if product: | |||
if type(date) == datetime: | |||
if type(date) is datetime: |
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.
Why not isinstance here?
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.
Updated to use isinstance.
) | ||
else: | ||
currency_rate.write({"rate": rate}) | ||
def _create_rate(cls, currency_id, rate): |
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.
Since we're modifying the whole method, let's fix currency_id
→ currency
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.
Fixed.
else: | ||
currency_rate.write({"rate": rate}) | ||
def _create_rate(cls, currency_id, rate): | ||
cls.env["res.currency.rate"].create( |
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.
Since we don't know what rates are currently loaded, tests usually remove all existing records before creating new ones.
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.
Deleted existing rates before creating a new rate.
) | ||
self.assertAlmostEqual(price, 0) | ||
|
||
product_template.product_variant_ids = False |
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.
This shouldn't be possible
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.
Removed.
Currently translated at 100.0% (15 of 15 strings) Translation: product-attribute-17.0/product-attribute-17.0-product_pricelist_supplierinfo Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_pricelist_supplierinfo/it/
Changelog: - Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks. - Add a test for the scenario where the pricelist is not based on the supplier info, ensuring the price is calculated as expected natively. - Add a test for the scenario where there are no sellers linked to the product. - Replace the currency rate update by a currency rate creation in the tests, as demo rates have a fixed rate in the past. Co-authored-by: mle <[email protected]>
0f1a8e9
to
f35fd64
Compare
Supersed #1745