diff --git a/account_banking/__terp__.py b/account_banking/__terp__.py index c5844274f..2e96a0ff6 100644 --- a/account_banking/__terp__.py +++ b/account_banking/__terp__.py @@ -25,7 +25,7 @@ ############################################################################## { 'name': 'Account Banking', - 'version': '0.1.58', + 'version': '0.1.59', 'license': 'GPL-3', 'author': 'EduSense BV', 'website': 'http://www.edusense.nl', diff --git a/account_banking/account_banking.py b/account_banking/account_banking.py index ab72cbf12..a23fb7b12 100644 --- a/account_banking/account_banking.py +++ b/account_banking/account_banking.py @@ -890,6 +890,8 @@ class payment_order(osv.osv): to the absence of filters on writes and hence the requirement to filter on the client(=OpenERP server) side. ''' + if not hasattr(ids, '__iter__'): + ids = [ids] payment_line_obj = self.pool.get('payment.line') line_ids = payment_line_obj.search( cursor, uid, [ @@ -911,7 +913,6 @@ class payment_order(osv.osv): Set both self and payment lines to state 'sent'. ''' self._write_payment_lines(cursor, uid, ids, export_state='sent') - self.write(cursor, uid, ids, {'state': 'rejected'}) wf_service = netsvc.LocalService('workflow') for id in ids: wf_service.trg_validate(uid, 'payment.order', id, 'sent', cursor) @@ -922,22 +923,21 @@ class payment_order(osv.osv): Set both self and payment lines to state 'rejected'. ''' self._write_payment_lines(cursor, uid, ids, export_state='rejected') - self.write(cursor, uid, ids, {'state': 'rejected'}) wf_service = netsvc.LocalService('workflow') for id in ids: wf_service.trg_validate(uid, 'payment.order', id, 'rejected', cursor) return True - def set_done(self, cursor, uid, id, *args): + def set_done(self, cursor, uid, ids, *args): ''' Extend standard transition to update children as well. ''' - self._write_payment_lines(cursor, uid, [id], + self._write_payment_lines(cursor, uid, ids, export_state='done', date_done=time.strftime('%Y-%m-%d') ) return super(payment_order, self).set_done( - cursor, uid, id, *args + cursor, uid, ids, *args ) def get_wizard(self, type): @@ -1188,14 +1188,21 @@ class res_partner_bank(osv.osv): elif partner_id: partner_obj = self.pool.get('res.partner') country = partner_obj.browse(cursor, uid, partner_id).country - country_ids = [country.id] + country_ids = country and [country.id] or [] # 4. Without any of the above, take the country from the company of # the handling user if not country_ids: user = self.pool.get('res.users').browse(cursor, uid, uid) + # Try users address first if user.address_id and user.address_id.country_id: country = user.address_id.country_id country_ids = [country.id] + # Last try user companies partner + elif (user.company_id and + user.company_id.partner_id and + user.company_id.partner_id.country + ): + country_ids = [user.company_id.partner_id.country.id] else: # Ok, tried everything, give up and leave it to the user return warning(_('Insufficient data'), diff --git a/account_banking/sepa/online.py b/account_banking/sepa/online.py index c5a7ecef8..3cd298143 100644 --- a/account_banking/sepa/online.py +++ b/account_banking/sepa/online.py @@ -131,10 +131,13 @@ def BBAN_is_IBAN(bank_acc): else: iban_acc = IBAN(bank_acc) return struct( + iban = str(iban_acc), account = str(bank_acc), country_id = iban_acc.countrycode, code = iban_acc.BIC_searchkey # Note: BIC can not be constructed here! + bic = False, + bank = False, ) _account_info = { diff --git a/account_banking/wizard/bank_import.py b/account_banking/wizard/bank_import.py index b173ff449..cf297e001 100644 --- a/account_banking/wizard/bank_import.py +++ b/account_banking/wizard/bank_import.py @@ -753,6 +753,8 @@ class banking_import(wizard.interface): results.log) if not period_id: results.trans_skipped_cnt += 1 + if not injected: + i += 1 continue # When bank costs are part of transaction itself, split it. @@ -922,7 +924,7 @@ class banking_import(wizard.interface): "AND id IN (%s)" ")" % (','.join([str(x) for x in payment_line_ids])) ) - order_ids = cursor.fetchall() + order_ids = [x[0] for x in cursor.fetchall()] if order_ids: # Use workflow logics for the orders. Recode logic from # account_payment, in order to increase efficiency. diff --git a/account_banking/wizard/banktools.py b/account_banking/wizard/banktools.py index af2cc31a7..585149e2a 100644 --- a/account_banking/wizard/banktools.py +++ b/account_banking/wizard/banktools.py @@ -148,16 +148,23 @@ def get_or_create_partner(pool, cursor, uid, name, address, postal_code, city, address_ids = address_obj.search(cursor, uid, filter) key = name.lower() - partner_ids = [x.partner_id.id + # Make sure to get a unique list + partner_ids = list(set([x.partner_id.id for x in address_obj.browse(cursor, uid, address_ids) # Beware for dangling addresses if _has_attr(x.partner_id, 'name') and x.partner_id.name.lower() in key - ] + ])) if not partner_ids: if (not country_code) or not country_id: - country_id = pool.get('res.user').browse(cursor, uid, uid)\ - .company_id.partner_id.country.id + user = pool.get('res.user').browse(cursor, uid, uid) + country_id = ( + user.company_id and + user.company_id.partner_id and + user.company_id.partner_id.country and + user.company_id.partner_id.country.id or + False + ) partner_id = partner_obj.create(cursor, uid, dict( name=name, active=True, comment='Generated from Bank Statements Import', address=[(0,0,{ diff --git a/account_banking_fi_patu/__terp__.py b/account_banking_fi_patu/__terp__.py index 73a7565a1..96bbdd0aa 100644 --- a/account_banking_fi_patu/__terp__.py +++ b/account_banking_fi_patu/__terp__.py @@ -26,7 +26,7 @@ ############################################################################## { 'name': 'Account Banking PATU module', - 'version': '0.58', + 'version': '0.59', 'license': 'GPL-3', 'author': 'Sami Haahtinen', 'website': 'http://ressukka.net', diff --git a/account_banking_nl_clieop/__terp__.py b/account_banking_nl_clieop/__terp__.py index 49310c0b7..649353bed 100644 --- a/account_banking_nl_clieop/__terp__.py +++ b/account_banking_nl_clieop/__terp__.py @@ -25,7 +25,7 @@ ############################################################################## { 'name': 'Account Banking NL ClieOp', - 'version': '0.58', + 'version': '0.59', 'license': 'GPL-3', 'author': 'EduSense BV', 'website': 'http://www.edusense.nl', diff --git a/account_banking_nl_girotel/__terp__.py b/account_banking_nl_girotel/__terp__.py index d8e4c44c2..ef7520b67 100644 --- a/account_banking_nl_girotel/__terp__.py +++ b/account_banking_nl_girotel/__terp__.py @@ -25,7 +25,7 @@ ############################################################################## { 'name': 'Account Banking - Girotel', - 'version': '0.58', + 'version': '0.59', 'license': 'GPL-3', 'author': 'EduSense BV', 'website': 'http://www.edusense.nl', diff --git a/account_banking_nl_multibank/__terp__.py b/account_banking_nl_multibank/__terp__.py index 8298f4fa9..f7436f201 100644 --- a/account_banking_nl_multibank/__terp__.py +++ b/account_banking_nl_multibank/__terp__.py @@ -25,7 +25,7 @@ ############################################################################## { 'name': 'Account Banking', - 'version': '0.58', + 'version': '0.59', 'license': 'GPL-3', 'author': 'EduSense BV', 'website': 'http://www.edusense.nl',