Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2801 Tampilan

Hi

how to get amount of tax in  selection

my file .py:

 def _get_tva_p(self,cr,uid,ids,name,arg,context=None):
        obj=self.pool.get('account.tax')  
        for tax in obj.browse(self,cr,uid,ids,context):
            return ((tax.amount,tax.amount))

'tva_p': fields.function(_get_tva_p,method=True, type='selection', string="Tva en pourcentage",store=True),

 

thanks

Avatar
Buang
Jawaban Terbai

Hi 

You can try like this

def _get_tva_p(self,cr,uid,ids,name,arg,context=None):
        obj=self.pool.get('account.tax')  
        tax_list = []

        for tax in obj.browse(self,cr,uid,ids,context):

            tax_list.append((tax.amount,tax.amount))
        return tax_list

'tva_p': fields.function(_get_tva_p,method=True, type='selection', string="Tva en pourcentage",store=True),

Avatar
Buang
Penulis

Thank for your response but it not working

Modification: 'tva_p': fields.function(_get_tva_p,method=True, type='selection', string="Tva en pourcentage"), you have to remove store= True then only fuinction get call every time