Odoo Help


No action on function calling?

on 5/24/13, 7:25 AM 1,978 views

I created a function in account_invoice.py to check whether the due date is over and if yes then add 2% of the amount_total/balance to the amount_to be paid. I tried this code in account_payment.account_invoice and created an automated action too but there is no error and result. Why am i missing something? here is the code and the xml on which i tried calling this function.

def check_penalty(self, cr, uid, ids,context):
        '''Return the amount still to pay regarding all the payment orders'''
        if not ids:
            return {}
        res = {}
        for invoice in self.browse(cr, uid, ids, context=context):
            res[invoice.id] = 0.0
            if invoice.date_due or \
                            datetime.strptime(invoice.date_invoice, '%Y-%m-%d') \
                            >= datetime.strptime(invoice.date_due, '%Y-%m-%d'):
                res[invoice.id][residual]+= invoice.residual * 0.02
                self.write(cr, uid, ids, {'residual':'resudual'}, context=context)       
        return res


<button name="check_penalty" string="Penalty" type="object" icon="gtk-ok"/>

The comment for this methid is not completely correct. You are returning the amount to pay per order, not one big amount for all open orders, which I would expect given your comment.

on 6/2/13, 7:39 PM



| 5 4 7
Baarn, Netherlands
On 5/24/13, 7:50 PM

Just checking everything went OK:

Steps to take when modify code / XML:

  • copy files to /addons/ directory
  • restart openERP server (or reboot computer), to let openERP see the changed code
  • within openERP, reload the modules
  • within openERP, search for installed module, select it, and click on upgrade. This will reload the XML file, so the changed/added button is functional.

If the above steps have been done, and you still encounter, issues, let us know.

I know how to upgrade when required and i did the same but my question is that i don't get an error there but there is no output also on the button so i am asking whether the code is correct or i missed something.

on 5/27/13, 3:05 AM

In that case, what does the logging file tell you, when you press the button? By default, the log file on Linux: /var/log/openerp/openerp-server.log

on 6/2/13, 7:37 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/24/13, 7:25 AM
Seen: 1978 times
Last updated: 3/16/15, 8:10 AM