Skip to Content
Menu
This question has been flagged
1 Reply
3054 Views

i'm using odoo 9 and i want to override the function that define the date due. My problem is that i have partial payment (for example for my payment condition i have 2 types either 30J,15J,.. or "50% advance+50% in the reception") and i want that date due of invoice change every time according to my last payment date.So i override this function to satisfy my needs but i got nothing in my date due field . Any idea for help please ??

 @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.payment_date
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 = self.payment_date


Avatar
Discard
Best Answer

Hello,

Is your method called, you can put a breakpoint in it to see whether it is called. To be called you need also to give it the same decorator, and trigger it by changing the payment term or the date_invoice.

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 21
3511
2
May 19
5103
2
May 19
7746
0
Feb 19
1665
0
Jan 19
2791