[18.0][FIX] product_pack: prevent currency being misinterpreted as UoM when printing labels for totalized packs#220
Conversation
|
Hi @pedrobaeza, |
|
Which crash? Please check pre-commit. |
d4377dc to
e984883
Compare
|
@pedrobaeza I have already completed the description of the change |
|
Isn't this a problem of the calling method not using keyword argument? |
e984883 to
a17dc27
Compare
| considering pricelist rules | ||
| """ | ||
| self and self.ensure_one() | ||
|
|
There was a problem hiding this comment.
Don't add empty lines inside a method.
|
@pedrobaeza Yes, the original problem was that the calling method didn't use keyword arguments for currency, causing the currency to be passed as a positional argument and ending up in the uom parameter. |
What about my question? |
a17dc27 to
0c392db
Compare
|
@pedrobaeza Yes, exactly. The root cause was the calling method not using keyword arguments. The fix I pushed addresses that by refactoring the call to use explicit keywords. |
|
Then this is not correct. You shouldn't fix things at other level that doesn't correspond, as this is complicating this code in an unneeded way. Please fix it where the keyword argument is not being called properly (even at Odoo level). Imagine if other keyword argument is also not passed as keyword (different from I understand it's easier to do it at this level, but think that all the modules will expect the same things in |
|
This PR has the |
|
@pedrobaeza Thanks for the feedback! |
|
Fixed in Odoo, so closing. |
Issue:
When printing product labels for pack products with Pack Components Price set to Totalized on the main product, Odoo raised:
AttributeError: 'res.currency' object has no attribute '_compute_quantity'
This happened because in some _get_product_price calls, the currency parameter was being passed as the second positional argument and misinterpreted as uom, causing the crash.
Solution:
Updated _get_product_price to detect when the second positional argument is a res.currency record, move it to kwargs['currency'], and set uom=None. This ensures _compute_price_rule receives the correct parameters and avoids using a currency as a UoM.
Step to reproduce error and test