hi sir, this is my code in PY for button: (This button is belong to the class of "account.analytic.line.commit" ) and i want the whole form of this button will display in my project.project class. So, I did a one2many relationship between the two class ("account.analytic.line.commit" and "project.project") to call the form in project.project. The codes that i did is totally working without errors except for one problem the button GET TOTAL is disable. I don't understand why it is disabled. Can you please help me i don't know what to do?
class account_analytic_line_commit(osv.osv):
_inherit = "account.analytic.line.commit"
def get_total_bom_commit_button(self, cr, uid, ids, context=None):
bom_total_new = {}
bom_prod_com_pool = self.pool.get('bom.product.components')
for bom_total_ids in self.browse(cr,uid,ids):
new_price = 0
bom_total_line = bom_prod_com_pool.search(cr,uid,[('commit_id','=',bom_total_ids.id)])
for bom_total_new in bom_prod_com_pool.browse(cr,uid,bom_total_line):
new_price = new_price + bom_total_new.total_price
self.write(cr,uid,bom_total_ids.id,{'amount': new_price}, context=context)
return True
And this is my code in XML:
<xpath expr="//field[@name='amount']" position="after">
<button type="object"
icon="gtk-ok"
name="get_total_bom_commit_button"
string="Get Total" groups="" readonly="False" attrs="" states="" disable="False" button="True"/>
</xpath>
Please post your Code! xml and py.