Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
268 Visualizações


_columns = {

'credit': fields.integer( 'Credit', help='Project Credit'), 

'money': fields.integer( 'Money', help='Project Money'),  

}

def _calculate_rate(self, cr, uid, ids, money, context=None):

res = {}

for record in self.browse(cr, uid, ids, context=context):

res[record.id] = record.money * 100

return res

def on_change_credit_id(self, cr, uid, ids,money, context=None):

print ('-----------------------Credit--------------------')

res = {'value':{'credit': self._calculate_rate(self, cr, uid, ids, money,context=context),

----------------> TypeError: _calculate_rate() got multiple values for keyword argument 'context'

Who can help me please


Avatar
Cancelar
Melhor resposta

Abdelwahed,

Ramadan Kareem.

You must not depend on 'ids' when its an onchange!

The onchange might get called up when the record is unsaved. I observed that you used browse() on _calculate_rate.

Rather the call from your onchange should be treated specially, like context.get('from_onchange'), then use money value from method, not from browse().

Thanks.

Avatar
Cancelar
Autor

Ramadan Kareem. Thanks a lot for your help really!! It was solved. But can you please help me on this question : https://www.odoo.com/fr_FR/forum/help-1/question/print-many2one-field-display-false-in-odoo-87282

Replied there. In case you did not go through complete training,do tell us on contact@serpentcs.com. We hope you are safe from today's attack!

Melhor resposta

sure it has multiple values...you have a typo error:

res = {'value':{'credit': self._calculate_rate(self, cr, uid, ids, money,context=context),

you do not need second 'self' argument when you call _calculate_rate method...

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
2
ago. 25
2742
1
jul. 25
1095
1
ago. 25
1151
0
mai. 25
1521
2
abr. 25
3713