Odoo Help

Welcome!

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

0

extraction attribute : <field name="amount_python_compute">

By
myriam
on 5/21/13, 2:30 PM 883 views

I'm working on the payroll module and on my own module, this data file is the one of paryroll , i'm trying to add another category ... because I need a category with a calculation rule that retrieves the value of the amount "montant"of class.

This category belongs to that one of the deduction. I need it to compute the payslip

have this code in my data file:

<field name="amount_python_compute">**result = contract.line_av_ids.montant**</field>

but i recieve ERROR !!hr_avance_pret and hr_line_echeancier are two classes in another module. I need to have the "montant" attribute of the class hr_line_echeancier. I don't know how should I call this class here in the file data... How should i do this please!

<record id="hr_AVANCE" model="hr.salary.rule.category">
    <field name="name">Remboursement de Prêts</field>
    <field name="code">AVANCE</field>
<field name="parent_id" ref="hr_payroll.DED"/>

</record>

<record id="hr_payroll.avance" model="hr.salary.rule">
    <field name="name">Remboursement des Prêts</field>
    <field name="code">AVANCE PRET</field>
    <field name="sequence">100000</field>
    <field name="category_id" ref="hr_AVANCE"/>
    <field name="condition_select">none</field>
    <field name="amount_select">code</field>
    <field name="amount_python_compute"**>result = contract.line_av_ids.montant</field>**
    <field name="appears_on_payslip" eval="False"/>
    <field name="note">la valeur des avances et des prêts.</field>
</record>

python: class hr_avance_pret(osv.osv): _name = "hr.avance.pret" _columns = {

    'line_ids': fields.one2many('hr.line.echeancier', 'line_id', 'ligne d\'échéance', required=False),
    'avance_id': fields.integer('ID'),
}
class hr_line_echeancier(osv.osv):
_name = "hr.line.echeancier"
_description = "Echeancier"

#def _get_move_check(self, cr, uid, ids, name, args, context=None):
#    res = {}
#    for line in self.browse(cr, uid, ids, context=context):
#        res[line.id] = bool(line.move_id)
#    return res

_columns = {
    'line_id': fields.many2one('hr.avance.pret', "ligne d\'échéancier"),

    'montant': fields.float('Montant'),

}
class hr_contract(osv.osv):


_inherit = 'hr.contract'

_columns = {
    'line_av_ids': fields.one2many('hr.avance.pret', 'avance_id', 'Avance et Prêt'),
}

hr_contract()

please help me !! Please I am blocked!!

Myriam je suis entrain d'intégrer le module paie moi aussi. si tu veux qu'on s'aide voici mon Skype yacine bensidhoum.

le_dilem
on 5/21/13, 4:20 PM

ok je vais t'ajouter ;-)

myriam
on 5/22/13, 8:16 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 5/21/13, 2:30 PM
Seen: 883 times
Last updated: 3/16/15, 8:10 AM