File tree 1 file changed +12
-0
lines changed
purchase_only_by_packaging/models
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Copyright 2023 Camptocamp SA
2
2
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3
3
4
+ from math import ceil
5
+
4
6
from odoo import _ , api , models
5
7
from odoo .exceptions import ValidationError
6
8
from odoo .tools import float_compare
@@ -47,6 +49,16 @@ def _force_qty_with_package(self):
47
49
self .product_qty = qty
48
50
return True
49
51
52
+ @api .onchange ("product_packaging_id" )
53
+ def _onchange_product_packaging_id (self ):
54
+ # Round up to the next integer and avoid the Warning raised by
55
+ # _onchange_product_packaging_id defined in the purchase addon
56
+ # The issue exists for sale order => odoo issue to fix proposed
57
+ # here: https://github.com/odoo/odoo/issues/197598
58
+ ceiled_product_packaging_qty = ceil (self .product_packaging_qty )
59
+ self .product_packaging_qty = ceiled_product_packaging_qty or 1
60
+ return super ()._onchange_product_packaging_id ()
61
+
50
62
@api .onchange ("product_qty" )
51
63
def _onchange_product_qty (self ):
52
64
self ._force_qty_with_package ()
You can’t perform that action at this time.
0 commit comments