Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2802 Представления

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

Аватар
Отменить
Лучший ответ

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),

Аватар
Отменить
Автор

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