Odoo Help

0
1
Karim minaz
On 2/15/18, 3:05 AM

The compute method or the compute fields are activated or being calculated while rendering the related view. If you want this values on create method then you have to do the same function on create method also. or next change is to trigger the function explicitly from the create method. 

0
ayman mohammed adam
On 8/31/16, 5:12 AM

dear deep,

you need to do something like this,

 @api.multi
@api.depends('amount_currency','currency_id')
 def _amount_in_words(self):
"""
this Function uses to get the ratification amount in words.
"""
for rec in self:
self.amount_words_letters = amount_to_text((self.amount_currency or 0.00))
amount_text= fields.Char(compute='_amount_in_words', string='Amount In Words', store=True)

Edit by:  Anil

I hope I helped you.

Wish I could say it helped me, but sadly no, Thanks for the reply.

deep
on 9/17/16, 3:30 AM

Ayman, onchange is default on @api.depends, so no need to use @api.onchange along with @api.depends.

Akhil P Sivan
on 1/29/17, 12:20 PM
0
Avatar

Akhil P Sivan

--Akhil P Sivan--

4305
| 5 4 7
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 1/29/17, 1:16 PM

Hi,

You may try like this:

class SaleOrder(models.Model):
     _inherit = "sale.order"
     
     @api.model
     def create(self, vals):
         res = super(SaleOrder, self).create(vals)
         total = res.amount_total //compute field value
         return res

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Odoo Training Center

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

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/31/16, 2:35 AM
Seen: 3696 times
Last updated: 2/15/18, 8:02 PM