[9.0][IMP] rma_sale and rma_account: consider product when filtering sources on rma lines

This commit is contained in:
Lois Rilo
2018-05-23 19:13:03 +02:00
committed by ahenriquez
parent d9f6966b09
commit 5620e95df1

View File

@@ -79,6 +79,21 @@ class RmaOrderLine(models.Model):
digits=dp.get_precision('Product Unit of Measure'), digits=dp.get_precision('Product Unit of Measure'),
readonly=True, compute=_compute_qty_refunded, store=True) readonly=True, compute=_compute_qty_refunded, store=True)
@api.onchange('product_id')
def _onchange_product_id(self):
res = super(RmaOrderLine, self)._onchange_product_id()
if res.get('domain') and self.product_id:
res['domain']['invoice_line_id'] = [
('product_id', '=', self.product_id.id)]
elif res.get('domain') and self.product_id:
res['domain']['invoice_line_id'] = [()]
elif not res.get('domain') and self.product_id:
res['domain'] = {
'invoice_line_id': [('product_id', '=', self.product_id.id)]}
else:
res['domain'] = {'invoice_line_id': []}
return res
@api.multi @api.multi
def _prepare_rma_line_from_inv_line(self, line): def _prepare_rma_line_from_inv_line(self, line):
self.ensure_one() self.ensure_one()