Skip to Content
Menu
This question has been flagged
3820 Views

I try to install a custom module with no problem I think (here is the code: 


class pb_orders_products(models.Model):


_name = "pb.orders.products"

_inherit = ['mail.thread']

_rec_name = "id"


reseller_private_product_id = fields.Integer(string='Ext. ID', size=128, required=True)

finalcustomer_id = fields.Many2one(comodel_name='pb.finalcustomers', inverse_name='id', string='Final Customer ID', required=True)

order_id = fields.Many2one(comodel_name='sale.order', inverse_name='id', string='SO', required=True)

purchase_order_id = fields.Many2one(comodel_name='purchase.order', inverse_name='id', string='PO', required=False)

measurements_id = fields.Many2one(comodel_name='pb.finalcustomers.measurements', inverse_name='id', string='Measurements ID', required=True)

product_type_id = fields.Selection([

('1', 'Shirt'),

('2', 'Suit'),

('3', 'Jacket'),

('4', 'Trouser'),

('5', 'Waiscoat'),

('6', 'Tie'),

('7', 'Belt'),

('8', 'Shoes'),

], string='Product', required=True)

product_quantity = fields.Char(string='Quantity', size=128, required=True)

fabric_id = fields.Many2one(comodel_name='pb.fabrics', inverse_name='id', string='Fabric', required=False)

date_received = fields.Date(string='Date of receipt', required=True)

status = fields.Selection(var_product_history, string='Status', required=True)

status_date = fields.Date(string='Status Date', required=True)

history = fields.One2many(comodel_name='pb.orders.products.history', inverse_name='product_id')

options = fields.One2many(comodel_name='pb.orders.products.options', inverse_name='product_id')

in Python models and in XML views I have:
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>

<menuitem name="Production" id="menu_pb_root" sequence="71"/>

<menuitem name="Products" id="menu_production" parent="menu_pb_root" sequence="1"/>

<record model="ir.actions.act_window" id="action_products_inproduction">
<field name="name">Products in production</field>
<field name="res_model">pb.orders.products</field>
<field name="domain">['|',('status','=','received'),'|',('status','=','checked'),('status','=','production')]</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="in production" id="menu_products_inproduction" parent="menu_production" sequence="1" action="action_products_inproduction"/>

<record model="ir.actions.act_window" id="action_products_late">
<field name="name">Products late</field>
<field name="res_model">pb.orders.products</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="late" id="menu_products_late" parent="menu_production" sequence="2" action="action_products_late"/>

<record model="ir.actions.act_window" id="action_products_issue">
<field name="name">Products with issues</field>
<field name="res_model">pb.orders.products</field>
<field name="domain">[('status','=','alteration')]</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="issues" id="menu_products_issues" parent="menu_production" sequence="3" action="action_products_issue"/>

<record model="ir.actions.act_window" id="action_products_all">
<field name="name">All products</field>
<field name="res_model">pb.orders.products</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="all" id="menu_products_all" parent="menu_production" sequence="4" action="action_products_all"/>

<menuitem name="Final Customers" id="menu_general" parent="menu_pb_root" sequence="2"/>

<record model="ir.actions.act_window" id="action_customer">
<field name="name">Final Customers</field>
<field name="res_model">pb.finalcustomers</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Final Customers" id="menu_customers" parent="menu_general" sequence="1" action="action_customer"/>

<record model="ir.actions.act_window" id="action_finalcustomers_measurements">
<field name="name">Final Customers Measurements</field>
<field name="res_model">pb.finalcustomers.measurements</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Measurements" id="menu_customerd_measurementd" parent="menu_customers" sequence="1" action="action_finalcustomers_measurements"/>

<menuitem name="Configuration" id="menu_configuration" parent="menu_pb_root" sequence="3"/>

<record model="ir.actions.act_window" id="action_fabrics">
<field name="name">Fabrics</field>
<field name="res_model">pb.fabrics</field>
<field name="view_mode">tree,form,search</field>
</record>
<menuitem name="Fabrics" id="menu_fabrics" parent="menu_configuration" sequence="1" action="action_fabrics"/>

<record model="ir.actions.act_window" id="action_products_options">
<field name="name">Products Options</field>
<field name="res_model">pb.products.options</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Products Options" id="menu_products_options" parent="menu_configuration" sequence="2" action="action_products_options"/>

<record model="ir.actions.act_window" id="action_products_options_values">
<field name="name">Products Options Values</field>
<field name="res_model">pb.products.options.values</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Products Options Values" id="menu_products_options_values" parent="menu_products_options" sequence="1" action="action_products_options_values"/>

<record model="ir.actions.act_window" id="action_orders_history">
<field name="name">History</field>
<field name="res_model">pb.orders.products.history</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="History" id="menu_orders_history" parent="menu_configuration" sequence="3" action="action_orders_history"/>

</data>
</openerp>


Error:

Odoo Server Error

Traceback (most recent call last):

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 744, in parse

    self._tags[rec.tag](rec, de, mode=mode)

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 654, in _tag_record

    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)

  File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_model.py", line 1487, in _update

    record = record.create(values)

  File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_actions.py", line 230, in create

    return super(IrActionsActWindow, self).create(vals)

  File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_actions.py", line 57, in create

    res = super(IrActions, self).create(vals)

  File "/opt/odoo/odoo11/odoo/models.py", line 3373, in create

    record = self.browse(self._create(old_vals))

  File "/opt/odoo/odoo11/odoo/models.py", line 3526, in _create

    self._validate_fields(vals)

  File "/opt/odoo/odoo11/odoo/models.py", line 1036, in _validate_fields

    check(self)

