Hello all,
I have very strange situation than I don't understand. Maybe some one of you could help me.
So far I understand that when I want to pass some information from model to wizard this done via context. If I want to set up default value for field inside wizard I have to add only 'context': {'default_fieldname': 'value'} and thats all. But it doesn't work.
So I have this simple code inside my Class that's inherit from
'account.tax.report.handler'
def _custom_options_initializer(self, report, options, previous_options=None):
super()._custom_options_initializer(report, options, previous_options=previous_options)
options.setdefault('buttons', []).append(
{
'name': _('XML'),
'sequence': 0,
'action': 'print_tax_report_to_xml',
'file_export_type': _('XML'),
}
)
def print_tax_report_to_xml(self, options):
# add options to context and return action to open transient model
new_wizard = self.env['l10n_cz_reports_systee.dph.xml.export'].create({})
view_id = self.env.ref('l10n_cz_reports_systee.view_dph_report_export').id
return {
'name': _('DPH Export Options'),
'view_mode': 'form',
'views': [[view_id, 'form']],
'res_model': 'l10n_cz_reports_systee.dph.xml.export',
'type': 'ir.actions.act_window',
'res_id': new_wizard.id,
'target': 'new',
'context': dict(self._context, l10n_cz_reports_systee_generation_options=options, default_settlement_coefficient=90),
}
Inside wizard I try to implement also default_get(self, fields) function but self.env.context doesn't contains all passed information but only general info like lang, tz, uid, allowed_company.
And what is even bigger surprise for me that context inside submit function of this wizard contains all passed information.
Looking forward for any ideas.