Odoo Help


<field name="amount_python_compute">

on 5/20/13, 9:33 AM 1,533 views

i have this code in my data file:

<field name="amount_python_compute">result = hr_line_echeancier.montant</field>

but i recieve ERROR !! hr_line_echeancier is in a class 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 !!!

Thank you .

is there any link between contract and this modules or payslip and this module?? ,,,

ClueLogics Technologies Pvt. Ltd.
on 5/20/13, 9:40 AM

it's linked with contract: class hr_contract(osv.osv):

_inherit = 'hr.contract'

_columns = {
    'line_ech_ids': fields.one2many('hr.line.echeancier', 'line_id', 'ligne Echéancier'),


on 5/21/13, 9:16 AM

SOS @Sandeep !!

on 5/21/13, 11:35 AM

see below answer

ClueLogics Technologies Pvt. Ltd.
on 5/21/13, 4:05 PM

ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
| 6 5 8
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd.
On 5/21/13, 4:13 PM

Hey myriam

now i understand as you commented above that this is liked to contract as one2many field so now just paste this my below code in amount_python_compute field

 for i in contract.line_ech_ids:

note: please be in mind this object (hr.line.echeancier) should be liked to contract as one2many field then this above code will work fine


Sorry !! but it didn't work for me, it generates an error for this code....

on 5/22/13, 6:57 AM

due to some design changes I had to make some changes in the link between tables and here is the problem explained otherwise http://help.openerp.com/question/17740/extraction-attribute-with-amount_python_compute/

on 5/22/13, 7:15 AM
On 5/20/13, 9:53 AM

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.

<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 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 = hr.line.echeancier.montant</field>
        <field name="appears_on_payslip" eval="False"/>
        <field name="note">la valeur des avances et des prêts.</field>


class hr_line_echeancier(osv.osv):
    _name = "hr.line.echeancier"
    _description = "Echeancier"
 _columns = {
        'line_id': fields.many2one('hr.avance.pret', "ligne d\'échéancier"),
        'date_ech': fields.date('Date d\'échéance',
                                states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]}, select=True),
        'montant': fields.float('Montant'),


Thank you so much ..

is it liked to employee ?? i mean hr.line.echeancier

ClueLogics Technologies Pvt. Ltd.
on 5/20/13, 10:07 AM

i want something like this one :<field name="amount_python_compute">result = contract.wage</field>but i can't find the way to do it with my own class..! please heeeellp!!! thank you for your apply

on 5/20/13, 1:37 PM

heeeellppp !! pleaseee

on 5/20/13, 8:58 PM

hey Myrian , you can use only contratc payslip, time and some object there ,,, you can't use your own object there for that case you will have to register your own object in compute button method

ClueLogics Technologies Pvt. Ltd.
on 5/21/13, 2:54 AM

Thank you ...

on 5/21/13, 7:36 AM

it's linked to class contarct : _inherit = 'hr.contract'

_columns = { 'line_ech_ids': fields.one2many('hr.line.echeancier', 'line_id', 'ligne Echéancier'), } heeelp pleaaaseeeeeeee :-(

on 5/21/13, 11:49 AM
On 5/20/13, 9:42 AM

you uninstall or remove the depends of thats module surely it will work.



--Borni DHIFI--
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 


Skype : dhifi.borni

On 5/20/13, 10:13 AM


In file data.xml all data are defined in a static way or relationships between class. so you can do :

<field name="amount_python_compute">your value amount</field>

to compute my payslip i need to have dynamic values and not static ... so i should do something like in the file data of the basic payroll (employee.marital)or ( contract.wage)..... Thank you

on 5/20/13, 1:42 PM

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.


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

0 follower(s)


Asked: 5/20/13, 9:33 AM
Seen: 1533 times
Last updated: 3/16/15, 8:10 AM