Skip to content

Commit 62f0a35

Browse files
committed
[IMP] delivery_carrier_package_measure_required: add measures to package when you add producto to pack
1 parent 365e287 commit 62f0a35

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

delivery_carrier_package_measure_required/models/stock_picking.py

+21-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,30 @@ class StockPicking(models.Model):
88
_inherit = "stock.picking"
99

1010
def _check_required_package_measurement(self):
11-
"""Check the required measurement on destination pacakges.
12-
13-
If package is None all result packages on the stock pickings are checked
14-
otherwise only the one
15-
"""
11+
"""Check the required measurement on destination pacakges."""
1612
packages = self.move_line_ids.mapped("result_package_id")
1713
packages._check_required_dimension()
1814

1915
def button_validate(self):
2016
self._check_required_package_measurement()
2117
return super().button_validate()
18+
19+
def _put_in_pack(self, move_line_ids, create_package_level=True):
20+
res = super()._put_in_pack(
21+
move_line_ids, create_package_level=create_package_level
22+
)
23+
package_length = self._context.get("choose_delivery_package_length", 0)
24+
package_width = self._context.get("choose_delivery_package_width", 0)
25+
package_height = self._context.get("choose_delivery_package_height", 0)
26+
package_weight = self._context.get("choose_delivery_package_pack_weight", 0)
27+
28+
res.write(
29+
{
30+
"pack_length": package_length,
31+
"width": package_width,
32+
"height": package_height,
33+
"pack_weight": package_weight,
34+
}
35+
)
36+
37+
return res

0 commit comments

Comments
 (0)