我正在使用odoo 9,并且我想覆盖定义到期日的功能。我的问题是我有部分付款(例如,对于我的付款条件,我有两种类型,即30J,15J ..或“ 50%提前+ 50%收货”),并且我希望每次更改发票日期根据我的上次付款日期。所以我重写了这个功能来满足我的需要,但是我在到期日字段中什么也没有。任何帮助的想法请??
@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