mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[IMP]name get when filling form purchase order lines
Conflicts: rma_purchase/models/purchase_order_line.py
This commit is contained in:
@@ -25,3 +25,24 @@ class PurchaseOrderLine(models.Model):
|
||||
return super(PurchaseOrderLine, self)._name_search(
|
||||
name='', args=args, operator=operator, limit=limit,
|
||||
name_get_uid=name_get_uid)
|
||||
|
||||
@api.multi
|
||||
def name_get(self):
|
||||
res = []
|
||||
if self.env.context.get('rma'):
|
||||
for purchase in self:
|
||||
invoices = self.env['account.invoice.line'].search(
|
||||
[('purchase_line_id', '=', purchase.id)])
|
||||
if purchase.order_id.name:
|
||||
res.append((purchase.id, "%s %s %s qty:%s" % (
|
||||
purchase.order_id.name,
|
||||
" ".join(str(x) for x in [
|
||||
inv.number for inv in invoices.mapped(
|
||||
'invoice_id')]),
|
||||
purchase.product_id.name, purchase.product_qty)))
|
||||
else:
|
||||
res.append(
|
||||
super(PurchaseOrderLine, purchase).name_get()[0])
|
||||
return res
|
||||
else:
|
||||
return super(PurchaseOrderLine, self).name_get()
|
||||
|
||||
Reference in New Issue
Block a user