From fa4c820db1a1e085ce822afdd71d5456a59aced8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 30 Apr 2016 01:46:34 +0200 Subject: [PATCH] [MIG] account_banking_mandate: Migration to v9 --- account_banking_mandate/README.rst | 23 +++--- account_banking_mandate/__init__.py | 2 - account_banking_mandate/__openerp__.py | 12 +-- .../data/mandate_reference_sequence.xml | 5 -- account_banking_mandate/models/__init__.py | 8 +- .../models/account_banking_mandate.py | 73 ++++++++----------- .../models/account_invoice.py | 66 ++++++++++++++++- .../models/account_move_line.py | 22 ++++++ .../models/account_payment_line.py | 42 +++++++++++ .../models/account_payment_method.py | 14 ++++ .../models/bank_payment_line.py | 2 +- .../models/payment_line.py | 59 --------------- account_banking_mandate/models/res_partner.py | 23 ++++++ .../models/res_partner_bank.py | 4 +- .../security/ir.model.access.csv | 6 +- .../test/banking_mandate.yml | 1 - .../views/account_banking_mandate_view.xml | 27 +------ .../views/account_invoice_view.xml | 11 ++- .../views/account_move_line.xml | 26 +++++++ .../views/account_payment_line.xml | 37 ++++++++++ .../views/account_payment_method.xml | 20 +++++ .../views/account_payment_view.xml | 30 -------- .../views/bank_payment_line_view.xml | 14 ++-- account_banking_mandate/views/res_partner.xml | 26 +++++++ .../views/res_partner_bank_view.xml | 21 +----- 25 files changed, 352 insertions(+), 222 deletions(-) create mode 100644 account_banking_mandate/models/account_move_line.py create mode 100644 account_banking_mandate/models/account_payment_line.py create mode 100644 account_banking_mandate/models/account_payment_method.py delete mode 100644 account_banking_mandate/models/payment_line.py create mode 100644 account_banking_mandate/models/res_partner.py create mode 100644 account_banking_mandate/views/account_move_line.xml create mode 100644 account_banking_mandate/views/account_payment_line.xml create mode 100644 account_banking_mandate/views/account_payment_method.xml delete mode 100644 account_banking_mandate/views/account_payment_view.xml create mode 100644 account_banking_mandate/views/res_partner.xml diff --git a/account_banking_mandate/README.rst b/account_banking_mandate/README.rst index 48d7f74f7..0fb4974ec 100644 --- a/account_banking_mandate/README.rst +++ b/account_banking_mandate/README.rst @@ -1,6 +1,7 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 +======================= Account Banking Mandate ======================= @@ -31,22 +32,22 @@ Usage To use this module, see menu "Accounting > payment > SEPA direct debit mandates" -For further information, please visit: - - * https://www.odoo.com/forum/help-1 +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/173/9.0 Known issues / Roadmap ====================== * no known issues - + Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. Credits ======= @@ -54,11 +55,11 @@ Credits Contributors ------------ -* Alexis de Lattre +* Alexis de Lattre * Pedro M. Baeza * Alexandre Fayolle -* Stéphane Bidoul -* Sergio Teruel (Incaser) +* Stéphane Bidoul +* Sergio Teruel (Incaser) Maintainer ---------- diff --git a/account_banking_mandate/__init__.py b/account_banking_mandate/__init__.py index e5d6460e0..cde864bae 100644 --- a/account_banking_mandate/__init__.py +++ b/account_banking_mandate/__init__.py @@ -1,5 +1,3 @@ # -*- coding: utf-8 -*- -# © 2014 Compassion CH - Cyril Sester -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/account_banking_mandate/__openerp__.py b/account_banking_mandate/__openerp__.py index 991d617d9..864781e95 100644 --- a/account_banking_mandate/__openerp__.py +++ b/account_banking_mandate/__openerp__.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- # © 2014 Compassion CH - Cyril Sester # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# © 2015 Akretion - Alexis de Lattre +# © 2015-2016 Akretion - Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Account Banking Mandate', 'summary': 'Banking mandates', - 'version': '8.0.0.2.0', + 'version': '9.0.1.0.0', 'license': 'AGPL-3', 'author': "Compassion CH, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " @@ -16,19 +16,21 @@ 'website': 'https://github.com/OCA/bank-payment', 'category': 'Banking addons', 'depends': [ - 'account_banking_payment_export', + 'account_payment_order', ], 'data': [ 'views/account_banking_mandate_view.xml', + 'views/account_payment_method.xml', 'views/account_invoice_view.xml', - 'views/account_payment_view.xml', + 'views/account_payment_line.xml', 'views/res_partner_bank_view.xml', + 'views/res_partner.xml', 'views/bank_payment_line_view.xml', + 'views/account_move_line.xml', 'data/mandate_reference_sequence.xml', 'security/mandate_security.xml', 'security/ir.model.access.csv', ], - 'demo': [], 'test': ['test/banking_mandate.yml'], 'installable': True, } diff --git a/account_banking_mandate/data/mandate_reference_sequence.xml b/account_banking_mandate/data/mandate_reference_sequence.xml index 9a51db944..e3df03051 100644 --- a/account_banking_mandate/data/mandate_reference_sequence.xml +++ b/account_banking_mandate/data/mandate_reference_sequence.xml @@ -3,11 +3,6 @@ - - DD Mandate Reference - account.banking.mandate - - DD Mandate Reference account.banking.mandate diff --git a/account_banking_mandate/models/__init__.py b/account_banking_mandate/models/__init__.py index cb0da2fd5..145c8921a 100644 --- a/account_banking_mandate/models/__init__.py +++ b/account_banking_mandate/models/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# © 2014 Compassion CH - Cyril Sester -# © 2015 Akretion - Alexis de Lattre -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import account_banking_mandate +from . import account_payment_method from . import account_invoice from . import res_partner_bank -from . import payment_line +from . import res_partner +from . import account_payment_line from . import bank_payment_line +from . import account_move_line diff --git a/account_banking_mandate/models/account_banking_mandate.py b/account_banking_mandate/models/account_banking_mandate.py index 6c969ed00..cd5958d7c 100644 --- a/account_banking_mandate/models/account_banking_mandate.py +++ b/account_banking_mandate/models/account_banking_mandate.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- # © 2014 Compassion CH - Cyril Sester # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# © 2015 Akretion - Alexis de Lattre +# © 2015-2016 Akretion - Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields, exceptions, api, _ +from openerp import models, fields, api, _ +from openerp.exceptions import UserError, ValidationError class AccountBankingMandate(models.Model): @@ -17,30 +18,10 @@ class AccountBankingMandate(models.Model): _rec_name = 'unique_mandate_reference' _inherit = ['mail.thread'] _order = 'signature_date desc' - _track = { - 'state': { - 'account_banking_mandate.mandate_valid': ( - lambda self, cr, uid, obj, ctx=None: obj['state'] == 'valid'), - 'account_banking_mandate.mandate_expired': ( - lambda self, cr, uid, obj, ctx=None: - obj['state'] == 'expired'), - 'account_banking_mandate.mandate_cancel': ( - lambda self, cr, uid, obj, ctx=None: obj['state'] == 'cancel'), - }, - } - - def _get_states(self): - return [('draft', 'Draft'), - ('valid', 'Valid'), - ('expired', 'Expired'), - ('cancel', 'Cancelled')] format = fields.Selection( - [('basic', _('Basic Mandate'))], - default='basic', - required=True, - string='Mandate Format', - ) + [('basic', 'Basic Mandate')], default='basic', required=True, + string='Mandate Format', track_visibility='onchange') partner_bank_id = fields.Many2one( comodel_name='res.partner.bank', string='Bank Account', track_visibility='onchange') @@ -52,25 +33,28 @@ class AccountBankingMandate(models.Model): default=lambda self: self.env['res.company']._company_default_get( 'account.banking.mandate')) unique_mandate_reference = fields.Char( - string='Unique Mandate Reference', track_visibility='always', - default='/') + string='Unique Mandate Reference', track_visibility='onchange') signature_date = fields.Date(string='Date of Signature of the Mandate', track_visibility='onchange') scan = fields.Binary(string='Scan of the Mandate') last_debit_date = fields.Date(string='Date of the Last Debit', readonly=True) - state = fields.Selection( - _get_states, string='Status', default='draft', + state = fields.Selection([ + ('draft', 'Draft'), + ('valid', 'Valid'), + ('expired', 'Expired'), + ('cancel', 'Cancelled'), + ], string='Status', default='draft', track_visibility='onchange', help="Only valid mandates can be used in a payment line. A cancelled " - "mandate is a mandate that has been cancelled by the customer.") + "mandate is a mandate that has been cancelled by the customer.") payment_line_ids = fields.One2many( - comodel_name='payment.line', inverse_name='mandate_id', + comodel_name='account.payment.line', inverse_name='mandate_id', string="Related Payment Lines") _sql_constraints = [( 'mandate_ref_company_uniq', 'unique(unique_mandate_reference, company_id)', - 'A Mandate with the same reference already exists for this company !')] + 'A Mandate with the same reference already exists for this company!')] @api.multi @api.constrains('signature_date', 'last_debit_date') @@ -79,13 +63,13 @@ class AccountBankingMandate(models.Model): if (mandate.signature_date and mandate.signature_date > fields.Date.context_today( mandate)): - raise exceptions.Warning( + raise ValidationError( _("The date of signature of mandate '%s' " - "is in the future !") + "is in the future!") % mandate.unique_mandate_reference) if (mandate.signature_date and mandate.last_debit_date and mandate.signature_date > mandate.last_debit_date): - raise exceptions.Warning( + raise ValidationError( _("The mandate '%s' can't have a date of last debit " "before the date of signature." ) % mandate.unique_mandate_reference) @@ -96,20 +80,21 @@ class AccountBankingMandate(models.Model): for mandate in self: if mandate.state == 'valid': if not mandate.signature_date: - raise exceptions.Warning( + raise ValidationError( _("Cannot validate the mandate '%s' without a date of " "signature.") % mandate.unique_mandate_reference) if not mandate.partner_bank_id: - raise exceptions.Warning( + raise ValidationError( _("Cannot validate the mandate '%s' because it is not " "attached to a bank account.") % mandate.unique_mandate_reference) @api.model def create(self, vals=None): - if vals.get('unique_mandate_reference', '/') == '/': + if vals.get('unique_mandate_reference', 'New') == 'New': vals['unique_mandate_reference'] = \ - self.env['ir.sequence'].next_by_code('account.banking.mandate') + self.env['ir.sequence'].next_by_code( + 'account.banking.mandate') or 'New' return super(AccountBankingMandate, self).create(vals) @api.multi @@ -122,8 +107,8 @@ class AccountBankingMandate(models.Model): def validate(self): for mandate in self: if mandate.state != 'draft': - raise exceptions.Warning( - _('Mandate should be in draft state')) + raise UserError( + _('Mandate should be in draft state.')) self.write({'state': 'valid'}) return True @@ -131,8 +116,8 @@ class AccountBankingMandate(models.Model): def cancel(self): for mandate in self: if mandate.state not in ('draft', 'valid'): - raise exceptions.Warning( - _('Mandate should be in draft or valid state')) + raise UserError( + _('Mandate should be in draft or valid state.')) self.write({'state': 'cancel'}) return True @@ -143,7 +128,7 @@ class AccountBankingMandate(models.Model): """ for mandate in self: if mandate.state != 'cancel': - raise exceptions.Warning( - _('Mandate should be in cancel state')) + raise UserError( + _('Mandate should be in cancel state.')) self.write({'state': 'draft'}) return True diff --git a/account_banking_mandate/models/account_invoice.py b/account_banking_mandate/models/account_invoice.py index f5eb7f287..d821ee3e2 100644 --- a/account_banking_mandate/models/account_invoice.py +++ b/account_banking_mandate/models/account_invoice.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- # © 2014 Compassion CH - Cyril Sester # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# © 2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields +from openerp import models, fields, api class AccountInvoice(models.Model): @@ -12,5 +13,64 @@ class AccountInvoice(models.Model): mandate_id = fields.Many2one( 'account.banking.mandate', string='Direct Debit Mandate', - domain=[('state', '=', 'valid')], readonly=True, - states={'draft': [('readonly', False)]}) + ondelete='restrict', + readonly=True, states={'draft': [('readonly', False)]}) + mandate_required = fields.Boolean( + related='payment_mode_id.payment_method_id.mandate_required', + readonly=True) + + @api.model + def line_get_convert(self, line, part): + """Copy mandate from invoice to account move line""" + res = super(AccountInvoice, self).line_get_convert(line, part) + if line.get('type') == 'dest' and line.get('invoice_id'): + invoice = self.browse(line['invoice_id']) + if invoice.type in ('out_invoice', 'out_refund'): + res['mandate_id'] = invoice.mandate_id.id or False + return res + + # If a customer pays via direct debit, it's refunds should + # be deducted form the next debit by default. The module + # account_payment_partner copies payment_mode_id from invoice + # to refund, and we also need to copy mandate from invoice to refund + @api.model + def _prepare_refund( + self, invoice, date_invoice=None, date=None, description=None, + journal_id=None): + vals = super(AccountInvoice, self)._prepare_refund( + invoice, date_invoice=date_invoice, date=date, + description=description, journal_id=journal_id) + if invoice.type == 'out_invoice': + vals['mandate_id'] = invoice.mandate_id.id + return vals + + @api.onchange('partner_id', 'company_id') + def _onchange_partner_id(self): + """Select by default the first valid mandate of the partner""" + super(AccountInvoice, self)._onchange_partner_id() + if ( + self.type == 'out_invoice' and + self.partner_id.customer_payment_mode_id. + payment_type == 'inbound' and + self.partner_id.customer_payment_mode_id.payment_method_id. + mandate_required and + self.commercial_partner_id): + mandates = self.env['account.banking.mandate'].search([ + ('state', '=', 'valid'), + ('partner_id', '=', self.commercial_partner_id.id), + ]) + if mandates: + self.mandate_id = mandates[0] + else: + self.mandate_id = False + + @api.onchange('payment_mode_id') + def payment_mode_id_change(self): + super(AccountInvoice, self).payment_mode_id_change() + if ( + self.payment_mode_id and + self.payment_mode_id.payment_type == 'inbound' and + not self.payment_mode_id.payment_method_id.mandate_required): + self.mandate_id = False + elif not self.payment_mode_id: + self.mandate_id = False diff --git a/account_banking_mandate/models/account_move_line.py b/account_banking_mandate/models/account_move_line.py new file mode 100644 index 000000000..1ededbb6a --- /dev/null +++ b/account_banking_mandate/models/account_move_line.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (http://www.akretion.com/) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, fields, api + + +class AccountMoveLine(models.Model): + _inherit = 'account.move.line' + + mandate_id = fields.Many2one( + 'account.banking.mandate', string='Direct Debit Mandate', + ondelete='restrict') + + @api.multi + def _prepare_payment_line_vals(self, payment_order): + vals = super(AccountMoveLine, self)._prepare_payment_line_vals( + payment_order) + if payment_order.payment_type == 'inbound' and self.mandate_id: + vals['mandate_id'] = self.mandate_id.id + vals['partner_bank_id'] = self.mandate_id.partner_bank_id.id + return vals diff --git a/account_banking_mandate/models/account_payment_line.py b/account_banking_mandate/models/account_payment_line.py new file mode 100644 index 000000000..4650b2f98 --- /dev/null +++ b/account_banking_mandate/models/account_payment_line.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# © 2014 Compassion CH - Cyril Sester +# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# © 2015-2016 Akretion - Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, fields, api, _ +from openerp.exceptions import ValidationError, UserError + + +class AccountPaymentLine(models.Model): + _inherit = 'account.payment.line' + + mandate_id = fields.Many2one( + comodel_name='account.banking.mandate', string='Direct Debit Mandate', + domain=[('state', '=', 'valid')]) + mandate_required = fields.Boolean( + related='order_id.payment_method_id.mandate_required', readonly=True) + + @api.multi + @api.constrains('mandate_id', 'partner_bank_id') + def _check_mandate_bank_link(self): + for pline in self: + if (pline.mandate_id and pline.partner_bank_id and + pline.mandate_id.partner_bank_id != + pline.partner_bank_id): + raise ValidationError(_( + "The payment line number %s has the bank account " + "'%s' which is not attached to the mandate '%s' (this " + "mandate is attached to the bank account '%s').") % + (pline.name, + pline.partner_bank_id.acc_number, + pline.mandate_id.unique_mandate_reference, + pline.mandate_id.partner_bank_id.acc_number)) + + @api.multi + def draft2open_payment_line_check(self): + res = super(AccountPaymentLine, self).draft2open_payment_line_check() + if self.mandate_required and not self.mandate_id: + raise UserError(_( + 'Missing Mandate on payment line %s') % self.name) + return res diff --git a/account_banking_mandate/models/account_payment_method.py b/account_banking_mandate/models/account_payment_method.py new file mode 100644 index 000000000..884365210 --- /dev/null +++ b/account_banking_mandate/models/account_payment_method.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, fields + + +class AccountPaymentMethod(models.Model): + _inherit = "account.payment.method" + + mandate_required = fields.Boolean( + string='Mandate Required', + help="Activate this option if this payment method requires your " + "customer to sign a direct debit mandate with your company.") diff --git a/account_banking_mandate/models/bank_payment_line.py b/account_banking_mandate/models/bank_payment_line.py index 4952c17a0..8dd2cbdc8 100644 --- a/account_banking_mandate/models/bank_payment_line.py +++ b/account_banking_mandate/models/bank_payment_line.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # © 2014 Compassion CH - Cyril Sester # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# © 2015 Akretion - Alexis de Lattre +# © 2015-2016 Akretion - Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api diff --git a/account_banking_mandate/models/payment_line.py b/account_banking_mandate/models/payment_line.py deleted file mode 100644 index 96bd73f41..000000000 --- a/account_banking_mandate/models/payment_line.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2014 Compassion CH - Cyril Sester -# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# © 2015 Akretion - Alexis de Lattre -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp import models, fields, api, exceptions, _ - - -class PaymentLine(models.Model): - _inherit = 'payment.line' - - mandate_id = fields.Many2one( - comodel_name='account.banking.mandate', string='Direct Debit Mandate', - domain=[('state', '=', 'valid')]) - - @api.model - def create(self, vals=None): - """If the customer invoice has a mandate, take it - otherwise, take the first valid mandate of the bank account - """ - if vals is None: - vals = {} - partner_bank_id = vals.get('bank_id') - move_line_id = vals.get('move_line_id') - if (self.env.context.get('search_payment_order_type') == 'debit' and - 'mandate_id' not in vals): - if move_line_id: - line = self.env['account.move.line'].browse(move_line_id) - if (line.invoice and line.invoice.type == 'out_invoice' and - line.invoice.mandate_id): - vals.update({ - 'mandate_id': line.invoice.mandate_id.id, - 'bank_id': line.invoice.mandate_id.partner_bank_id.id, - }) - if partner_bank_id and 'mandate_id' not in vals: - mandates = self.env['account.banking.mandate'].search( - [('partner_bank_id', '=', partner_bank_id), - ('state', '=', 'valid')]) - if mandates: - vals['mandate_id'] = mandates[0].id - return super(PaymentLine, self).create(vals) - - @api.one - @api.constrains('mandate_id', 'bank_id') - def _check_mandate_bank_link(self): - if (self.mandate_id and self.bank_id and - self.mandate_id.partner_bank_id.id != - self.bank_id.id): - raise exceptions.Warning( - _("The payment line with reference '%s' has the bank account " - "'%s' which is not attached to the mandate '%s' (this " - "mandate is attached to the bank account '%s').") % - (self.name, - self.env['res.partner.bank'].name_get( - [self.bank_id.id])[0][1], - self.mandate_id.unique_mandate_reference, - self.env['res.partner.bank'].name_get( - [self.mandate_id.partner_bank_id.id])[0][1])) diff --git a/account_banking_mandate/models/res_partner.py b/account_banking_mandate/models/res_partner.py new file mode 100644 index 000000000..3c1fba967 --- /dev/null +++ b/account_banking_mandate/models/res_partner.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, fields, api + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + mandate_count = fields.Integer( + compute='_compute_mandate_count', string="Number of Mandates", + readonly=True) + + @api.multi + def _compute_mandate_count(self): + mandate_data = self.env['account.banking.mandate'].read_group( + [('partner_id', 'in', self.ids)], ['partner_id'], ['partner_id']) + mapped_data = dict([ + (mandate['partner_id'][0], mandate['partner_id_count']) + for mandate in mandate_data]) + for partner in self: + partner.mandate_count = mapped_data.get(partner.id, 0) diff --git a/account_banking_mandate/models/res_partner_bank.py b/account_banking_mandate/models/res_partner_bank.py index 119d3b4ff..028a1ddb8 100644 --- a/account_banking_mandate/models/res_partner_bank.py +++ b/account_banking_mandate/models/res_partner_bank.py @@ -12,5 +12,5 @@ class ResPartnerBank(models.Model): mandate_ids = fields.One2many( comodel_name='account.banking.mandate', inverse_name='partner_bank_id', string='Direct Debit Mandates', - help='Banking mandates represents an authorization that the bank ' - 'account owner gives to a company for a specific operation') + help='Banking mandates represent an authorization that the bank ' + 'account owner gives to a company for a specific operation.') diff --git a/account_banking_mandate/security/ir.model.access.csv b/account_banking_mandate/security/ir.model.access.csv index 07f07a3da..065258d42 100644 --- a/account_banking_mandate/security/ir.model.access.csv +++ b/account_banking_mandate/security/ir.model.access.csv @@ -1,3 +1,3 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_account_banking_mandate","Full access on account.banking.mandate","model_account_banking_mandate","account_payment.group_account_payment",1,1,1,1 -"access_account_banking_mandate_read","Read access on account.banking.mandate","model_account_banking_mandate","base.group_user",1,0,0,0 \ No newline at end of file +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_banking_mandate,Full access on account.banking.mandate,model_account_banking_mandate,account_payment_order.group_account_payment,1,1,1,1 +access_account_banking_mandate_read,Read access on account.banking.mandate,model_account_banking_mandate,base.group_user,1,0,0,0 diff --git a/account_banking_mandate/test/banking_mandate.yml b/account_banking_mandate/test/banking_mandate.yml index b1f33f51c..0d09698af 100644 --- a/account_banking_mandate/test/banking_mandate.yml +++ b/account_banking_mandate/test/banking_mandate.yml @@ -10,7 +10,6 @@ I create a partner bank account - !record {model: res.partner.bank, id: mandate_partner_bank, view: False}: - state: 'bank' acc_number: '1234' partner_id: mandate_partner - diff --git a/account_banking_mandate/views/account_banking_mandate_view.xml b/account_banking_mandate/views/account_banking_mandate_view.xml index f91c35bd3..682bdf076 100644 --- a/account_banking_mandate/views/account_banking_mandate_view.xml +++ b/account_banking_mandate/views/account_banking_mandate_view.xml @@ -81,6 +81,7 @@ + @@ -101,33 +102,11 @@ - - - Mandate Validated - account.banking.mandate - - Banking Mandate Validated - - - - Mandate Expired - account.banking.mandate - - Banking Mandate has Expired - - - - Mandate Cancelled - account.banking.mandate - - Banking Mandate Cancelled - - diff --git a/account_banking_mandate/views/account_invoice_view.xml b/account_banking_mandate/views/account_invoice_view.xml index a21e83857..1c1e46647 100644 --- a/account_banking_mandate/views/account_invoice_view.xml +++ b/account_banking_mandate/views/account_invoice_view.xml @@ -1,6 +1,6 @@ @@ -10,10 +10,13 @@ add.mandate.on.customer.invoice.form account.invoice - + - - + + + diff --git a/account_banking_mandate/views/account_move_line.xml b/account_banking_mandate/views/account_move_line.xml new file mode 100644 index 000000000..69d51471d --- /dev/null +++ b/account_banking_mandate/views/account_move_line.xml @@ -0,0 +1,26 @@ + + + + + + + + + account_banking_mandate.move_line_form + account.move.line + + + + + + + + + + + diff --git a/account_banking_mandate/views/account_payment_line.xml b/account_banking_mandate/views/account_payment_line.xml new file mode 100644 index 000000000..55f1c0297 --- /dev/null +++ b/account_banking_mandate/views/account_payment_line.xml @@ -0,0 +1,37 @@ + + + + + + + account_banking_mandate.account.payment.line.form + account.payment.line + + + + + + + + + + + account_banking_mandate.account.payment.line.tree + account.payment.line + + + + + + + + + + diff --git a/account_banking_mandate/views/account_payment_method.xml b/account_banking_mandate/views/account_payment_method.xml new file mode 100644 index 000000000..66744a970 --- /dev/null +++ b/account_banking_mandate/views/account_payment_method.xml @@ -0,0 +1,20 @@ + + + + + + + account_banking_mandate.account.payment.method.form + account.payment.method + + + + + + + + + + + diff --git a/account_banking_mandate/views/account_payment_view.xml b/account_banking_mandate/views/account_payment_view.xml deleted file mode 100644 index 9d2ced2cf..000000000 --- a/account_banking_mandate/views/account_payment_view.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - mandate.payment.order.form - payment.order - - - - - - - - - - - - - - diff --git a/account_banking_mandate/views/bank_payment_line_view.xml b/account_banking_mandate/views/bank_payment_line_view.xml index 25c8656e5..98ec669a1 100644 --- a/account_banking_mandate/views/bank_payment_line_view.xml +++ b/account_banking_mandate/views/bank_payment_line_view.xml @@ -1,6 +1,6 @@ @@ -10,11 +10,11 @@ banking.mandate.bank.payment.line.form bank.payment.line - + - + + invisible="context.get('default_payment_type')!='inbound'"/> @@ -22,11 +22,11 @@ banking.mandate.bank.payment.line.tree bank.payment.line - + - + + invisible="context.get('default_payment_type')!='inbound'"/> diff --git a/account_banking_mandate/views/res_partner.xml b/account_banking_mandate/views/res_partner.xml new file mode 100644 index 000000000..ea0d8a57f --- /dev/null +++ b/account_banking_mandate/views/res_partner.xml @@ -0,0 +1,26 @@ + + + + + + + mandate.res.partner.form + res.partner + + + + + + + + + + diff --git a/account_banking_mandate/views/res_partner_bank_view.xml b/account_banking_mandate/views/res_partner_bank_view.xml index 572fa766e..60f9cbce1 100644 --- a/account_banking_mandate/views/res_partner_bank_view.xml +++ b/account_banking_mandate/views/res_partner_bank_view.xml @@ -1,6 +1,6 @@ @@ -12,8 +12,8 @@ res.partner.bank - - + + @@ -26,23 +26,10 @@ - + - - - mandate.partner.form - res.partner - - - - - - - -