diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 87e6a66740c..bf1da5cb71b 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -561,10 +561,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] diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 314e3423996..7f5fa9707c1 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -800,7 +800,7 @@ class account_move_line(osv.osv): r_id = move_rec_obj.create(cr, uid, { 'type': type, 'line_partial_ids': map(lambda x: (4,x,False), merges+unmerge) - }) + }, context=context) move_rec_obj.reconcile_partial_check(cr, uid, [r_id] + merges_rec, context=context) return True diff --git a/addons/account/edi/invoice.py b/addons/account/edi/invoice.py index 91913920bac..2c2a754de3b 100644 --- a/addons/account/edi/invoice.py +++ b/addons/account/edi/invoice.py @@ -266,7 +266,7 @@ class account_invoice(osv.osv, EDIMixin): params = { "cmd": "_xclick", "business": inv.company_id.paypal_account, - "item_name": inv.company_id.name + " Invoice " + inv.number, + "item_name": "%s Invoice %s" % (inv.company_id.name, inv.number or ''), "invoice": inv.number, "amount": inv.residual, "currency_code": inv.currency_id.name, diff --git a/addons/account/res_config.py b/addons/account/res_config.py index 89d238b16e9..8ab93c2fcbb 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -25,7 +25,7 @@ from dateutil.relativedelta import relativedelta from operator import itemgetter from os.path import join as opj -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT as DF +from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF from openerp.tools.translate import _ from openerp.osv import fields, osv from openerp import tools diff --git a/addons/account/test/account_bank_statement.yml b/addons/account/test/account_bank_statement.yml index 3711cff4d56..28828e0e3ea 100644 --- a/addons/account/test/account_bank_statement.yml +++ b/addons/account/test/account_bank_statement.yml @@ -67,9 +67,10 @@ Then I cancel Bank Statements and verifies that it raises a warning - !python {model: account.bank.statement}: | + from openerp.osv import osv try: self.button_cancel(cr, uid, [ref("account_bank_statement_0")]) assert False, "An exception should have been raised, the journal should not let us cancel moves!" - except Exception: + except osv.except_osv: # exception was raised as expected, as the journal does not allow cancelling moves pass diff --git a/addons/account/test/account_supplier_invoice.yml b/addons/account/test/account_supplier_invoice.yml index 02c3d367050..2232b8dc00e 100644 --- a/addons/account/test/account_supplier_invoice.yml +++ b/addons/account/test/account_supplier_invoice.yml @@ -73,14 +73,16 @@ I cancel the account move which is in posted state and verifies that it gives warning message - !python {model: account.move}: | + from openerp.osv import osv inv_obj = self.pool.get('account.invoice') inv = inv_obj.browse(cr, uid, ref('account_invoice_supplier0')) try: mov_cancel = self.button_cancel(cr, uid, [inv.move_id.id], {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'journal_type': 'purchase', 'active_ids': [ref('menu_action_invoice_tree2')], 'type': 'in_invoice', 'active_id': ref('menu_action_invoice_tree2')}) - except Exception, e: - assert e, 'Warning message has not been raised' + assert False, "This should never happen!" + except osv.except_osv: + pass - I verify that 'Period Sum' and 'Year sum' of the tax code are the expected values - diff --git a/addons/account/wizard/account_report_aged_partner_balance_view.xml b/addons/account/wizard/account_report_aged_partner_balance_view.xml index 77ebf02570f..be1d710c09d 100644 --- a/addons/account/wizard/account_report_aged_partner_balance_view.xml +++ b/addons/account/wizard/account_report_aged_partner_balance_view.xml @@ -11,7 +11,8 @@