Hello,
as the title mentions, I pass the a variable from purchase order form using a button:
<xpath expr="//button[@name='print_quotation']" position="after">
<button name="%(dynamic_reporting.action_report_selection_wizard)d"
string="Print Custom Report"
class="btn-primary"
type="action"
context="{'default_model_id': active_model}"
/>
</xpath>
The value is passed with no problem(in my case I get default_model_id is: 'purchase.order'), but when I try to use that default_model_id to get to the ID of the model:
@api.model
def _default_model_id(self):
active_model = self.env.context.get('default_model_id', '')
return self.env['ir.model'].search([('model', '=', active_model)], limit=1).id
model_id = fields.Many2one('ir.model',
'Modèle',
domain="[('transient', '=', False)]",
default=_default_model_id
)
the field model_id always stay empty. I tried a bunch of stuff but it didn't amount to anything
any help would be appreciated