diff --git a/account_reconcile_compassion/model/bank_statement_line.py b/account_reconcile_compassion/model/bank_statement_line.py index 92f1e80c4..dc7561a67 100644 --- a/account_reconcile_compassion/model/bank_statement_line.py +++ b/account_reconcile_compassion/model/bank_statement_line.py @@ -143,7 +143,9 @@ def _create_invoice_from_mv_lines(self, mv_line_dicts, invoice=None): # Generate a unique bvr_reference ref = self.ref - if not ref or len(ref) < 26: + if ref and len(ref) > 27: + ref = mod10r(ref[:26]) + elif len(ref) < 26: ref = mod10r((self.date.replace('-', '') + str( self.statement_id.id) + str(self.id)).ljust(26, '0')) diff --git a/account_statement_completion_compassion/model/completion_rules.py b/account_statement_completion_compassion/model/completion_rules.py index a8babc92f..3ea1762cf 100644 --- a/account_statement_completion_compassion/model/completion_rules.py +++ b/account_statement_completion_compassion/model/completion_rules.py @@ -9,7 +9,7 @@ # ############################################################################## -from openerp import api, exceptions, models, fields +from openerp import api, models, fields from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF from openerp.addons.sponsorship_compassion.model.product import \ GIFT_CATEGORY, GIFT_NAMES @@ -221,8 +221,8 @@ def get_from_amount(self, st_line): def get_from_lsv_dd(self, st_line): """ If line is a LSV or DD credit, change the account to 1098. """ - label = st_line.ref.replace('\n', ' ') if st_line.ref != '/' else \ - st_line.name.replace('\n', ' ') + label = st_line.name.replace('\n', ' ') if st_line.name != '/' else \ + st_line.ref.replace('\n', ' ') lsv_dd_strings = [u'BULLETIN DE VERSEMENT ORANGE', u'ORDRE DEBIT DIRECT', u'Crèdit LSV'] @@ -260,12 +260,12 @@ def get_from_move_line_ref(self, st_line): def get_sponsor_name(self, st_line): res = {} - reference = st_line.ref + name = st_line.name sender_lines = [] - sender_lines.append(reference.replace('\n', ' ').split( + sender_lines.append(name.replace('\n', ' ').split( ' EXPÉDITEUR: '.decode('utf8'))) - sender_lines.append(reference.replace('\n', ' ').split( + sender_lines.append(name.replace('\n', ' ').split( " DONNEUR D'ORDRE: ".decode('utf8'))) id_line1 = 1 if len(sender_lines[0]) > 1 else False