2
0
account-financial-tools/account_move_line_purchase_info/models/purchase_order_line.py
2023-06-05 15:45:06 +02:00

21 lines
689 B
Python

# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from odoo import api, models
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"
@api.multi
def name_get(self):
result = []
orig_name = dict(super(PurchaseOrderLine, self).name_get())
for line in self:
name = orig_name[line.id]
if self.env.context.get('po_line_info', False):
name = "[%s] %s (%s)" % (line.order_id.name, name,
line.order_id.state)
result.append((line.id, name))
return result