diff options
| author | Amit Dodiya <ado@tinyerp.com> | 2013-03-21 10:57:24 +0530 |
|---|---|---|
| committer | Amit Dodiya <ado@tinyerp.com> | 2013-03-21 10:57:24 +0530 |
| commit | 61ba9cbd10d7c16655f89421843a08c33b43e4c8 (patch) | |
| tree | 774355a049e71b981e0fa240af7345f3454c8b71 /addons | |
| parent | 232840179cb6776445726695602b627ea22d00ab (diff) | |
[FIX] account_invoice: due date is reset to current date when we have no payment term and due date is manually defined
bzr revid: ado@tinyerp.com-20130321052724-ck8ly3e5leo6cd2a
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/account_invoice.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index b4705245268..d68f9786e21 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -539,10 +539,13 @@ class account_invoice(osv.osv): def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice): res = {} + inv_record = self.browse(cr, uid, ids) if not date_invoice: date_invoice = time.strftime('%Y-%m-%d') - if not payment_term_id: - return {'value':{'date_due': date_invoice}} #To make sure the invoice has a due date when no payment term + if not payment_term_id and inv_record.date_due: + return {'value':{'date_due': inv_record.date_due}} #To make sure the invoice due date should contain due date which is entered by user when there is no payment term defined + if not payment_term_id and not inv_record.date_due: + return {'value':{'date_due': date_invoice}} #To make sure that the invoice due date contain current date when there is no payment term and no due date defined pterm_list = self.pool.get('account.payment.term').compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) if pterm_list: pterm_list = [line[0] for line in pterm_list] |
