I have created a field called product_status in the module product.supplierinfo, the field is visible in the view product.template.product.form, in the page Purchase, and is different for each vendor.
Now I want the field t oshow up when you are doing a PO, specifically when you add a product to the order lines. This is the module purchase.order.line. The problem is that the field depends of the product and the vendor.
I have tried importing it like this:
from odoo import models, fields, api
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
product_status = fields.Selection(
related='product_id.partner_id.product_status',
string="Product Homologation Status",
store=True,
readonly=True
)
@api.depends('product_id')
def _compute_product_status(self):
for line in self:
# Obtiene el primer registro de seller_ids relacionado
seller = partner_id[:1]
# Si hay un registro en seller_ids, asigna el product_status;
# de lo contrario, establece un valor predeterminado
line.product_status = seller.product_status if seller else False
But the field product_status doens't appear in the module purchase.order.line.
What can I do?