File tree 1 file changed +10
-0
lines changed
purchase_only_by_packaging/models
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 4
4
from odoo import _ , api , models
5
5
from odoo .exceptions import ValidationError
6
6
from odoo .tools import float_compare
7
+ from math import ceil
7
8
8
9
9
10
class PurchaseOrderLine (models .Model ):
@@ -46,6 +47,15 @@ def _force_qty_with_package(self):
46
47
)
47
48
self .product_qty = qty
48
49
return True
50
+
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
+ ceiled_product_packaging_qty = ceil (self .product_packaging_qty )
57
+ self .product_packaging_qty = ceiled_product_packaging_qty or 1
58
+ return super ()._onchange_product_packaging_id ()
49
59
50
60
@api .onchange ("product_qty" )
51
61
def _onchange_product_qty (self ):
You can’t perform that action at this time.
0 commit comments