Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
i made a new field in account form and it work well i calculated on it as well but when i save it, my new field was reset to 0.
I cant save the form with my field information and i dont know why?
from openerp import models, fields, api, exceptions
""" Model to create and manipulate personal taxes"""
_description= "Model to create own taxes"
_name = 'account.invoice'
_inherit = 'account.invoice'
# Define rfuente as new tax.
rfuente = fields.Monetary('Retencion en la fuente:',store="True" , compute = "rfuente_pc")
# Calculate rfuente and total amount
self.rfuente = self.amount_untaxed * 0.025
self.amount_total = self.amount_total + self.rfuente
@api.onchange will call in change of simple form field. But, when you want to use computed field (field.function) then you need to use @api.depends decorator.
compute_field = fields.Text( string="Compute Field", store=True, compute="_get_compute_field" )
@api.depends('employee_id') def _get_compute_field(self): if self.employee_id.department_id: self.compute_field = self.employee_id.department_id.name
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
|Asked: 6/28/16, 3:20 PM|
|Seen: 347 times|
|Last updated: 7/11/16, 9:22 AM|