how i can pass a parent value to a one 2 many and used in an if in odoo 12

536 views Asked by At

I have this code I need if currency is MXN I can choose MXN and USD in presu_detalle, but if in presupuesto currency_id is USD I can't choose nothing and currency_id in presu_detalle would be USD by default, I tried to pass the value in the context but how I can use in python code or conditional in XML

name = 'presupuesto'

currency_id = fields.Many2one('res.currency', 'currency')

childs_ids = fields.One2many('presu_detalle', 'presu_detalle_id')

name= 'presu_detalle'

presu_detalle_id = fields.Many2one('Presupuesto ID')

currency_id = fields.Many2one('res.currency', 'Currency')

XML form parent view

field name="childs_ids" nolabel="1" context="{'default_currency_id':currency_id}"

XML Form child view

field name="currency_id"

it passed but how i can say if the defualt value is MXN you can change value to MXN or USD but if the defualt value is USD you cant change value

0

There are 0 answers