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

[18.0][MIG] account_move_tier_validation_approver: Migration to 18.0 #1831

Open
wants to merge 16 commits into
base: 18.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
112 changes: 112 additions & 0 deletions account_move_tier_validation_approver/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
=====================================
Account Move Tier Validation Approver
=====================================

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

.. |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%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/18.0/account_move_tier_validation_approver
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_move_tier_validation_approver
: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/account-invoicing&target_branch=18.0
:alt: Try me on Runboat

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

This module allows to select a Responsible for approval in the partner
form. If a tier definition is set and configured with the "Responsible
for Approval" field, the approver will be the one chosen in the partner
form.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

1. Go to *Settings > Technical > Tier Validations > Tier Definition*.
2. Create a new tier or edit an existing one.
3. Set the "Validated by" field to "Field in related record".
4. Set the "Reviewer field" to "Responsible for Approval".

A default tier validation called "Validation with Approver field" is set
with this configuration.

Usage
=====

You can assign a default user for approval associated to a supplier. In
the partner form view, go to the *Sales and Purchase* tab, and into the
*Purchase* section, and fill the field *Approver of Vendor Bills*.

When you create a vendor bill the field *Responsible for Approval* will
be filled in with the partner's default. You can change it if needed.

Be aware that you won't be able to post a vendor bill unless you have
indicated a Responsible for Approval.

Used in connection with the module *Account Move Tier Validation* you
can set up approvals specific to a department.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/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/account-invoicing/issues/new?body=module:%20account_move_tier_validation_approver%0Aversion:%2018.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
-------

* ForgeFlow

Contributors
------------

- Lois Rilo <lois.rilo@forgeflow.com>
- Adrià Gil Sorribes <adria.gil@forgeflow.com>
- [360ERP](https://www.360erp.com):

- Kevin Khao <<kevinkhao@gmail.com>>

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/account-invoicing <https://github.com/OCA/account-invoicing/tree/18.0/account_move_tier_validation_approver>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_move_tier_validation_approver/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions account_move_tier_validation_approver/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2021 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Move Tier Validation Approver",
"version": "18.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Accounting",
"license": "AGPL-3",
"depends": ["account_move_tier_validation"],
"website": "https://github.com/OCA/account-invoicing",
"data": [
"views/account_move_views.xml",
"views/res_partner_views.xml",
"views/res_config_settings_views.xml",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_tier_validation_approver
#
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_move_tier_validation_approver
#: model_terms:ir.ui.view,arch_db:account_move_tier_validation_approver.res_config_settings_view_form
msgid ""
"<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-"
"specific.\" groups=\"base.group_multi_company\"/>"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_partner__approver_id
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_users__approver_id
msgid "Approver of Vendor Bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_company__validation_approver_tier_definition_id
msgid "Bill approval tier definition"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model,name:account_move_tier_validation_approver.model_res_company
msgid "Companies"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model,name:account_move_tier_validation_approver.model_res_config_settings
msgid "Config Settings"
msgstr ""

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

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_account_move__display_name
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_company__display_name
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_config_settings__display_name
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_partner__display_name
msgid "Display Name"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_account_move__id
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_company__id
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_config_settings__id
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_partner__id
msgid "ID"
msgstr ""

#. module: account_move_tier_validation_approver
#: code:addons/account_move_tier_validation_approver/models/account_move.py:0
#, python-format
msgid "It is mandatory to indicate a Responsible for Approval (in {})"
msgstr ""

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

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_account_move____last_update
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_company____last_update
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_config_settings____last_update
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_partner____last_update
msgid "Last Modified on"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_config_settings__require_approver_in_vendor_bills
msgid "Require Approver In Vendor Bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model_terms:ir.ui.view,arch_db:account_move_tier_validation_approver.res_config_settings_view_form
msgid "Require approver before posting vendor bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_company__require_approver_in_vendor_bills
msgid "Require approver in vendor bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,help:account_move_tier_validation_approver.field_res_config_settings__require_approver_in_vendor_bills
msgid "Requires adding an approver before a vendor bill can be posted."
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_account_bank_statement_line__approver_id
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_account_move__approver_id
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_account_payment__approver_id
msgid "Responsible for Approval"
msgstr ""
84 changes: 84 additions & 0 deletions account_move_tier_validation_approver/i18n/es_PA.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_tier_validation_approver
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: es_PA\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"

#. module: account_move_tier_validation_approver
#: model_terms:ir.ui.view,arch_db:account_move_tier_validation_approver.res_config_settings_view_form
msgid ""
"<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-"
"specific.\" groups=\"base.group_multi_company\"/>"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_partner__approver_id
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_users__approver_id
msgid "Approver of Vendor Bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_company__validation_approver_tier_definition_id
msgid "Bill approval tier definition"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model,name:account_move_tier_validation_approver.model_res_company
msgid "Companies"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model,name:account_move_tier_validation_approver.model_res_config_settings
msgid "Config Settings"
msgstr ""

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

#. module: account_move_tier_validation_approver
#: code:addons/account_move_tier_validation_approver/models/account_move.py:0
#, python-format
msgid "It is mandatory to indicate a Responsible for Approval"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model,name:account_move_tier_validation_approver.model_account_move
msgid "Journal Entries"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_config_settings__require_approver_in_vendor_bills
msgid "Require Approver In Vendor Bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model_terms:ir.ui.view,arch_db:account_move_tier_validation_approver.res_config_settings_view_form
msgid "Require approver before posting vendor bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_res_company__require_approver_in_vendor_bills
msgid "Require approver in vendor bills"
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,help:account_move_tier_validation_approver.field_res_config_settings__require_approver_in_vendor_bills
msgid "Requires adding an approver before a vendor bill can be posted."
msgstr ""

#. module: account_move_tier_validation_approver
#: model:ir.model.fields,field_description:account_move_tier_validation_approver.field_account_move__approver_id
msgid "Responsible for Approval"
msgstr ""
4 changes: 4 additions & 0 deletions account_move_tier_validation_approver/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import account_move
from . import res_partner
from . import res_config_settings
from . import res_company
33 changes: 33 additions & 0 deletions account_move_tier_validation_approver/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2021 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
from odoo.exceptions import UserError


class AccountMove(models.Model):
_inherit = "account.move"

approver_id = fields.Many2one("res.users", string="Responsible for Approval")

@api.onchange("partner_id")
def _onchange_partner_approver_id(self):
if self.partner_id:
self.approver_id = self.partner_id.approver_id.id

Check warning on line 16 in account_move_tier_validation_approver/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_tier_validation_approver/models/account_move.py#L16

Added line #L16 was not covered by tests

def _post(self, soft=True):
for move in self:
require_approver_in_vendor_bills = (
move.company_id.require_approver_in_vendor_bills
)
if (
move.is_purchase_document(include_receipts=True)
and require_approver_in_vendor_bills
and not move.approver_id
):
raise UserError(

Check warning on line 28 in account_move_tier_validation_approver/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_tier_validation_approver/models/account_move.py#L28

Added line #L28 was not covered by tests
self.env._(
"It is mandatory to indicate a Responsible for Approval (in {})"
).format(move.name)
)
return super()._post(soft)
15 changes: 15 additions & 0 deletions account_move_tier_validation_approver/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 ForgeFlow, S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

require_approver_in_vendor_bills = fields.Boolean(
string="Require approver in vendor bills"
)
validation_approver_tier_definition_id = fields.Many2one(
comodel_name="tier.definition", string="Bill approval tier definition"
)
Loading
Loading