File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_actions.py", line 138, in _check_model

    raise ValidationError(_('Invalid model name %r in action definition.') % action.res_model)

odoo.exceptions.ValidationError: ("Invalid model name 'pb.orders.products' in action definition.", None)


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/opt/odoo/odoo11/odoo/http.py", line 650, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/opt/odoo/odoo11/odoo/http.py", line 310, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/opt/odoo/odoo11/odoo/tools/pycompat.py", line 87, in reraise

    raise value

  File "/opt/odoo/odoo11/odoo/http.py", line 692, in dispatch

    result = self._call_function(**self.params)

  File "/opt/odoo/odoo11/odoo/http.py", line 342, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/opt/odoo/odoo11/odoo/service/model.py", line 97, in wrapper

    return f(dbname, *args, **kwargs)

  File "/opt/odoo/odoo11/odoo/http.py", line 335, in checked_call

    result = self.endpoint(*a, **kw)

  File "/opt/odoo/odoo11/odoo/http.py", line 936, in __call__

    return self.method(*args, **kw)

  File "/opt/odoo/odoo11/odoo/http.py", line 515, in response_wrap

    response = f(*args, **kw)

  File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 938, in call_button

    action = self._call_kw(model, method, args, {})

  File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 926, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/opt/odoo/odoo11/odoo/api.py", line 689, in call_kw

    return call_kw_multi(method, model, args, kwargs)

  File "/opt/odoo/odoo11/odoo/api.py", line 680, in call_kw_multi

    result = method(recs, *args, **kwargs)

  File "<decorator-gen-42>", line 2, in button_immediate_install

  File "/opt/odoo/odoo11/odoo/addons/base/module/module.py", line 71, in check_and_log

    return method(self, *args, **kwargs)

  File "/opt/odoo/odoo11/odoo/addons/base/module/module.py", line 449, in button_immediate_install

    return self._button_immediate_function(type(self).button_install)

  File "/opt/odoo/odoo11/odoo/addons/base/module/module.py", line 542, in _button_immediate_function

    modules.registry.Registry.new(self._cr.dbname, update_module=True)

  File "/opt/odoo/odoo11/odoo/modules/registry.py", line 85, in new

    odoo.modules.load_modules(registry._db, force_demo, status, update_module)

  File "/opt/odoo/odoo11/odoo/modules/loading.py", line 380, in load_modules

    loaded_modules, update_module, models_to_check)

  File "/opt/odoo/odoo11/odoo/modules/loading.py", line 274, in load_marked_modules

    perform_checks=perform_checks, models_to_check=models_to_check

  File "/opt/odoo/odoo11/odoo/modules/loading.py", line 181, in load_module_graph

    _load_data(cr, module_name, idref, mode, kind='data')

  File "/opt/odoo/odoo11/odoo/modules/loading.py", line 95, in _load_data

    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 791, in convert_file

    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 852, in convert_xml_import

    obj.parse(doc.getroot(), mode=mode)

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 741, in parse

    self.parse(rec, mode)

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 751, in parse

    exc_info[2]

  File "/opt/odoo/odoo11/odoo/tools/pycompat.py", line 86, in reraise

    raise value.with_traceback(tb)

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 744, in parse

    self._tags[rec.tag](rec, de, mode=mode)

  File "/opt/odoo/odoo11/odoo/tools/convert.py", line 654, in _tag_record

    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)

  File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_model.py", line 1487, in _update

    record = record.create(values)

  File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_actions.py", line 230, in create

    return super(IrActionsActWindow, self).create(vals)

  File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_actions.py", line 57, in create

    res = super(IrActions, self).create(vals)

  File "/opt/odoo/odoo11/odoo/models.py", line 3373, in create

    record = self.browse(self._create(old_vals))

  File "/opt/odoo/odoo11/odoo/models.py", line 3526, in _create

    self._validate_fields(vals)

  File "/opt/odoo/odoo11/odoo/models.py", line 1036, in _validate_fields

    check(self)

  File "/opt/odoo/odoo11/odoo/addons/base/ir/ir_actions.py", line 138, in _check_model

    raise ValidationError(_('Invalid model name %r in action definition.') % action.res_model)

odoo.tools.convert.ParseError: "Invalid model name 'pb.orders.products' in action definition.

None" while parsing /opt/odoo/odoo11-custom-addons/probespoke/views/menu.xml:9, near

<record model="ir.actions.act_window" id="action_products_inproduction">

<field name="name">Products in production</field>

<field name="res_model">pb.orders.products</field>

<field name="domain">['|',('status','=','received'),'|',('status','=','checked'),('status','=','production')]</field>

<field name="view_mode">tree,form</field>

</record>

Avatar
Discard

Hey. You should use the code formatter tag to make more legible.

Did you read your error message? You can't install a buggy module.

Author

Yes but I don't see how this is buggy. What "Invalid model name 'pb.orders.products' in action definition." could mean?

When I google it I find nobody who has the same issue...

Author

Okay guy, I can you explain me this:

I comment all the data in the __manifest__.py in order to install the database part, it work. Then I uncomment and install the view, it work to!

Any idea of why should I install this addons in 2 part?

Related Posts Replies Views Activity
1
Jul 24
343
1
Jan 24
1688
2
Mar 23
1024
2
Jul 22
7405
1
Jun 21
1058