IMP rma allow sending to carrier when no qty has been processed as if it were a full shipment

This commit is contained in:
Jared Kipe
2018-09-18 16:34:37 -07:00
parent c3cebd10c2
commit 22110e12e6

View File

@@ -9,5 +9,18 @@ class StockPicking(models.Model):
def send_to_shipper(self): def send_to_shipper(self):
res = False res = False
for pick in self.filtered(lambda p: not p.carrier_tracking_ref): for pick in self.filtered(lambda p: not p.carrier_tracking_ref):
# deliver full order if no items are done.
pick_has_no_done = sum(pick.move_line_ids.mapped('qty_done')) == 0
if pick_has_no_done:
pick._rma_complete()
res = super(StockPicking, pick).send_to_shipper() res = super(StockPicking, pick).send_to_shipper()
if pick_has_no_done:
pick._rma_complete_reverse()
return res return res
def _rma_complete(self):
for line in self.move_line_ids:
line.qty_done = line.product_uom_qty
def _rma_complete_reverse(self):
self.move_line_ids.write({'qty_done': 0.0})