2019-12-24 10:29:45 +01:00
|
|
|
# Copyright 2019 ForgeFlow S.L.
|
|
|
|
# (https://www.forgeflow.com)
|
2019-07-29 12:32:21 +02:00
|
|
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
|
|
|
|
2019-12-24 10:29:45 +01:00
|
|
|
from odoo import models
|
2019-07-29 12:32:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
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]
|
2019-12-24 09:09:12 +01:00
|
|
|
if self.env.context.get("po_line_info", False):
|
2019-12-24 10:29:45 +01:00
|
|
|
name = "[{}] {} ({})".format(
|
|
|
|
line.order_id.name, name, line.order_id.state
|
|
|
|
)
|
2019-07-29 12:32:21 +02:00
|
|
|
result.append((line.id, name))
|
|
|
|
return result
|