openerp - Error during module installation due to xml records referring to each other -
i'm working on odoo module development, left me previous programmer. figured out how of code works, there weird parts, hard understand. 1 example down below: 2 records (form , action of form), referring each other
<!-- temp validation action--> <record id="model_action_id" model="ir.actions.act_window"> <field name="name">password validation</field> <field name="type">ir.actions.act_window</field> <field name="res_model">scores.temp</field> <field name="view_type">form</field> <field name="target">new</field> <field name="view_mode">form</field> <field name="view_id" ref="scores.my_specific_view"/> </record> <!-- temp validation form--> <record id="my_specific_view" model="ir.ui.view"> <field name="name">password.form2</field> <field name="model">scores.temp</field> <field name="act_window_id" ref="scores.model_action_id"/> <field name="arch" type="xml"> <form string="password form validation"> <sheet> <group> <field name="user_id" /> <field name="password" password="true" default_focus="1"/> <button name="validation" type="object" string="sign" context="{'password':password,'user_id':user_id,}" class="oe_inline oe_stat_button". icon="fa-check-circle-o" /> <button name="cancel" string="cancel" special="cancel" class="oe_inline oe_stat_button" icon="fa-stop" /> </group> </sheet> </form> </field> </record>
when i'm trying install module on new server, gives error:
parseerror: "external id not found in system: scores.my_specific_view"
it's searching my_specific_view, it's not defined yet @ point. fun part is, somehow works on old server, don't understand how. may caused first record, somehow loaded in memory before reference made, that's theory. i'll try find way contact programmer, made it, may take while. advices of how avoid conflict during installation highly appreciated.
upd.
in case, described in 1st answer (changed code below):
<!-- temp validation form--> <record id="my_specific_view" model="ir.ui.view"> <field name="name">password.form2</field> <field name="model">scores.temp</field> <field name="act_window_id" ref="scores.model_action_id"/> <field name="arch" type="xml"> <form string="password form validation"> <sheet> <group> <field name="user_id" /> <field name="password" password="true" default_focus="1"/> <button name="validation" type="object" string="sign" context="{'password':password,'user_id':user_id,}" class="oe_inline oe_stat_button". icon="fa-check-circle-o" /> <button name="cancel" string="cancel" special="cancel" class="oe_inline oe_stat_button" icon="fa-stop" /> </group> </sheet> </form> </field> </record> <!-- temp validation action--><!-- <record id="model_action_id" model="ir.actions.act_window"> <field name="name">password validation</field> <field name="type">ir.actions.act_window</field> <field name="res_model">scores.temp</field> <field name="view_type">form</field> <field name="target">new</field> <field name="view_mode">form</field> <field name="view_id" ref="scores.my_specific_view"/> </record>-->
it ends errors below:
parseerror: "validateerror field(s) `arch` failed against constraint: invalid view definition error details: model not found: scores.temp error context: view `password.form2`
same error message if action form remains uncommented.
upd2
in addition i've described above, model scores.temp wasn't found because renamed before in models.py file. works, problem solved.
you can try defining view first, excluding act_window_id field, can define action. in end can update view adding field.
this mean
<!-- temp validation form--> <record id="my_specific_view" model="ir.ui.view"> <field name="name">password.form2</field> <field name="model">scores.temp</field> <!-- <field name="act_window_id" ref="scores.model_action_id"/>--> <field name="arch" type="xml"> <form string="password form validation"> <sheet> <group> <field name="user_id" /> <field name="password" password="true" default_focus="1"/> <button name="validation" type="object" string="sign" context="{'password':password,'user_id':user_id,}" class="oe_inline oe_stat_button". icon="fa-check-circle-o" /> <button name="cancel" string="cancel" special="cancel" class="oe_inline oe_stat_button" icon="fa-stop" /> </group> </sheet> </form> </field> </record> <!-- temp validation action--> <record id="model_action_id" model="ir.actions.act_window"> <field name="name">password validation</field> <field name="type">ir.actions.act_window</field> <field name="res_model">scores.temp</field> <field name="view_type">form</field> <field name="target">new</field> <field name="view_mode">form</field> <field name="view_id" ref="scores.my_specific_view"/> </record> <record id="my_specific_view" model="ir.ui.view"> <field name="act_window_id" ref="scores.model_action_id"/> </record>
Comments
Post a Comment