Odoo中文网|Odoo实施培训

标题: 用context传当前view中其他字段的值 [打印本页]

作者: 文抄公    时间: 2015-9-16 06:46
标题: 用context传当前view中其他字段的值
product模块中有这样一句,
<field name="value_ids" widget="many2many_tags" options="{'no_create_edit': True}" domain="[('attribute_id', '=', attribute_id)]" context="{'default_attribute_id': attribute_id}"/>

实现的是 选择了属性之后,后面创建的属性值直接属于该属性
之前只在field标签里用context传过常量,传变量的需求还是现在的项目第一次碰到。default_加字段名作为关联对象字段的默认值,这又是openerp的魔法用法。
感谢 @长沙-Vnsoft 分享。


作者: Jackie    时间: 2015-10-31 23:44





欢迎光临 Odoo中文网|Odoo实施培训 (http://www.chinaodoo.net/) Powered by Discuz! X3.2