From c87ae71c55359926768fe0dfc973b469cea02017 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 16 Oct 2020 23:53:05 +0200 Subject: [PATCH] [MIG] account_payment_mode from v13 to v14 --- account_payment_mode/__manifest__.py | 7 ++- .../13.0.1.0.0/noupdate_changes.xml | 8 --- .../migrations/13.0.1.0.0/post-migration.py | 11 ---- .../models/account_journal.py | 3 +- .../models/account_payment_method.py | 5 +- .../models/account_payment_mode.py | 14 ++---- .../security/account_payment_mode.xml | 6 +-- .../security/ir.model.access.csv | 3 +- .../tests/test_account_payment_mode.py | 2 +- .../views/account_journal.xml | 16 ++---- .../views/account_payment_method.xml | 23 ++++++--- .../views/account_payment_mode.xml | 50 +++++++++++-------- account_payment_mode/views/res_partner.xml | 19 ------- .../views/res_partner_bank.xml | 15 ------ 14 files changed, 66 insertions(+), 116 deletions(-) delete mode 100644 account_payment_mode/migrations/13.0.1.0.0/noupdate_changes.xml delete mode 100644 account_payment_mode/migrations/13.0.1.0.0/post-migration.py delete mode 100644 account_payment_mode/views/res_partner.xml delete mode 100644 account_payment_mode/views/res_partner_bank.xml diff --git a/account_payment_mode/__manifest__.py b/account_payment_mode/__manifest__.py index 1d8191e68..ec9d4454c 100644 --- a/account_payment_mode/__manifest__.py +++ b/account_payment_mode/__manifest__.py @@ -1,9 +1,10 @@ -# © 2016 Akretion (). +# Copyright 2016-2020 Akretion France () +# @author: Alexis de Lattre # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Account Payment Mode", - "version": "13.0.1.1.2", + "version": "14.0.1.0.0", "development_status": "Production/Stable", "license": "AGPL-3", "author": "Akretion,Odoo Community Association (OCA)", @@ -15,8 +16,6 @@ "security/ir.model.access.csv", "views/account_payment_method.xml", "views/account_payment_mode.xml", - "views/res_partner_bank.xml", - "views/res_partner.xml", "views/account_journal.xml", ], "demo": ["demo/payment_demo.xml"], diff --git a/account_payment_mode/migrations/13.0.1.0.0/noupdate_changes.xml b/account_payment_mode/migrations/13.0.1.0.0/noupdate_changes.xml deleted file mode 100644 index 5b9125351..000000000 --- a/account_payment_mode/migrations/13.0.1.0.0/noupdate_changes.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - ['|',('company_id','=',False),('company_id','in',company_ids)] - - diff --git a/account_payment_mode/migrations/13.0.1.0.0/post-migration.py b/account_payment_mode/migrations/13.0.1.0.0/post-migration.py deleted file mode 100644 index cf2e5dae1..000000000 --- a/account_payment_mode/migrations/13.0.1.0.0/post-migration.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2020 Tecnativa - Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openupgradelib import openupgrade # pylint: disable=W7936 - - -@openupgrade.migrate() -def migrate(env, version): - openupgrade.load_data( - env.cr, "account_payment_mode", "migrations/13.0.1.0.0/noupdate_changes.xml" - ) diff --git a/account_payment_mode/models/account_journal.py b/account_payment_mode/models/account_journal.py index bfa43830d..526ccdb1d 100644 --- a/account_payment_mode/models/account_journal.py +++ b/account_payment_mode/models/account_journal.py @@ -1,4 +1,5 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, fields, models diff --git a/account_payment_mode/models/account_payment_method.py b/account_payment_mode/models/account_payment_method.py index 0baba0616..1b460eb54 100644 --- a/account_payment_mode/models/account_payment_method.py +++ b/account_payment_mode/models/account_payment_method.py @@ -1,4 +1,5 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models @@ -31,7 +32,7 @@ class AccountPaymentMethod(models.Model): result.append( ( method.id, - u"[{}] {} ({})".format( + "[{}] {} ({})".format( method.code, method.name, method.payment_type ), ) diff --git a/account_payment_mode/models/account_payment_mode.py b/account_payment_mode/models/account_payment_mode.py index c4c57f32e..903e18b1b 100644 --- a/account_payment_mode/models/account_payment_mode.py +++ b/account_payment_mode/models/account_payment_mode.py @@ -1,4 +1,5 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, fields, models @@ -41,8 +42,8 @@ class AccountPaymentMode(models.Model): domain=[("type", "=", "bank")], ondelete="restrict", ) - # I need to use the old definition, because I have 2 M2M fields - # pointing to account.journal + # I need to explicitly define the table name + # because I have 2 M2M fields pointing to account.journal variable_journal_ids = fields.Many2many( comodel_name="account.journal", relation="account_payment_mode_variable_journal_rel", @@ -55,7 +56,7 @@ class AccountPaymentMode(models.Model): string="Payment Method", required=True, ondelete="restrict", - ) # equivalent v8 field : type + ) payment_type = fields.Selection( related="payment_method_id.payment_type", readonly=True, store=True ) @@ -63,11 +64,6 @@ class AccountPaymentMode(models.Model): related="payment_method_id.code", readonly=True, store=True ) active = fields.Boolean(default=True) - # I dropped sale_ok and purchase_ok fields, because it is replaced by - # payment_type = 'inbound' or 'outbound' - # In fact, with the new v9 datamodel, you MUST create 2 payment modes - # for wire transfer : one for wire transfer from your customers (inbound) - # and one for wire transfer to your suppliers (outbound) note = fields.Text(translate=True) @api.onchange("company_id") diff --git a/account_payment_mode/security/account_payment_mode.xml b/account_payment_mode/security/account_payment_mode.xml index c5a63de19..be07dddff 100644 --- a/account_payment_mode/security/account_payment_mode.xml +++ b/account_payment_mode/security/account_payment_mode.xml @@ -3,8 +3,8 @@ Payment mode multi-company rule - ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + + ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + diff --git a/account_payment_mode/security/ir.model.access.csv b/account_payment_mode/security/ir.model.access.csv index 0ff4035ea..cdad149fd 100644 --- a/account_payment_mode/security/ir.model.access.csv +++ b/account_payment_mode/security/ir.model.access.csv @@ -1,5 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -account.access_account_payment_method,Read access on account.payment.method to Invoice user,account.model_account_payment_method,account.group_account_invoice,1,0,0,0 -access_account_payment_method_full,Full access on account.payment.method to Financial Manager,account.model_account_payment_method,account.group_account_manager,1,1,1,1 +account.access_account_payment_method,Full access on account.payment.method to Financial Manager,account.model_account_payment_method,account.group_account_manager,1,1,1,1 access_account_payment_mode_read,Read access on account.payment.mode to Employees,model_account_payment_mode,base.group_user,1,0,0,0 access_account_payment_mode_full,Full access on account.payment.mode to Financial Manager,model_account_payment_mode,account.group_account_manager,1,1,1,1 diff --git a/account_payment_mode/tests/test_account_payment_mode.py b/account_payment_mode/tests/test_account_payment_mode.py index 30eb71b4e..56fc3c839 100644 --- a/account_payment_mode/tests/test_account_payment_mode.py +++ b/account_payment_mode/tests/test_account_payment_mode.py @@ -1,4 +1,4 @@ -# © 2016 ForgeFlow S.L. +# Copyright 2016-2020 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo.exceptions import ValidationError diff --git a/account_payment_mode/views/account_journal.xml b/account_payment_mode/views/account_journal.xml index c91004754..713284914 100644 --- a/account_payment_mode/views/account_journal.xml +++ b/account_payment_mode/views/account_journal.xml @@ -1,23 +1,13 @@ - - fix_bank_account_selection.account_journal.form + usability.account_journal.form account.journal - - - - - [('partner_id', '=', company_partner_id)] - + doesn't understand that he is changing the bank_id + on the underlying res.partner.bank object --> 1 diff --git a/account_payment_mode/views/account_payment_method.xml b/account_payment_mode/views/account_payment_method.xml index 47e70d4c6..b96d5a22b 100644 --- a/account_payment_mode/views/account_payment_method.xml +++ b/account_payment_mode/views/account_payment_method.xml @@ -8,13 +8,21 @@ here. I hate the objects that don't have a view... --> account.payment.method
- - - - - - - + + + + + + + + + +
@@ -23,6 +31,7 @@ here. I hate the objects that don't have a view... --> account.payment.method + diff --git a/account_payment_mode/views/account_payment_mode.xml b/account_payment_mode/views/account_payment_mode.xml index d83ca15c7..b8ae7d98c 100644 --- a/account_payment_mode/views/account_payment_mode.xml +++ b/account_payment_mode/views/account_payment_mode.xml @@ -5,28 +5,36 @@ account.payment.mode
- - - - - - - - + - - - - - + + + + + + + + + + + + + +
diff --git a/account_payment_mode/views/res_partner.xml b/account_payment_mode/views/res_partner.xml deleted file mode 100644 index 6fdd88b76..000000000 --- a/account_payment_mode/views/res_partner.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - account_payment_mode.res_partner_form - res.partner - - - - {'invisible': [('parent_id', '!=', False), ('is_company', '=', False)]} - - - - diff --git a/account_payment_mode/views/res_partner_bank.xml b/account_payment_mode/views/res_partner_bank.xml deleted file mode 100644 index a3ce48b6d..000000000 --- a/account_payment_mode/views/res_partner_bank.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - account_payment_mode.res_partner_bank_tree - res.partner.bank - - - - - - - -