Odoo Aide

0

0
2 Réponses
1
mitra safari Iran
06/07/2019 00:09

hi 

you can write something like:

receive_type = fields.Selection([('cash', 'cash'),('visa', 'visa'),('check', 'check')])

amount = fields.Float( string = 'amount')

@api.onchange('receive_type')

def Onchange_receive_type(self):

for  rec in self:


if rec.receive_type == 'cash' :


rec.amount = your amount

1 Commentaires
Ali Mahmoud Liban
06/07/2019 06:01

Thank, that's work but the problem that cash is the default receive type and amount doesn't change till i change receive type, any suggestion?

4
Avatar

Manish Kumar Bohra Inde

--Manish Kumar Bohra--
--Manish Kumar Bohra--


Manish Kumar Bohra Inde
05/07/2019 15:42

Hello,

You can easy to get this value using onchange method because you can easy to update. even if you try to compute method in that case your field readonly tand i think that is wrong for in case of other payment options 

1 Commentaires
Ali Mahmoud Liban
06/07/2019 06:01

Thank You

Poser une question
Writer
Étiquettes
Keep Informed
1 Abonné(e)s
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now