Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
267 Vizualizări


_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


Imagine profil
Abandonează
Cel mai bun răspuns

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.

Imagine profil
Abandonează
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!

Cel mai bun răspuns

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...

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
aug. 25
2742
1
iul. 25
1095
1
aug. 25
1151
0
mai 25
1521
2
apr. 25
3713