[FIX]filter by partner

This commit is contained in:
ahenriquez
2019-09-18 10:39:13 +02:00
parent f403c06a08
commit 4c4d5b7afa

View File

@@ -82,19 +82,19 @@ 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') @api.onchange('product_id', 'partner_id')
def _onchange_product_id(self): def _onchange_product_id(self):
"""Domain for sale_line_id is computed here to make it dynamic."""
res = super(RmaOrderLine, self)._onchange_product_id() res = super(RmaOrderLine, self)._onchange_product_id()
if res.get('domain') and self.product_id: if not res.get('domain'):
res['domain']['invoice_line_id'] = [ res['domain'] = {}
('product_id', '=', self.product_id.id)] domain = [
elif res.get('domain') and self.product_id: '|',
res['domain']['invoice_line_id'] = [()] ('invoice_id.partner_id', '=', self.partner_id.id),
elif not res.get('domain') and self.product_id: ('invoice_id.partner_id', 'child_of', self.partner_id.id)]
res['domain'] = { if self.product_id:
'invoice_line_id': [('product_id', '=', self.product_id.id)]} domain.append(('product_id', '=', self.product_id.id))
else: res['domain']['invoice_line_id'] = domain
res['domain'] = {'invoice_line_id': []}
return res return res
@api.multi @api.multi