-
-
Notifications
You must be signed in to change notification settings - Fork 866
[16.0][MIG] product_supplierinfo_qty_multiplier (from 12.0) #2122
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
[16.0][MIG] product_supplierinfo_qty_multiplier (from 12.0) #2122
Conversation
…or pricelist in products to auto-set correct qty in purchase order lines TT30744
…uantity after having changed the quantity. Typical use case : a supplier sells beers by 6, at the unit price of 2€. if the quantity is superior to 60, the unit price is 1,90€. Currently, if the buyer chooses 59 bottles, the quantity will be rounded to 60, but the price will be 2€. With this correction, the price is 1,90€.
… non blocking message, improving UI
…to onchange usage.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: purchase-workflow-12.0/purchase-workflow-12.0-product_supplierinfo_qty_multiplier Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-product_supplierinfo_qty_multiplier/
7865809
to
131757b
Compare
Migrated module introduced here in V13 #1264 CC original reviewers / contributors : @victoralmau, @pedrobaeza, @joao-p-marques |
/ocabot migration product_supplierinfo_qty_multiplier |
@api.onchange("product_qty") | ||
def _onchange_quantity(self): | ||
def onchange_product_qty_multiplier_qty(self): |
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.
Please follow naming conventions:
def onchange_product_qty_multiplier_qty(self): | |
def _onchange_product_qty_multiplier_qty(self): |
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 it a convention ?
I see both results in odoo. (Indeed more private function than public function)
- def onchange : 50 results in odoo/odoo/addons
- def _onchange : over 300 results in odoo/odoo/addons
nevermind, changed.
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.
Odoo doesn't serve for guidelines. Follow OCA guidelines:
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.
As corollary, I wanted to add some notes for this case where the onchange is not declared on the module that adds the field, and my take was to put _onchange_<field_name>_<module_name>
as method name, for avoiding unintentional method overrides on 2 non-dependent modules, but I don't remember where this proposal goes (but definitively not merged).
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.
Hi @pedrobaeza. I applied your suggestion. (_onchange_product_qty_product_supplierinfo_qty_multiplier)
Is it OK for you ? thanks !
- Adapt code to 16.0 conventions - Add demo data - Add screenshot - Update translation - Update description of the module, splitting 'usage'in 'configure' and 'usage' section
131757b
to
2e3dd93
Compare
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.
Tested on Runboat, works like charm 🌹
And code reviewed ✔️
/ocabot merge nobump |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at c99194d. Thanks a lot for contributing to OCA. ❤️ |
Description
This module allows to define multiplier quantities at the supplier level in the products to apply it in the purchase order lines.
Configure
(If you can't find that column, you can activate it by clicking the three dots at the corner of the table and enabling it).
Usage
CC : @quentinDupont