Skip to content

Commit

Permalink
[IMP] introduce fields in_force_same_lot and out_force_same_lot
Browse files Browse the repository at this point in the history
Those fields in the rma.operation allows us to control if we want to ensure
that the same lot as the one indicated in the RMA should be used when
receiving from vendors or delivering to customers.
  • Loading branch information
JordiBForgeFlow committed Feb 26, 2024
1 parent 7852ff7 commit c225d4f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
10 changes: 7 additions & 3 deletions rma/models/rma_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ def _default_routes(self):
required=True,
default=lambda self: self.env.user.company_id,
)
force_rma_lot = fields.Boolean(
help="In deliveries to customers or receipts from suppliers "
"you can force to send the same lot of the RMA."
in_force_same_lot = fields.Boolean(
"Forces the same lot to be used "
"in outgoing pickings as the one indicated in the RMA"
)
out_force_same_lot = fields.Boolean(
"Forces the same lot to be used "
"in incoming pickings as the one indicated in the RMA"
)
3 changes: 2 additions & 1 deletion rma/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _get_available_quantity(
not lot_id
and self.rma_line_id.lot_id
and self.location_id.usage == "internal"
and self.operation_id.force_rma_lot
and self.rma_line_id.operation_id.out_force_same_lot
):
# In supplier RMA deliveries we can only send the RMA lot/serial.
lot_id = self.rma_line_id.lot_id
Expand All @@ -89,6 +89,7 @@ def _update_reserved_quantity(
not lot_id
and self.rma_line_id.lot_id
and self.location_id.usage == "internal"
and self.rma_line_id.operation_id.out_force_same_lot
):
# In supplier RMA deliveries we can only send the RMA lot/serial.
lot_id = self.rma_line_id.lot_id
Expand Down
8 changes: 8 additions & 0 deletions rma/views/rma_operation_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
name="customer_to_supplier"
attrs="{'invisible':[('type', '=', 'supplier')]}"
/>
<field
name="in_force_same_lot"
groups="stock.group_production_lot"
/>
</group>
<group name="outbound" string="Outbound">
<field name="out_route_id" />
Expand All @@ -65,6 +69,10 @@
name="supplier_to_customer"
attrs="{'invisible':[('type', '=', 'customer')]}"
/>
<field
name="out_force_same_lot"
groups="stock.group_production_lot"
/>
</group>
</group>
</sheet>
Expand Down
2 changes: 1 addition & 1 deletion rma/wizards/rma_make_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def action_create_picking(self):
and x.rma_line_id
and x.product_id.tracking in ("lot", "serial")
and x.rma_line_id.lot_id
and x.rma_line_id.operation_id.force_rma_lot
and x.rma_line_id.operation_id.in_force_same_lot
and move.location_dest_id.usage == "internal"
):
# Force the reservation of the RMA specific lot for incoming shipments if required.
Expand Down

0 comments on commit c225d4f

Please sign in to comment.