← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~therp-nl/banking-addons/6.1-sepa_fixes into lp:banking-addons/6.1

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/banking-addons/6.1-sepa_fixes into lp:banking-addons/6.1.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/6.1-sepa_fixes/+merge/186946

Backport of Alexis' fixes from https://code.launchpad.net/~akretion-team/banking-addons/70-fixes-and-enhancements/+merge/178398,

as well as https://code.launchpad.net/~therp-nl/banking-addons/ba70-payment_order_reconciliation_line_confusion/+merge/180590. 

Both have already been merged into 7.0, but I had to make some adaptations in both cases.


-- 
https://code.launchpad.net/~therp-nl/banking-addons/6.1-sepa_fixes/+merge/186946
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~therp-nl/banking-addons/6.1-sepa_fixes into lp:banking-addons/6.1.
=== modified file 'account_banking/security/ir.model.access.csv'
--- account_banking/security/ir.model.access.csv	2011-12-21 15:49:58 +0000
+++ account_banking/security/ir.model.access.csv	2013-09-22 19:59:17 +0000
@@ -4,4 +4,3 @@
 "access_account_banking_import","account.bankimport","model_account_banking_imported_file","account.group_account_user",1,1,1,1
 "access_payment_mode_type","payment.mode.type","model_payment_mode_type","account_payment.group_account_payment",1,1,1,1
 "access_banking_import_transaction","Banking addons - Bank import transaction","model_banking_import_transaction","account.group_account_user",1,1,1,1
-"access_banking_transaction_wizard","Banking addons - Transaction wizard","model_banking_transaction_wizard","account.group_account_user",1,1,1,1

