mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MIG] account_payment_mode from v13 to v14
This commit is contained in:
committed by
Thomas Binsfeld
parent
300dc10f41
commit
c87ae71c55
@@ -1,9 +1,10 @@
|
||||
# © 2016 Akretion (<https://www.akretion.com>).
|
||||
# Copyright 2016-2020 Akretion France (<https://www.akretion.com>)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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"],
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<odoo>
|
||||
<record id="account_payment_mode_company_rule" model="ir.rule">
|
||||
<field
|
||||
name="domain_force"
|
||||
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -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"
|
||||
)
|
||||
@@ -1,4 +1,5 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016-2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016-2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016-2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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")
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<record id="account_payment_mode_company_rule" model="ir.rule">
|
||||
<field name="name">Payment mode multi-company rule</field>
|
||||
<field name="model_id" ref="model_account_payment_mode" />
|
||||
<field
|
||||
name="domain_force"
|
||||
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
|
||||
<field name="domain_force">
|
||||
['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<!-- FIX of the 'account' module: on the form view of a bank journal,
|
||||
allow to link to an existing bank account -->
|
||||
<record id="view_account_journal_form" model="ir.ui.view">
|
||||
<field name="name">fix_bank_account_selection.account_journal.form</field>
|
||||
<field name="name">usability.account_journal.form</field>
|
||||
<field name="model">account.journal</field>
|
||||
<field name="inherit_id" ref="account.view_account_journal_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="bank_account_id" position="before">
|
||||
<field name="company_partner_id" invisible="1" />
|
||||
</field>
|
||||
<field name="bank_account_id" position="attributes">
|
||||
<attribute
|
||||
name="domain"
|
||||
>[('partner_id', '=', company_partner_id)]</attribute>
|
||||
</field>
|
||||
<!-- better when related fields are readonly, otherwise the user
|
||||
doesn't understand that he is changing the bank_id on the underlying
|
||||
res.partner.bank object -->
|
||||
doesn't understand that he is changing the bank_id
|
||||
on the underlying res.partner.bank object -->
|
||||
<field name="bank_id" position="attributes">
|
||||
<attribute name="readonly">1</attribute>
|
||||
</field>
|
||||
|
||||
@@ -8,13 +8,21 @@ here. I hate the objects that don't have a view... -->
|
||||
<field name="model">account.payment.method</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment Method">
|
||||
<group name="main">
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
<field name="payment_type" />
|
||||
<field name="bank_account_required" />
|
||||
<field name="active" />
|
||||
</group>
|
||||
<sheet>
|
||||
<widget
|
||||
name="web_ribbon"
|
||||
title="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
/>
|
||||
<group name="main">
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
<field name="payment_type" />
|
||||
<field name="bank_account_required" />
|
||||
<field name="active" invisible="1" />
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -23,6 +31,7 @@ here. I hate the objects that don't have a view... -->
|
||||
<field name="model">account.payment.method</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle" />
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
<field name="payment_type" />
|
||||
|
||||
@@ -5,28 +5,36 @@
|
||||
<field name="model">account.payment.mode</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment Mode">
|
||||
<group name="main">
|
||||
<field name="name" />
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
<field name="active" />
|
||||
<field name="payment_method_id" />
|
||||
<field name="payment_type" />
|
||||
<field name="bank_account_link" />
|
||||
<field
|
||||
name="fixed_journal_id"
|
||||
attrs="{'invisible': [('bank_account_link', '!=', 'fixed')], 'required': [('bank_account_link', '=', 'fixed')]}"
|
||||
domain="[('company_id', '=', company_id), ('type', '=', 'bank')]"
|
||||
<sheet>
|
||||
<widget
|
||||
name="web_ribbon"
|
||||
title="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
/>
|
||||
<field
|
||||
name="variable_journal_ids"
|
||||
attrs="{'invisible': [('bank_account_link', '!=', 'variable')], 'required': [('bank_account_link', '=', 'variable')]}"
|
||||
domain="[('company_id', '=', company_id), ('type', '=', 'bank')]"
|
||||
widget="many2many_tags"
|
||||
/>
|
||||
</group>
|
||||
<group string="Note" name="note">
|
||||
<field name="note" nolabel="1" />
|
||||
</group>
|
||||
<group name="main">
|
||||
<field name="name" />
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
<field name="active" invisible="1" />
|
||||
<field name="payment_method_id" />
|
||||
<field name="payment_type" />
|
||||
<field name="bank_account_link" />
|
||||
<field
|
||||
name="fixed_journal_id"
|
||||
attrs="{'invisible': [('bank_account_link', '!=', 'fixed')], 'required': [('bank_account_link', '=', 'fixed')]}"
|
||||
domain="[('company_id', '=', company_id), ('type', '=', 'bank')]"
|
||||
/>
|
||||
<field
|
||||
name="variable_journal_ids"
|
||||
attrs="{'invisible': [('bank_account_link', '!=', 'variable')], 'required': [('bank_account_link', '=', 'variable')]}"
|
||||
domain="[('company_id', '=', company_id), ('type', '=', 'bank')]"
|
||||
widget="many2many_tags"
|
||||
/>
|
||||
</group>
|
||||
<group string="Note" name="note">
|
||||
<field name="note" nolabel="1" />
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<!-- Avoid creation of bank accounts linked to contacts.
|
||||
Note that, when you use the res.partner.bank menu entry,
|
||||
there is a domain on the 'partner_id' field of res.partner.bank (base module)
|
||||
which prevents the selection of a contact -->
|
||||
<record id="partner_view_buttons" model="ir.ui.view">
|
||||
<field name="name">account_payment_mode.res_partner_form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="account.partner_view_buttons" />
|
||||
<field name="arch" type="xml">
|
||||
<group name="banks" position="attributes">
|
||||
<attribute
|
||||
name="attrs"
|
||||
>{'invisible': [('parent_id', '!=', False), ('is_company', '=', False)]}</attribute>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<!-- Show acc_type on res.partner.bank in order to be able to
|
||||
detect wrong IBANs -->
|
||||
<record id="view_partner_bank_tree" model="ir.ui.view">
|
||||
<field name="name">account_payment_mode.res_partner_bank_tree</field>
|
||||
<field name="model">res.partner.bank</field>
|
||||
<field name="inherit_id" ref="base.view_partner_bank_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="acc_type" string="Bank Account Type" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user