diff --git a/account_banking_mandate/__openerp__.py b/account_banking_mandate/__openerp__.py index b682c7518b79..ff310a76fbaf 100644 --- a/account_banking_mandate/__openerp__.py +++ b/account_banking_mandate/__openerp__.py @@ -40,6 +40,7 @@ 'views/account_payment_view.xml', 'views/res_partner_bank_view.xml', 'data/mandate_reference_sequence.xml', + 'security/mandate_security.xml', 'security/ir.model.access.csv', ], 'demo': [], diff --git a/account_banking_mandate/models/payment_line.py b/account_banking_mandate/models/payment_line.py index 6d02d1a895c7..9a176cf61075 100644 --- a/account_banking_mandate/models/payment_line.py +++ b/account_banking_mandate/models/payment_line.py @@ -31,7 +31,7 @@ class PaymentLine(models.Model): comodel_name='account.banking.mandate', string='Direct Debit Mandate', domain=[('state', '=', 'valid')]) - @api.multi + @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 @@ -40,12 +40,12 @@ def create(self, vals=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 (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): + 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, @@ -61,8 +61,8 @@ def create(self, vals=None): @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 != + 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 " diff --git a/account_banking_mandate/security/mandate_security.xml b/account_banking_mandate/security/mandate_security.xml new file mode 100644 index 000000000000..889413a84b12 --- /dev/null +++ b/account_banking_mandate/security/mandate_security.xml @@ -0,0 +1,19 @@ + + + + + + + + + Banking Mandate multi-company + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + + + diff --git a/account_banking_mandate/views/account_banking_mandate_view.xml b/account_banking_mandate/views/account_banking_mandate_view.xml index c1d1ed52c516..172eadbb3a91 100644 --- a/account_banking_mandate/views/account_banking_mandate_view.xml +++ b/account_banking_mandate/views/account_banking_mandate_view.xml @@ -6,117 +6,124 @@ --> - - view.mandate.form - account.banking.mandate - -
-
-
- -
-

- -

-
- - - - - - - - - - - -
-
- - -
-
-
-
- - view.mandate.tree - account.banking.mandate - - - - - - - - - - - - - view.mandate.search - account.banking.mandate - - - - - - - - - - + + view.mandate.form + account.banking.mandate + +
+
+
+ +
+

+ +

+
+ + + + + + + + + + + +
+
+ + +
+
+
+
- - Banking Mandates - account.banking.mandate - form - tree,form - -

- Click to create a new Banking Mandate. -

- A Banking Mandate is a document signed by your customer that gives you the autorization to do one or several operations on his bank account. -

-
-
+ + view.mandate.tree + account.banking.mandate + + + + + + + + + + + - + + view.mandate.search + account.banking.mandate + + + + + + + + + + + + + + - - - Mandate Validated - account.banking.mandate - - Banking Mandate Validated - + + Banking Mandates + account.banking.mandate + tree,form + +

+ Click to create a new Banking Mandate. +

+ A Banking Mandate is a document signed by your customer that gives you the autorization to do one or several operations on his bank account. +

+
+
+ + + + + + 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 + - - Mandate Expired - account.banking.mandate - - Banking Mandate has Expired - - - Mandate Cancelled - account.banking.mandate - - Banking Mandate Cancelled -