=== modified file 'account_banking_sepa_credit_transfer/__openerp__.py'
--- account_banking_sepa_credit_transfer/__openerp__.py	2013-06-05 11:50:32 +0000
+++ account_banking_sepa_credit_transfer/__openerp__.py	2013-09-22 19:59:17 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 {
     'name': 'Account Banking SEPA Credit Transfer',
+    'summary': 'Create SEPA XML files for Credit Transfers',
     'version': '0.1',
     'license': 'AGPL-3',
     'author': 'Akretion',

=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa_view.xml'
--- account_banking_sepa_credit_transfer/account_banking_sepa_view.xml	2013-05-22 21:07:52 +0000
+++ account_banking_sepa_credit_transfer/account_banking_sepa_view.xml	2013-09-22 19:59:17 +0000
@@ -14,7 +14,7 @@
     <field name="arch" type="xml">
         <form string="SEPA Credit Transfer">
             <notebook>
-                <page string="General information">
+                <page string="General Information">
                     <field name="msg_identification" select="1" />
                     <field name="total_amount" />
                     <field name="nb_transactions" />
@@ -26,7 +26,7 @@
                     <field name="file" filename="filename"/>
                     <field name="filename" invisible="True"/>
                 </page>
-                <page string="Payment orders">
+                <page string="Payment Orders">
                     <field name="payment_order_ids" colspan="4" nolabel="1">
                         <tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment order">
                             <field name="reference"/>
@@ -59,7 +59,7 @@
 
 
 <record id="action_account_banking_sepa" model="ir.actions.act_window">
-    <field name="name">Generated SEPA XML files</field>
+    <field name="name">Generated SEPA Credit Transfer XML files</field>
     <field name="res_model">banking.export.sepa</field>
     <field name="view_type">form</field>
     <field name="view_mode">tree,form</field>
@@ -73,7 +73,7 @@
           />
 
 <act_window id="act_banking_export_sepa_payment_order"
-    name="Generated SEPA files"
+    name="Generated SEPA Credit Transfer files"
     domain="[('payment_order_ids', '=', active_id)]"
     res_model="banking.export.sepa"
     src_model="payment.order"

=== modified file 'account_banking_sepa_credit_transfer/wizard/export_sepa.py'
--- account_banking_sepa_credit_transfer/wizard/export_sepa.py	2013-06-06 08:04:29 +0000
+++ account_banking_sepa_credit_transfer/wizard/export_sepa.py	2013-09-22 19:59:17 +0000
@@ -107,7 +107,7 @@
         sepa_export = self.browse(cr, uid, ids[0], context=context)
 
         my_company_name = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.name
-        my_company_iban = self._validate_iban(cr, uid, sepa_export.payment_order_ids[0].mode.bank_id.iban, context=context)
+        my_company_iban = self._validate_iban(cr, uid, sepa_export.payment_order_ids[0].mode.bank_id.acc_number, context=context)
         my_company_bic = sepa_export.payment_order_ids[0].mode.bank_id.bank.bic
         #my_company_country_code = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.address[0].country_id.code
         #my_company_city = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.address[0].city
@@ -240,6 +240,8 @@
                 creditor_agent = etree.SubElement(credit_transfer_transaction_info, 'CdtrAgt')
                 creditor_agent_institution = etree.SubElement(creditor_agent, 'FinInstnId')
                 creditor_agent_bic = etree.SubElement(creditor_agent_institution, bic_xml_tag)
+                if not line.bank_id:
+                    raise orm.except_orm(_('Error :'), _("Missing Bank Account on invoice '%s' (payment order line reference '%s').") %(line.ml_inv_ref.number, line.name))
                 creditor_agent_bic.text = line.bank_id.bank.bic
                 creditor = etree.SubElement(credit_transfer_transaction_info, 'Cdtr')
                 creditor_name = etree.SubElement(creditor, 'Nm')
@@ -256,7 +258,7 @@
                 creditor_account = etree.SubElement(credit_transfer_transaction_info, 'CdtrAcct')
                 creditor_account_id = etree.SubElement(creditor_account, 'Id')
                 creditor_account_iban = etree.SubElement(creditor_account_id, 'IBAN')
-                creditor_account_iban.text = self._validate_iban(cr, uid, line.bank_id.iban, context=context)
+                creditor_account_iban.text = self._validate_iban(cr, uid, line.bank_id.acc_number, context=context)
                 remittance_info = etree.SubElement(credit_transfer_transaction_info, 'RmtInf')
                 # switch to Structured (Strdr) ? If we do it, beware that the format is not the same between pain 02 and pain 03
                 remittance_info_unstructured = etree.SubElement(remittance_info, 'Ustrd')
@@ -276,7 +278,8 @@
         official_pain_schema = etree.XMLSchema(etree.parse(tools.file_open('account_banking_sepa_credit_transfer/data/%s.xsd' % pain_flavor)))
 
         try:
-            official_pain_schema.validate(root)
+            root_to_validate = etree.fromstring(xml_string)
+            official_pain_schema.assertValid(root_to_validate)
         except Exception, e:
             _logger.warning("The XML file is invalid against the XML Schema Definition")
             _logger.warning(xml_string)

=== modified file 'account_direct_debit/model/account_payment.py'
--- account_direct_debit/model/account_payment.py	2013-01-21 11:30:46 +0000
+++ account_direct_debit/model/account_payment.py	2013-09-22 19:59:17 +0000
@@ -336,20 +336,20 @@
             payment_line_id = payment_line_id[0]
         reconcile_obj = self.pool.get('account.move.reconcile')
         move_line_obj = self.pool.get('account.move.line')
-        payment_line = self.browse(cr, uid, payment_line_id, context=context)
-
-        debit_move_line = payment_line.debit_move_line_id
-        torec_move_line = payment_line.move_line_id
-
-        if payment_line.storno:
+        payment_line_record = self.browse(cr, uid, payment_line_id, context=context)
+
+        debit_move_line = payment_line_record.debit_move_line_id
+        torec_move_line = payment_line_record.move_line_id
+
+        if payment_line_record.storno:
             raise osv.except_osv(
                 _('Can not reconcile'),
                 _('Cancelation of payment line \'%s\' has already been ' +
-                  'processed') % payment_line.name)
+                  'processed') % payment_line_record.name)
         if (not debit_move_line or not torec_move_line):
             raise osv.except_osv(
                 _('Can not reconcile'),
-                _('No move line for line %s') % payment_line.name)     
+                _('No move line for line %s') % payment_line_record.name)     
         if torec_move_line.reconcile_id: # torec_move_line.reconcile_partial_id:
             raise osv.except_osv(
                 _('Error'),
@@ -370,7 +370,7 @@
         line_ids = [debit_move_line.id, torec_move_line.id]
         if torec_move_line.reconcile_partial_id:
             line_ids = [
-                x.id for x in debit_move_line.reconcile_partial_id.line_partial_ids] + [torec_move_line_id]
+                x.id for x in torec_move_line.reconcile_partial_id.line_partial_ids] + [debit_move_line.id]
 
         total = move_line_obj.get_balance(cr, uid, line_ids)
         vals = {


Follow ups