Hello,
I am currently creating a module that will display calculations in invoices. The problem is that I do not know how to retrieve values. I read a lot of documentation but I still do not understand how can i do it .
res_config.py
from openerp import models, fields, api
class unite_beneficiaire(models.Model):
_name='unite.beneficiaire.config.settings'
_inherit='res.config.settings'
default_smic=fields.Float(string='Taux horaire du SMIC', default='9.61',default_model='unite.beneficiaire.config.settings')
default_coeff=fields.Float(string='Coefficient',default='0.85',default_model='unite.beneficiaire.config.settings')
default_traitementbrutannuel=fields.Float(string='Traitement brut annuel minimum', default='17169.12',default_model='unite.beneficiaire.config.settings')
account_invoice.py
from openerp import models, api, _, fields
class account_invoice(models.Model):
_inherit='account.invoice'
def _secteur_public(self, cr, uid, ids, context=None):
_ub = self.pool.get('unite.beneficiaire.config.settings').browse(cr,uid,ids)
# i want to get the 'default_traitementbrutannuel' and 'ammout_total' value and return :
# return (ammout_total/default_traitementbrutannuel)
ub=fields.Float(string='Unité bénéficiaire',compute='_secteur_public',readonly=True)
I want to get the 'default_traitementbrutannuel' value of 'unite.beneficiaire.config.settings' class and 'ammout_total' value of the current class and return :
(ammout_total/default_traitementbrutannuel)
thank you