Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I write a "def confirm_sale(self, cr, uid, ids, context=None):â¦â¦â¦â¦" in saly.py/class sale.order, and i write the "ir.actions.server" like:
<record id="action_sale_order_action_cancel" model="ir.actions.server"> <field name="name">Cancel1</field> <field name="type">ir.actions.server</field> <field name="model_id" ref="model_sale_order"/> <field name="state">code</field> **<field name="code">obj.confirm_sale(context=context)</field>** </record> <record id="id_action_sale_order_action_cancel" model="ir.values"> <field name="name">Cancel</field> <field name="action_id" ref="action_sale_order_action_cancel"/> <field name="value" eval="'ir.actions.server,' + str(ref('action_sale_order_action_cancel'))"/> <field name="key">action</field> <field name="model_id" ref="model_sale_order"/> <field name="model">sale.order</field> <field name="key2">client_action_multi</field> </record>
but it always take the error:
" openerp.tools.safe_eval: Cannot eval u'obj.confirm_sale(context=context)' "
" AttributeError: "Field 'confirm_sale' does not exist in object 'browse_record(sale.order, 10)'" "
But if I replace confirm_sale with action_button_confirm , which has already exist in saly.py, it can work ..
I think I should add something more..But I don't know how to collect...
If I understand you correctly, when using the method action_button_confirm it is working, while using the method confirm_sale you get an error? If that is true, did you restart the openERP server, so that it knows the changed code, and have you reloaded (or loaded for the first time) your module?
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 3/26/13, 11:59 PM|
|Seen: 1397 times|
|Last updated: 3/16/15, 8:10 AM|