diff options
| author | Rifakat <rha@tinyerp.com> | 2013-07-12 12:28:43 +0530 |
|---|---|---|
| committer | Rifakat <rha@tinyerp.com> | 2013-07-12 12:28:43 +0530 |
| commit | 475d2c6dec221bdf4c362a3dfa2ee8eafe320905 (patch) | |
| tree | 147a02f579078214ca4064f4e11954449ee98296 | |
| parent | d1a4e0aef08253c37879b44ddaa237c91cba8d85 (diff) | |
| parent | edcb556875774a8bd8f2844bf425236c7ad3d72b (diff) | |
[FIX] account: optimize code
bzr revid: rha@tinyerp.com-20130712065843-idr1urw86hf9zc8g
| -rw-r--r-- | addons/account/account_invoice.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 6201e9be162..9ff634a58d3 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -560,10 +560,14 @@ class account_invoice(osv.osv): def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice): res = {} + if isinstance(ids, (int, long)): + ids = [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 + inv = self.browse(cr, uid, ids[0]) + #To make sure the invoice due date should contain due date which is entered by user when there is no payment term defined + return {'value':{'date_due': inv.date_due and inv.date_due or date_invoice}} 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] |
