Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
5745 Ansichten

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)


Avatar
Verwerfen
Beste Antwort

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
Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Juni 24
2569
1
Nov. 22
3295
2
Aug. 22
7626
1
Jan. 25
9323
1
Sept. 21
6631