Skip to Content
Menu
This question has been flagged
2562 Views

i'm using odoo 9 and i want to override the function which calculate the due date . i want to modify the calcul in case i have a partial payment . I just found this function in account_invoice.py which calculate due date but when i override it it always the same result i don't want that odoo calculate automatically date due . Is there another function to use ? Any idea for help please, i'm blocked with this problem ?

@api.onchange('payment_term_id', 'date_invoice')
def _onchange_payment_term_date_invoice(self):
    date_invoice = self.date_invoice
    if not date_invoice:
        date_invoice = fields.Date.context_today(self)
    if not self.payment_term_id:
        # When no payment term defined
        self.date_due = self.date_due or self.date_invoice
    else:
        pterm = self.payment_term_id
        pterm_list = pterm.with_context(currency_id=self.company_id.currency_id.id).compute(value=1, date_ref=date_invoice)[0]
        self.date_due = max(line[0] for line in pterm_list) 
Avatar
Discard
Related Posts Replies Views Activity
1
Oct 21
3512
2
May 19
5105
2
May 19
7760
0
Feb 19
1666
0
Jan 19
2791