hi ,
i want to add field.function 'amount_total_text ' to class account.move because i want this field in report created by pentaho
i had done this but it isn't worked
class AccountMove(models.Model):
_name = 'account.move'
_inherit = 'account.move'
amount_total_text:fields.Function(amount_to_text_fr,methode="True",string="total",type="string")
@api.multi
def amount_to_text_fr(self, amount, currency='Dirhams'):
return amount_to_text_fr(amount,currency)
@api.depends('control_amount_total')
def _compute_control_amount_total_text(self):
for record in self:
if record.control_amount_total :
amount = record.control_amount_total
list = str(amount).split('.')
start_word = amount_to_text_fr(abs(int(list[0])), 'Dirhams').split('Dirhams')[0]
end_word = amount_to_text_fr(int(list[1]), 'Centimes').split('Centimes')[0]
record.control_amount_total_text = start_word + ' Dirhams et ' + end_word + ' Centimes'
#self.control_amount_total_text = amount_to_text(self.control_amount_total,'fr','Dirhams')
this is my code that contains function and new field but it isnt working
thanks to help me