我想要实现的目标很简单:我制作了一个向导,要求用户提供一个RMA ID(这是一个弹出窗口)。提交后,我会在后端执行一些操作,并按照RMA&#d; d的顺序构建一个包含所有其他产品的列表。然后,我需要让用户验证所有这些产品都在物理RMA中。
现在,我在制作清单后立即陷入困境。如何将该列表发送给OpenERP,让它从中生成一个TreeView,以便用户可以单独选择已经找到的产品(以及那些没有的产品)?
我假设我需要一个额外的view.xml,买我不知道:
1)在<field name="arch" type="xml>
节点中插入什么
2)如何将我的自定义列表/对象发送到OpenERP / odoo
换句话说,我有一个列表,我试图发送到OpenERP / odoo以显示在TreeView中。怎么样?
感谢您的帮助!
答案 0 :(得分:0)
@Pier
考虑Odoo-v8。
根据我的理解,您可以尝试以下方法:
在向导中,您需要one2many
字段说product_line_ids
,该字段将显示在向导中。
所以你将有两个类,参见以下结构
class rma_wizard(models.Model):
_name = 'rma.wizard'
rma_id = fields.Many2one('rma.master',string="RMA")
prodcut_line_ids = fields.One2many('product.line','wizard_id',string="Products")
@api.onchange('rma_id')
def rma_id_change(self):
code to get the list of products and use the following code to add in the wizard
final_products_list = []
products= {}
for product in product_list:
result = {}
result.update({'product_id':product.id})
final_product_list.append(result)
self.product_line_ids= final_product_list
class product_line(models.Model):
_name='product.line'
wizard_id = fields.Many2one('rma.wizard',stirng="RMA")
product_id=fields.Many2one('product.product',string="Products")
select_product=fields.Boolean("Select")`
和观看次数:
<record name="rma_wizard_view" model="ir.ui.view"/>
<field name="name">RMA Wizard</fieeld>
<field name="model">rma.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="rma_id"/>
<field name="product_line_ids>
<tree string="Products">
<field name="product_id"/>
<field name="select_product"/>
</tree>
</field>
</field>
</record>
现在您可以根据需要选中复选标记并对其执行操作
希望这会有所帮助!!