I've created a wizard and i need to load one2many field lines in the wizard form view when click on the wizard button.
any idea
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
I've created a wizard and i need to load one2many field lines in the wizard form view when click on the wizard button.
any idea
Override default_get method of your wizard and prepare the o2m lines data to show the lines when you open a wizard.
Ex:
class WizMain(models.Model):
_name = 'wiz.main'
lines = fields.One2many('wiz.line', 'wiz_id')
def default_get(self, fields_list):
result = super(WizClassName, self).default_get(fields_list)
order = self.env['sale.order'].browse(self._context.get('active_id'))
# Prepare o2m lines data
lines = []
for line in order.order_line:
lines.append((0, 0, {'product_id': line.product_id.id, 'qty': line.product_uom_qty}))
result.update({'lines': lines})
return result
class WizLine(models.Model):
_name = 'wiz.line'
wiz_id = fields.Many2one('wiz.main')
product_id = fields.Many2one('product.product')
qty = fields.Float()
Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!
Rekisteröidy| Aiheeseen liittyviä artikkeleita | Vastaukset | Näkymät | Toimenpide | |
|---|---|---|---|---|
| 
            
                What is wizard ?
            
            
                    Ratkaistu
            
         |  | 3 marrask. 23  | 33835 | |
|  | 4 heinäk. 25  | 5435 | ||
|  | 2 jouluk. 23  | 18381 | ||
| 
            
                populate wizard form dynamically
            
            
                    Ratkaistu
            
         |  | 6 huhtik. 18  | 22129 | |
| 
            
                How To call wizard from python in odoo10
            
            
                    Ratkaistu
            
         |  | 5 jouluk. 23  | 18849 |