跳至內容
選單
此問題已被標幟
1 回覆
5616 瀏覽次數

i create a model for product  and create a button (which change the quantity of product) on header for open wizard.

i can't set product name on wizard default but i get all product name.

@api.multi
    def _default_product_name(self):
        context = dict(self._context) or {}
        product_id = self.env['create.product.ept'].browse(context.get('active_id', False))
        context.update({'product_ept_id':product_id.name})

    product_ept_id = fields.Many2one('create.product.ept', string="Name", default=_default_product_name)


頭像
捨棄
最佳答案

Hello

make below change into your method.

def _default_product_name(self):
        context = dict(self._context) or {}
        product_id = self.env['create.product.ept'].browse(context.get('active_id', False))
return product_id and product_id.id or False
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
6月 24
2403
1
11月 22
3119
2
8月 22
7451
1
1月 25
9103
1
9月 21
6466