Browse Source

[FIX] pos_order_return: prevent error when trying to refund a pos order without pickings

pull/480/head
Sylvain LE GAL 5 years ago
parent
commit
0da9f1bbac
  1. 8
      pos_order_return/models/pos_order.py

8
pos_order_return/models/pos_order.py

@ -125,9 +125,11 @@ class PosOrder(models.Model):
def create_picking(self):
"""Odoo bases return picking if the quantities are negative, but it's
not linked to the original one"""
res = super(PosOrder, self.filtered(lambda x: not x.returned_order_id)
).create_picking()
for order in self.filtered('returned_order_id'):
orders = self.filtered(
lambda x: not x.returned_order_id
or not x.returned_order_id.picking_id)
res = super(PosOrder, orders).create_picking()
for order in self - orders:
wizard = order._create_picking_return()
res = wizard.create_returns()
order.write({'picking_id': res['res_id']})

Loading…
Cancel
Save