Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] account_payment_mode_default_account: Migration to 15.0 #1349

Open
wants to merge 9 commits into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions account_payment_mode_default_account/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
====================================
Account Payment Mode Default Account
====================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5e6b935d02be3e279b161f28ed160f6a00ed4275cf053a5165a1e72435bbc874
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
:target: https://github.com/OCA/bank-payment/tree/15.0/account_payment_mode_default_account
:alt: OCA/bank-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_payment_mode_default_account
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to define default receivable and payable accounts
on payment mode to override the account selected on the customer
when computing payment terms lines on invoices.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_mode_default_account%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Camptocamp

Contributors
~~~~~~~~~~~~

* Akim Juillerat <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/15.0/account_payment_mode_default_account>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions account_payment_mode_default_account/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook, uninstall_hook
19 changes: 19 additions & 0 deletions account_payment_mode_default_account/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Account Payment Mode Default Account",
"summary": "Set Receivable or Payable account according to payment mode",
"version": "15.0.1.0.0",
"category": "Accounting/Accounting",
"website": "https://github.com/OCA/bank-payment",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
"account_payment_partner",
],
"data": [
"views/account_payment_mode.xml",
],
"post_init_hook": "post_init_hook",
"uninstall_hook": "uninstall_hook",
}
39 changes: 39 additions & 0 deletions account_payment_mode_default_account/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
fields_mapping = [
("property_account_receivable_id", "property_stored_account_receivable_id"),
("property_account_payable_id", "property_stored_account_payable_id"),
]
for orig_fname, new_fname in fields_mapping:
orig_model_field = env["ir.model.fields"]._get("res.partner", orig_fname)
new_model_field = env["ir.model.fields"]._get("res.partner", new_fname)
sql = """
UPDATE ir_property
SET name = %s,
fields_id = %s
WHERE fields_id = %s;
"""
cr.execute(sql, (new_fname, new_model_field.id, orig_model_field.id))


def uninstall_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
fields_mapping = [
("property_account_receivable_id", "property_stored_account_receivable_id"),
("property_account_payable_id", "property_stored_account_payable_id"),
]
for orig_fname, new_fname in fields_mapping:
orig_model_field = env["ir.model.fields"]._get("res.partner", orig_fname)
new_model_field = env["ir.model.fields"]._get("res.partner", new_fname)
sql = """
UPDATE ir_property
SET name = %s,
fields_id = %s
WHERE fields_id = %s;
"""
cr.execute(sql, (orig_fname, orig_model_field.id, new_model_field.id))
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_mode_default_account
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_payment_mode_default_account
#: model:ir.model,name:account_payment_mode_default_account.model_account_chart_template
msgid "Account Chart Template"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_partner__property_account_payable_id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_users__property_account_payable_id
msgid "Account Payable"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_partner__property_account_receivable_id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_partner__property_stored_account_receivable_id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_users__property_account_receivable_id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_users__property_stored_account_receivable_id
msgid "Account Receivable"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_partner__property_stored_account_payable_id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_users__property_stored_account_payable_id
msgid "Account payable"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model,name:account_payment_mode_default_account.model_res_partner
msgid "Contact"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_payment_mode__default_payable_account_id
msgid "Default Payable Account"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_payment_mode__default_receivable_account_id
msgid "Default Receivable Account"
msgstr ""

#. module: account_payment_mode_default_account
#: model_terms:ir.ui.view,arch_db:account_payment_mode_default_account.account_payment_mode_form
msgid "Default accounts"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_chart_template__display_name
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_move__display_name
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_payment_mode__display_name
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_partner__display_name
msgid "Display Name"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_chart_template__id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_move__id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_payment_mode__id
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_partner__id
msgid "ID"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model,name:account_payment_mode_default_account.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_chart_template____last_update
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_move____last_update
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_account_payment_mode____last_update
#: model:ir.model.fields,field_description:account_payment_mode_default_account.field_res_partner____last_update
msgid "Last Modified on"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model,name:account_payment_mode_default_account.model_account_payment_mode
msgid "Payment Modes"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,help:account_payment_mode_default_account.field_res_partner__property_account_payable_id
#: model:ir.model.fields,help:account_payment_mode_default_account.field_res_users__property_account_payable_id
msgid ""
"This account will be used instead of the default one as the payable account "
"for the current partner"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,help:account_payment_mode_default_account.field_account_payment_mode__default_payable_account_id
msgid ""
"This account will be used instead of the default one as the payable account "
"on invoices using this payment mode"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,help:account_payment_mode_default_account.field_res_partner__property_account_receivable_id
#: model:ir.model.fields,help:account_payment_mode_default_account.field_res_users__property_account_receivable_id
msgid ""
"This account will be used instead of the default one as the receivable "
"account for the current partner"
msgstr ""

#. module: account_payment_mode_default_account
#: model:ir.model.fields,help:account_payment_mode_default_account.field_account_payment_mode__default_receivable_account_id
msgid ""
"This account will be used instead of the default one as the receivable "
"account on invoices using this payment mode"
msgstr ""
Loading
Loading