Skip to content

[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

Merged

Conversation

legalsylvain
Copy link
Contributor

@legalsylvain legalsylvain commented Dec 18, 2023

Description

This module allows to define multiplier quantities at the supplier level in the products to apply it in the purchase order lines.

Configure

  • Go to Purchase > Products > Products.
  • Select a product.
  • Go to the 'Purchase' tab and edit a vendor pricelist line to set 'Multiplier Qty' to 6.0

(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).

product_product_form

Usage

  • Create a new purchase order.
  • Assign it to the partner where the multiplier quantity was previously set.
  • Add a product line with the previously edited product.
  • Quantity is set to 6.0.
  • If you set 9.0 in the quantity field, the quantity will be rounded up to 12.0

purchase_order_form

CC : @quentinDupont

victoralmau and others added 16 commits December 17, 2023 23:55
…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€.
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/
@legalsylvain legalsylvain force-pushed the 16.0-mig-product_supplierinfo_qty_multiplier branch from 7865809 to 131757b Compare December 18, 2023 11:01
@legalsylvain legalsylvain marked this pull request as ready for review December 18, 2023 11:06
@legalsylvain
Copy link
Contributor Author

Migrated module introduced here in V13 #1264

CC original reviewers / contributors : @victoralmau, @pedrobaeza, @joao-p-marques

@legalsylvain
Copy link
Contributor Author

/ocabot migration product_supplierinfo_qty_multiplier

@OCA-git-bot OCA-git-bot added this to the 16.0 milestone Dec 18, 2023
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 18, 2023
55 tasks
@api.onchange("product_qty")
def _onchange_quantity(self):
def onchange_product_qty_multiplier_qty(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow naming conventions:

Suggested change
def onchange_product_qty_multiplier_qty(self):
def _onchange_product_qty_multiplier_qty(self):

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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).

Copy link
Contributor Author

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
@legalsylvain legalsylvain force-pushed the 16.0-mig-product_supplierinfo_qty_multiplier branch from 131757b to 2e3dd93 Compare December 18, 2023 20:11
Copy link

@quentinDupont quentinDupont left a 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 ✔️

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-2122-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit b4b6d48 into OCA:16.0 Jan 27, 2024
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at c99194d. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants