from odoo import models, fields, api class PurchaseOrderLine(models.Model): _inherit = 'purchase.order.line' # Computed fields for comparison data from purchase.order order_payment_term_id = fields.Many2one( 'account.payment.term', string='Payment Terms', compute='_compute_order_comparison_fields', help='Payment terms from the purchase order' ) order_comparison_notes = fields.Text( string='Notes', compute='_compute_order_comparison_fields', help='Comparison notes from the purchase order' ) order_garansi = fields.Boolean( string='Garansi', compute='_compute_order_comparison_fields', help='Warranty information from the purchase order' ) order_landed_cost = fields.Boolean( string='Landed Cost', compute='_compute_order_comparison_fields', help='Landed cost flag from the purchase order' ) order_landed_cost_tag_ids = fields.Many2many( 'purchase.landed.cost.tag', string='LC Tags', compute='_compute_order_comparison_fields', help='Landed cost tags from the purchase order' ) @api.depends('order_id', 'order_id.payment_term_id', 'order_id.comparison_notes', 'order_id.garansi', 'order_id.landed_cost', 'order_id.landed_cost_tag_ids') def _compute_order_comparison_fields(self): """Compute comparison fields from the related purchase order""" for line in self: if line.order_id: line.order_payment_term_id = line.order_id.payment_term_id line.order_comparison_notes = line.order_id.comparison_notes line.order_garansi = line.order_id.garansi line.order_landed_cost = line.order_id.landed_cost line.order_landed_cost_tag_ids = line.order_id.landed_cost_tag_ids else: line.order_payment_term_id = False line.order_comparison_notes = False line.order_garansi = False line.order_landed_cost = False line.order_landed_cost_tag_ids = False