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

22 lines
668 B
Python

# Copyright 2019 ForgeFlow S.L.
# (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from odoo import models
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"
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 = "[{}] {} ({})".format(
line.order_id.name, name, line.order_id.state
)
result.append((line.id, name))
return result