From 0e5aa6efb55b185477b559e7c7ad7fc4cdae5a87 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 19 Dec 2014 23:59:02 +0100 Subject: [PATCH] [IMP] account_banking_sepa_direct_debit: 5 things: * Transfer move: one transfer move for each payment.order with only 1 line in the transfer account for the total of the account move. Move the inherit of the 'Invoice' button of payment.order from account_banking_payment_transfer to account_banking_payment_export Demo data: Add a bank account + mandate on Agrolait, to be able to easily test multi-partner SEPA DD * mandates: search by reference, add group_by, add seq type in tree view * Add scheme in mandate tree+search view Replace tabs by spaces in mandate views account_banking_mandate/views/account_banking_mandate_view.xml: convert from dos to unix format * Add sale_ok and purchase_ok filters in partner/sale/purchase form views Use widget=selection for payment_mode_id fields Update demo data * Limit lenght of mandate reference, according to ISO 20022 --- .../demo/sepa_direct_debit_demo.xml | 9 + .../models/account_banking_mandate.py | 21 +- .../views/account_banking_mandate_view.xml | 203 +++++++++--------- .../wizard/export_sdd.py | 4 +- 4 files changed, 130 insertions(+), 107 deletions(-) diff --git a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml index 041082d76..51a24bad1 100644 --- a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml +++ b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml @@ -9,6 +9,7 @@ + @@ -23,5 +24,13 @@ valid + + + recurrent + first + + valid + + diff --git a/account_banking_sepa_direct_debit/models/account_banking_mandate.py b/account_banking_sepa_direct_debit/models/account_banking_mandate.py index 4df706378..56b4c870d 100644 --- a/account_banking_sepa_direct_debit/models/account_banking_mandate.py +++ b/account_banking_sepa_direct_debit/models/account_banking_mandate.py @@ -70,18 +70,20 @@ class AccountBankingMandate(models.Model): "active.", default=True) original_mandate_identification = fields.Char( string='Original Mandate Identification', track_visibility='onchange', + size=35, help="When the field 'Migrated to SEPA' is not active, this field " "will be used as the Original Mandate Identification in the " "Direct Debit file.") scheme = fields.Selection([('CORE', 'Basic (CORE)'), ('B2B', 'Enterprise (B2B)')], string='Scheme', required=True, default="CORE") + unique_mandate_reference = fields.Char(size=35) # cf ISO 20022 @api.one @api.constrains('type', 'recurrent_sequence_type') def _check_recurring_type(self): - if (self.type == 'recurrent' - and not self.recurrent_sequence_type): + if (self.type == 'recurrent' and + not self.recurrent_sequence_type): raise exceptions.Warning( _("The recurrent mandate '%s' must have a sequence type.") % self.unique_mandate_reference) @@ -89,8 +91,8 @@ class AccountBankingMandate(models.Model): @api.one @api.constrains('type', 'recurrent_sequence_type', 'sepa_migrated') def _check_migrated_to_sepa(self): - if (self.type == 'recurrent' and not self.sepa_migrated - and self.recurrent_sequence_type != 'first'): + if (self.type == 'recurrent' and not self.sepa_migrated and + self.recurrent_sequence_type != 'first'): raise exceptions.Warning( _("The recurrent mandate '%s' which is not marked as " "'Migrated to SEPA' must have its recurrent sequence type " @@ -99,8 +101,8 @@ class AccountBankingMandate(models.Model): @api.one @api.constrains('type', 'original_mandate_identification', 'sepa_migrated') def _check_original_mandate_identification(self): - if (self.type == 'recurrent' and not self.sepa_migrated - and not self.original_mandate_identification): + if (self.type == 'recurrent' and not self.sepa_migrated and + not self.original_mandate_identification): raise exceptions.Warning( _("You must set the 'Original Mandate Identification' on the " "recurrent mandate '%s' which is not marked as 'Migrated to " @@ -111,9 +113,10 @@ class AccountBankingMandate(models.Model): def mandate_partner_bank_change(self): super(AccountBankingMandate, self).mandate_partner_bank_change() res = {} - if (self.state == 'valid' and self.partner_bank_id - and self.type == 'recurrent' - and self.recurrent_sequence_type != 'first'): + if (self.state == 'valid' and + self.partner_bank_id and + self.type == 'recurrent' and + self.recurrent_sequence_type != 'first'): self.recurrent_sequence_type = 'first' res['warning'] = { 'title': _('Mandate update'), diff --git a/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml b/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml index a2065dc75..366edfaf8 100644 --- a/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml +++ b/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml @@ -5,114 +5,125 @@ The licence is in the file __openerp__.py --> - - sdd.mandate.form - account.banking.mandate - - - - - - - - - - - - - - - - - sdd.mandate.tree - account.banking.mandate - - - - - - - - - sdd.mandate.search - account.banking.mandate - - - - - - - - + + sdd.mandate.form + account.banking.mandate + + + + + + + + + + + + + - - SEPA Direct Debit Mandates - account.banking.mandate - form - tree,form - -

- Click to create a new SEPA Direct Debit Mandate. -

- A SEPA Direct Debit Mandate is a document signed by your customer that gives you the autorization to do one or several direct debits on his bank account. -

-
-
+ + sdd.mandate.tree + account.banking.mandate + + + + + + + + + - + + sdd.mandate.search + account.banking.mandate + + + + + + + + + + + + + - - sdd.mandate.res.partner.bank.tree - res.partner.bank - - - - SDD Mandates - - - + + SEPA Direct Debit Mandates + account.banking.mandate + tree,form + +

+ Click to create a new SEPA Direct Debit Mandate. +

+ A SEPA Direct Debit Mandate is a document signed by your customer that gives you the autorization to do one or several direct debits on his bank account. +

+
+
- - sdd.mandate.partner.form - res.partner - - - - SDD Mandates - - - + - - Sequence Type set to First - account.banking.mandate - - Sequence Type set to First - + + sdd.mandate.res.partner.bank.tree + res.partner.bank + + + + SDD Mandates + + + - - Sequence Type set to Recurring - account.banking.mandate - - Sequence Type set to Recurring - + + sdd.mandate.partner.form + res.partner + + + + SDD Mandates + + + + + + Sequence Type set to First + account.banking.mandate + + Sequence Type set to First + + + + Sequence Type set to Recurring + account.banking.mandate + + Sequence Type set to Recurring + + + + Sequence Type set to Final + account.banking.mandate + + Sequence Type set to Final + - - Sequence Type set to Final - account.banking.mandate - - Sequence Type set to Final -
diff --git a/account_banking_sepa_direct_debit/wizard/export_sdd.py b/account_banking_sepa_direct_debit/wizard/export_sdd.py index aa46ff8b1..2fffdda65 100644 --- a/account_banking_sepa_direct_debit/wizard/export_sdd.py +++ b/account_banking_sepa_direct_debit/wizard/export_sdd.py @@ -103,8 +103,8 @@ class BankingExportSddWizard(orm.TransientModel): previous_payline_id = False for older_line in older_lines: older_line_date_sent = older_line.order_id.date_sent - if (older_line_date_sent - and older_line_date_sent > previous_date): + if (older_line_date_sent and + older_line_date_sent > previous_date): previous_date = older_line_date_sent previous_payline_id = older_line.id if previous_payline_id: