0

I have a field inside a transient model:

cash_collection = fields.Float(string="Cash Collection")

this field already have a value.Is there any way to show this stored value when wizard popup?

Abdus Sattar Bhuiyan
  • 3,016
  • 4
  • 38
  • 72

1 Answers1

0

It can be done by passing through the context. In your python Code in your parent model:

   def wizard_open(self):
        wizard = self.env['model.name'].create({
              'name': 'Record Name' #this assumes you are creating new record upon this wizard submission
        })
        return {
            'name': _('Wizard title'),
            'type': 'ir.actions.act_window',
            'res_model': 'model.name',
            'view_mode': 'form',
            'res_id': wizard.id,
            'target': 'new',
            'context': {'default_cash_collection': self.cash_collection}
        }

Then in your button you can pass the context like this

<button name="wizard_open" type="object" string="Wizard Call" context="{'default_cash_collection':cash_collection}" />