Help

1

Odoo 11, command line create a custom app, click menu 2/Server to list has "self is not defined" error

Avatar
Akira Chen

I use the command line to create a custom app

"c:\Program Files (x86)\Odoo 11.0\python\python.exe" "c:\Program Files (x86)\Odoo 11.0\server\odoo-bin" scaffold custom5 "C:\Users\user1\Downloads\1"

In odoo.conf , I had append the directory to addons_path.

addons_path = C:\Program Files (x86)\Odoo 11.0\server\odoo\addons,C:\Users\user1\Downloads\1

When I click custom5/Menu2/Server to list, Odoo display the Odoo Server Error as below:

ValueError: <class 'NameError'>: "name 'self' is not defined" while evaluating
'action = {\n          "type": "ir.actions.act_window",\n          "view_mode": "tree,form",\n          "res_model": self._name,\n        }'

I modified the self._name with "custom5.custom5", and then compile and run successfully.

I click the Menu2/Server to list, there is no any error message. But the name above "Create" and "Import" buttons is showed as "Unnamed". The name should be "custom5 server".

Does someone meet the same problem? How do I solve this problem?

    <!-- server action to the one above -->
  <record model="ir.actions.server" id="custom5.action_server">
  <field name="name">custom5 server</field>
  <field name="model_id" ref="model_custom5_custom5"/>
  <field name="state">code</field>
  <field name="code">
  action = {
  "type": "ir.actions.act_window",
  "view_mode": "tree,form",
  "res_model": "custom5.custom5",
  }
  </field>
  </record>


Avatar
Discard