mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Update strings to prepare the arrival of SEPA Direct Debit XSD validation of the SEPA XML file is now really working Update views to 7.0-style Better error handling when Bank account in missing on the invoice.
This commit is contained in:
committed by
Dũng (Trần Đình)
parent
40a8ea5d3f
commit
cf1f0ee17b
@@ -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',
|
||||
|
||||
@@ -13,7 +13,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" />
|
||||
@@ -25,7 +25,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"/>
|
||||
@@ -57,7 +57,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>
|
||||
@@ -71,7 +71,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"
|
||||
|
||||
@@ -106,7 +106,7 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
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
|
||||
@@ -239,6 +239,8 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
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')
|
||||
@@ -255,7 +257,7 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
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')
|
||||
@@ -275,7 +277,8 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
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)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="name">banking.export.sepa.wizard.view</field>
|
||||
<field name="model">banking.export.sepa.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="SEPA XML file generation">
|
||||
<form string="SEPA XML file generation" version="7.0">
|
||||
<field name="state" invisible="True"/>
|
||||
<group states="create">
|
||||
<separator colspan="4" string="Processing details" />
|
||||
@@ -20,9 +20,6 @@
|
||||
<field name="charge_bearer" />
|
||||
<separator colspan="4" string="Reference for further communication" />
|
||||
<field name="msg_identification" required="True" />
|
||||
<newline />
|
||||
<button icon="gtk-close" special="cancel" string="Cancel" colspan="2"/>
|
||||
<button icon="gtk-ok" string="Generate" name="create_sepa" type="object" colspan="2"/>
|
||||
</group>
|
||||
<group states="finish">
|
||||
<field name="total_amount" />
|
||||
@@ -31,14 +28,16 @@
|
||||
Bug desc : in the Gtk client, you have to clic twice on the
|
||||
"Create" button.
|
||||
<field name="nb_transactions" /> -->
|
||||
<newline />
|
||||
<field name="file_id" />
|
||||
<!-- <field name="file_id" /> -->
|
||||
<field name="file" filename="filename" />
|
||||
<field name="filename" invisible="True"/>
|
||||
<newline />
|
||||
<button icon="gtk-cancel" string="Cancel" name="cancel_sepa" type="object" colspan="2"/>
|
||||
<button icon="gtk-ok" string="Validate" name="save_sepa" type="object" colspan="2"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Generate" name="create_sepa" type="object" class="oe_highlight" states="create"/>
|
||||
<button string="Cancel" special="cancel" class="oe_link" states="create"/>
|
||||
<button string="Validate" name="save_sepa" type="object" class="oe_highlight" states="finish"/>
|
||||
<button string="Cancel" name="cancel_sepa" type="object" class="oe_link" states="finish"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user