Hi ,i am trying to add a smart button to my view which calculates the sum of total aides donated to a person this is a part of the codeperson.py
def _aide_total(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for aide in self.person_aide_ids.browse(cr, uid, ids, context=context):
total = 0.0
for line in aide.person_aide_valeur:
total += line.person_aide_valeur
res[aide.id] = total
return res
_name='person'
columns={
'person_aide_ids':fields.one2many('person.aide', 'person_id', 'المساعدات', required=False),
'total_person_aides': fields.function(_aide_total,string="القيمة الجملية للمساعدات", type='float'),
}
aide.py
'person_aide_valeur':fields.float('قيمة المساعدة'),
person.xml:(only the button code)
<button type="action" class="oe_stat_button" icon="fa-pencil-square-o" name="المساعدات">
<field name="total_person_aides" string="المساعدات" widget="statinfo"/>
</button>
The button did not work
Can any one help me
and thinks