python - How can I get the sale_order.id from sale_order_line onchange method? In odoo 9 -
i want id value of sale.order sale.order.line onchange method.
i have code:
class saleorderlineext(models.model): _inherit = ['sale.order.line'] @api.multi @api.onchange('my_field') def my_field_change(self): related_sale_order = self.order_id print 'related_sale_order: ', related_sale_order print 'related_sale_order.id: ', related_sale_order.id
but output have this:
related_sale_order: sale.order(<openerp.models.newid object @ 0x7f7566029810>,) related_sale_order.id: <openerp.models.newid object @ 0x7f7566029810>
i can check other values of sale order, not id. why , how can it?
in onchange method frame pass d dummy object have values in view in order original record :
self._origin.related_sale_order.id
but should keep in mind related sale order when create record not yet saved in database keep getting same result in edit mode have id.
hope helps you.
Comments
Post a Comment