-1

I'm trying to create a new item in this dropdown list for Odoo V12, but I'm nos sure how to define the template/record ... I need to generate a new option for calling a python function. enter image description here

The model of the view is the next one: education.group The module that contains this model is called: education

I tried the next code but I still have the issue. (I'm not sure if the view has to be defined like that).

 <record id="education_group_mailing_action" model="ir.actions.server">
    <field name="name">Generate group lists</field>
    <field name="type">ir.actions.server</field>
    <field name="model_id" ref="education.group"/>
    <field name="binding_model_id" ref="education.group"/>
    <field name="state">code</field>
    <field name="code">action = records.generate_lists()</field>
</record>
class ResPartner(models.Model):
    _inherit='education.group'

    def generate_lists(self):
        print("que pasa")

This is the error:

enter image description here

This is the model in the DB:

enter image description here

Anyone knows how to do it? Thanks for reading!

arevilla009
  • 429
  • 3
  • 18

1 Answers1

0

in model_id you should pass model name, change your model_id like

<field name="model_id" ref="your_module_name.model_education_group"/>
<field name="binding_model_id" ref="your_module_name.model_education_group"/>
Pruthvi Barot
  • 1,948
  • 3
  • 14