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'm trying to Put button inside header to do certain tasks depends on boolean field,
but when try to print the value inside this field this error appears
"AttributeError: 'sale.order' object has no attribute '_ids'"
How can I fix this
_inherit = 'sale.order'
category = fields.Boolean(string="Category", default=False)
def apply_test(self, cr, uid, ids, context=None):
print "Hello World"
print self.category # error
<record model="ir.ui.view" id="view_order_form_inh_promotion">
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<button name="invoice_recreate" position="after">
<button name="apply_test" string="Test" type="object"/>
You are trying to use self as in new API 8.0
if you want to access to `self.category` that way, you must be in a new API method.
Otherwise if you are in a prior version of Odoo, you must do a browse first.
sale_order = self.browse(cr, uid, ids, context=context)
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: 1/29/15, 3:22 AM|
|Seen: 7353 times|
|Last updated: 5/3/16, 1:41 AM|