Thanks for your answers, I've kinda advanced my code and I get the following error (Model not found):
File "/opt/odoo/odoo-server/odoo/models.py", line 1083, in _validate_fields
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
ParseError: "Error mientras se validavan las restricciones
Modelo no encontrado: menu.mrp.test.wizard
Error de contexto:
Vista `Menu MRP`
[view_id: 3532, xml_id: n/a, model: menu.mrp.test.wizard, parent_id: n/a]
None" while parsing /opt/odoo/custom/migsamx/mrp_menu/wizard/mrp_menu_wizard_view.xml:4, near
<record id="oee_report_wizard" model="ir.ui.view">
<field name="name">Menu MRP</field>
<field name="model">menu.mrp.test.wizard</field>
<field name="arch" type="xml">
<form>
<group name="date_range">
<field name="date_range_id"/>
</group>
<group name="date_fields">
<field name="date_from"/>
<field name="date_to"/>
</group>
</form>
</field>
</record>
models folder:
__init__.py
# -*- coding: utf-8 -*-
from . import mrp
mrp.py
# -*- coding: utf-8 -*-
from odoo import models
class MrpMenu(models.Model):
_inherit = 'mrp.workcenter'
views folder:
mrp_view.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="view_mrp_specific_form">
<field name="name">mrp.workcenter.form.inherit</field>
<field name="inherit_id" ref="mrp.mrp_workcenter_view"/>
<field name="model">mrp.workcenter</field>
<field name="type">form</field>
</record>
</odoo>
wizard folder:
__init__.py
# -*- coding: utf-8 -*-
from . import mrp_menu_wizard
mrp_menu_wizard.py
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class MenuWizardTest(models.TransientModel):
_name = "menu.mrp.test.wizard"
_description = "OEE Reports"
date_from = fields.Date(Required=True)
date_to = fields.Date(Required=True)
date_range_id = fields.Many2one(
comodel_name='date.range',
string='Date range'
)
@api.onchange('date_range_id')
def onchange_date_range_id(self):
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end
mrp_menu_wizard_view.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="oee_report_wizard" model="ir.ui.view">
<field name="name">Menu MRP</field>
<field name="model">menu.mrp.test.wizard</field>
<field name="arch" type="xml">
<form>
<group name="date_range">
<field name="date_range_id"/>
</group>
<group name="date_fields">
<field name="date_from"/>
<field name="date_to"/>
</group>
</form>
</field>
</record>
<act_window id="action_menu_test_wizard"
name="OEE Reports"
res_model="menu.mrp.test.wizard"
view_type="form"
view_mode="form"
view_id="oee_report_wizard"
target="new" />
</odoo>
mrp_menu (main module folder):
__init__.py
# -*- coding: utf-8 -*-
#Made by Daniel Medina
from . import models
from . import wizard
__manifest__.py
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem
parent="mrp.menu_mrp_reporting"
id="menu_oee_reports"
name="OEE Reports"
groups="mrp.group_mrp_manager"
/>
<menuitem
parent="menu_oee_reports"
action="action_menu_test"
id="menu_oee_wizard"
sequence="10"
/>
</odoo>
mrp_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem
parent="mrp.menu_mrp_reporting"
id="menu_oee_reports"
name="OEE Reports"
groups="mrp.group_mrp_manager"
/>
<menuitem
parent="menu_oee_reports"
action="action_menu_test"
id="menu_oee_wizard"
sequence="10"
/>
</odoo>
Can you post what you have tried? What do you mean "can't even get inheritance to work"? We can guess, but it is better if you share.