我正在尝试计算更改发票日期的到期日期,但它不起作用 def onchange_date_invoice(self,cr,uid,ids,type,partner_id,date_invoice=False,payment_term=False): partner_payment_term = False
raise osv.except_osv(_('OnChangeDateInvoice'), _('Start'))
if date_invoice != time.strftime('%Y-%m-%d'):
if not payment_term_id:
return {'value':{'date_due': date_invoice}}
pterm_list = self.pool.get('account.payment.term').compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice)
if payment_term != partner_payment_term:
if partner_payment_term:
to_update = self.onchange_payment_term_date_invoice(
cr, uid, ids, partner_payment_term, date_invoice)
result['value'].update(to_update['value'])
if pterm_list:
pterm_list = [line[0] for line in pterm_list]
pterm_list.sort()
result = {'value':{'date_due': pterm_list[-1]}}
else:
result['value']['date_due'] = False
raise osv.except_osv(_('OnChangeDateInvoice'), _('End'))
return result