I have created a button of type action. This button calls an action, and this action calls a form. This form was totally created by me, and has a Create button, which calls the create function, directly inherited from orm.Model (I did not touch it).
When I click on Create, the record is perfectly stored on the database, but then I get this error:
File "/opt/openerp7/openerp_70_ocb_devel/ocb-server/openerp/osv/orm.py", line 4342, in create if vals.pop(f, None) is not None: TypeError: pop() takes at most 1 argument (2 given)
I was looking for the content of vals, and when I click on the button, the create method seems to be called twice. The first time, vals brings the values of the record in a dictionary (all right), the second time brings the ID of the new record generated in a list, and provokes the error.
I would like to know why is this happening and how to solve this. I left here my code:
The button which calls the action:
<button name="%(res_partner_extended.action_create_res_partner_link_category)d" string="Link to category" type="action"/>
The action:
<record id="action_create_res_partner_link_category" model="ir.actions.act_window">
<field name="name">Link to a new category</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.link.category</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="res_partner_link_category_create_form_view"/>
<field name="target">new</field>
</record>
And the form, with the button which is getting the error:
<record id="res_partner_link_category_create_form_view" model="ir.ui.view">
<field name="name">res.partner.link.category.create.form</field>
<field name="model">res.partner.link.category</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Linked category" version="7.0">
<group>
<group col="2">
<field name="partner_id" readonly="1" options="{'no_open': True,}"/>
<field name="link_category_id" required="1" options="{'no_open': True}"/>
<field name="type" required="1"/>
</group>
<group col="2">
<field name="date" required="1"/>
<field name="observations"/>
</group>
</group>
<footer>
<button name="create" string="Create" type="object" class="oe_highlight"/>
or
<button string="Discard" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
No comments:
Post a Comment