Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
416 views
in Technique[技术] by (71.8m points)

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

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

question from:https://stackoverflow.com/questions/65840923/how-i-can-pass-a-parent-value-to-a-one-2-many-and-used-in-an-if-in-odoo-12

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...