[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
This commit is contained in:
Alexis de Lattre
2014-12-19 23:59:02 +01:00
committed by Pedro M. Baeza
parent f26c07bd77
commit 0e5aa6efb5
4 changed files with 130 additions and 107 deletions

View File

@@ -9,6 +9,7 @@
<field name="bank_id" ref="account_banking_payment_export.main_company_iban"/>
<field name="company_id" ref="base.main_company"/>
<field name="type" ref="export_sdd_008_001_02"/>
<field name="purchase_ok" eval="False"/>
</record>
<record id="base.main_company" model="res.company">
@@ -23,5 +24,13 @@
<field name="state">valid</field>
</record>
<record id="res_partner_2_mandate" model="account.banking.mandate">
<field name="partner_bank_id" ref="account_banking_payment_export.res_partner_2_iban"/>
<field name="type">recurrent</field>
<field name="recurrent_sequence_type">first</field>
<field name="signature_date" eval="time.strftime('%Y-%m-01')" />
<field name="state">valid</field>
</record>
</data>
</openerp>

View File

@@ -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'),

View File

@@ -5,114 +5,125 @@
The licence is in the file __openerp__.py
-->
<!--
Customize all mandate views (and actions) to fit SEPA mandate style
Customize all mandate views (and actions) to fit SEPA mandate style
-->
<openerp>
<data>
<record id="sdd_mandate_form" model="ir.ui.view">
<field name="name">sdd.mandate.form</field>
<field name="model">account.banking.mandate</field>
<field name="inherit_id" ref="account_banking_mandate.view_mandate_form"/>
<field name="arch" type="xml">
<data>
<field name="partner_id" position="after">
<field name="type"/>
<field name="recurrent_sequence_type" attrs="{'invisible': [('type', '=', 'oneoff')], 'required': [('type', '=', 'recurrent')]}"/>
<field name="scheme"/>
</field>
<field name="last_debit_date" position="after">
<field name="sepa_migrated" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
<field name="original_mandate_identification" attrs="{'invisible': [('sepa_migrated', '=', True)], 'required': [('sepa_migrated', '=', False)]}" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
</field>
</data>
</field>
</record>
<record id="sdd_mandate_tree" model="ir.ui.view">
<field name="name">sdd.mandate.tree</field>
<field name="model">account.banking.mandate</field>
<field name="inherit_id" ref="account_banking_mandate.view_mandate_tree"/>
<field name="arch" type="xml">
<field name="unique_mandate_reference" position="after">
<field name="type" string="Type"/>
</field>
</field>
</record>
<record id="sdd_mandate_search" model="ir.ui.view">
<field name="name">sdd.mandate.search</field>
<field name="model">account.banking.mandate</field>
<field name="inherit_id" ref="account_banking_mandate.view_mandate_search"/>
<field name="arch" type="xml">
<filter name="expired" position="after">
<filter name="oneoff" string="One-Off" domain="[('type', '=', 'oneoff')]" />
<filter name="recurrent" string="Recurrent" domain="[('type', '=', 'recurrent')]" />
</filter>
</field>
</record>
<record id="sdd_mandate_form" model="ir.ui.view">
<field name="name">sdd.mandate.form</field>
<field name="model">account.banking.mandate</field>
<field name="inherit_id" ref="account_banking_mandate.view_mandate_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="type"/>
<field name="recurrent_sequence_type" attrs="{'invisible': [('type', '=', 'oneoff')], 'required': [('type', '=', 'recurrent')]}"/>
<field name="scheme"/>
</field>
<field name="last_debit_date" position="after">
<field name="sepa_migrated" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
<field name="original_mandate_identification" attrs="{'invisible': [('sepa_migrated', '=', True)], 'required': [('sepa_migrated', '=', False)]}" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
</field>
</field>
</record>
<record id="mandate_action" model="ir.actions.act_window">
<field name="name">SEPA Direct Debit Mandates</field>
<field name="res_model">account.banking.mandate</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new SEPA Direct Debit Mandate.
</p><p>
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.
</p>
</field>
</record>
<record id="sdd_mandate_tree" model="ir.ui.view">
<field name="name">sdd.mandate.tree</field>
<field name="model">account.banking.mandate</field>
<field name="inherit_id" ref="account_banking_mandate.view_mandate_tree"/>
<field name="arch" type="xml">
<field name="unique_mandate_reference" position="after">
<field name="type" string="Type"/>
<field name="scheme"/>
<field name="recurrent_sequence_type" string="Sequence Type"/>
</field>
</field>
</record>
<menuitem id="account_banking_mandate.mandate_menu"
parent="account_payment.menu_main_payment"
action="mandate_action"
sequence="20"
/>
<record id="sdd_mandate_search" model="ir.ui.view">
<field name="name">sdd.mandate.search</field>
<field name="model">account.banking.mandate</field>
<field name="inherit_id" ref="account_banking_mandate.view_mandate_search"/>
<field name="arch" type="xml">
<filter name="expired" position="after">
<filter name="oneoff" string="One-Off" domain="[('type', '=', 'oneoff')]" />
<filter name="recurrent" string="Recurrent" domain="[('type', '=', 'recurrent')]" />
</filter>
<filter name="signature_date_groupby" position="before">
<filter name="type_groupby" string="Type"
context="{'group_by': 'type'}"/>
<filter name="scheme_groupby" string="Scheme"
context="{'group_by': 'scheme'}"/>
<filter name="recurrent_sequence_type_groupby"
string="Sequence Type"
context="{'group_by': 'recurrent_sequence_type'}"/>
</filter>
</field>
</record>
<record id="sdd_mandate_partner_bank_tree" model="ir.ui.view">
<field name="name">sdd.mandate.res.partner.bank.tree</field>
<field name="model">res.partner.bank</field>
<field name="inherit_id" ref="account_banking_mandate.mandate_partner_bank_tree"/>
<field name="arch" type="xml">
<field name="mandate_ids" position="attributes">
<attribute name="string">SDD Mandates</attribute>
</field>
</field>
</record>
<record id="mandate_action" model="ir.actions.act_window">
<field name="name">SEPA Direct Debit Mandates</field>
<field name="res_model">account.banking.mandate</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new SEPA Direct Debit Mandate.
</p><p>
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.
</p>
</field>
</record>
<record id="sdd_mandate_partner_form" model="ir.ui.view">
<field name="name">sdd.mandate.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account_banking_mandate.mandate_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='bank_ids']/tree/field[@name='mandate_ids']" position="attributes">
<attribute name="string">SDD Mandates</attribute>
</xpath>
</field>
</record>
<menuitem id="account_banking_mandate.mandate_menu"
parent="account_payment.menu_main_payment"
action="mandate_action"
sequence="20"
/>
<record id="recurrent_sequence_type_first" model="mail.message.subtype">
<field name="name">Sequence Type set to First</field>
<field name="res_model">account.banking.mandate</field>
<field name="default" eval="False"/>
<field name="description">Sequence Type set to First</field>
</record>
<record id="sdd_mandate_partner_bank_tree" model="ir.ui.view">
<field name="name">sdd.mandate.res.partner.bank.tree</field>
<field name="model">res.partner.bank</field>
<field name="inherit_id" ref="account_banking_mandate.mandate_partner_bank_tree"/>
<field name="arch" type="xml">
<field name="mandate_ids" position="attributes">
<attribute name="string">SDD Mandates</attribute>
</field>
</field>
</record>
<record id="recurrent_sequence_type_recurring" model="mail.message.subtype">
<field name="name">Sequence Type set to Recurring</field>
<field name="res_model">account.banking.mandate</field>
<field name="default" eval="False"/>
<field name="description">Sequence Type set to Recurring</field>
</record>
<record id="sdd_mandate_partner_form" model="ir.ui.view">
<field name="name">sdd.mandate.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account_banking_mandate.mandate_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='bank_ids']/tree/field[@name='mandate_ids']" position="attributes">
<attribute name="string">SDD Mandates</attribute>
</xpath>
</field>
</record>
<record id="recurrent_sequence_type_first" model="mail.message.subtype">
<field name="name">Sequence Type set to First</field>
<field name="res_model">account.banking.mandate</field>
<field name="default" eval="False"/>
<field name="description">Sequence Type set to First</field>
</record>
<record id="recurrent_sequence_type_recurring" model="mail.message.subtype">
<field name="name">Sequence Type set to Recurring</field>
<field name="res_model">account.banking.mandate</field>
<field name="default" eval="False"/>
<field name="description">Sequence Type set to Recurring</field>
</record>
<record id="recurrent_sequence_type_final" model="mail.message.subtype">
<field name="name">Sequence Type set to Final</field>
<field name="res_model">account.banking.mandate</field>
<field name="default" eval="False"/>
<field name="description">Sequence Type set to Final</field>
</record>
<record id="recurrent_sequence_type_final" model="mail.message.subtype">
<field name="name">Sequence Type set to Final</field>
<field name="res_model">account.banking.mandate</field>
<field name="default" eval="False"/>
<field name="description">Sequence Type set to Final</field>
</record>
</data>
</openerp>

View File

@@ -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: