Skip to content

[14.0] [MIG] account_fiscal_position_autodetect_optional_vies: Migration to 14.0 #430

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

Merged
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
103 changes: 103 additions & 0 deletions account_fiscal_position_autodetect_optional_vies/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
================================================
Account Fiscal Position Autodetect optional VIES
================================================

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

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

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

This module adds vat VIES validation to fiscal positions auto detection system.

**Table of contents**

.. contents::
:local:

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

- Create a new partner and define some country.

- Create a new Fiscal Position, with the following configuration:

* 'Detect Automatically' -> checked.
* 'Vat required' -> checked.
* 'Vat VIES required' -> checked.

Usage
=====

Create a new Sale/Invoice and select the partner. Remember that the system recalculates the fiscal position according to the shipping address.

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

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

* Tecnativa

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

* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* Víctor Martínez

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.

.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/account-fiscal-rule <https://github.com/OCA/account-fiscal-rule/tree/14.0/account_fiscal_position_autodetect_optional_vies>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions account_fiscal_position_autodetect_optional_vies/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Fiscal Position Autodetect optional VIES",
"version": "14.0.1.0.0",
"category": "Accounting & Finance",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["victoralmau"],
"website": "https://github.com/OCA/account-fiscal-rule",
"depends": ["base_vat_optional_vies"],
"data": ["views/account_fiscal_position_view.xml"],
"application": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_fiscal_position_autodetect_optional_vies
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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_fiscal_position_autodetect_optional_vies
#: model:ir.model.fields,help:account_fiscal_position_autodetect_optional_vies.field_account_fiscal_position__vat_vies_required
msgid "Apply only if VAT passed VIES validation."
msgstr ""

#. module: account_fiscal_position_autodetect_optional_vies
#: model:ir.model,name:account_fiscal_position_autodetect_optional_vies.model_account_fiscal_position
msgid "Fiscal Position"
msgstr ""

#. module: account_fiscal_position_autodetect_optional_vies
#: model:ir.model.fields,field_description:account_fiscal_position_autodetect_optional_vies.field_account_fiscal_position__vat_vies_required
msgid "Vat was VIES validated"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_fiscal_position
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
from odoo.osv import expression


class AccountFiscalPosition(models.Model):
_inherit = "account.fiscal.position"

vat_vies_required = fields.Boolean(
string="Vat was VIES validated",
help="Apply only if VAT passed VIES validation.",
)

@api.model
def search(self, args, offset=0, limit=None, order=None, count=False):
if "vat_vies_required" in self.env.context:
args = expression.AND(
(
args,
[
(
"vat_vies_required",
"=",
self.env.context.get("vat_vies_required"),
)
],
)
)
return super().search(
args, offset=offset, limit=limit, order=order, count=count
)

@api.model
def get_fiscal_position(self, partner_id, delivery_id=None):
_self = self
if partner_id:
partner = self.env["res.partner"].browse(delivery_id or partner_id)
_self = self.with_context(
vat_vies_required=partner.commercial_partner_id.vies_passed
)
return super(AccountFiscalPosition, _self).get_fiscal_position(
partner_id, delivery_id
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Create a new partner and define some country.

- Create a new Fiscal Position, with the following configuration:

* 'Detect Automatically' -> checked.
* 'Vat required' -> checked.
* 'Vat VIES required' -> checked.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* Víctor Martínez
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds vat VIES validation to fiscal positions auto detection system.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Create a new Sale/Invoice and select the partner. Remember that the system recalculates the fiscal position according to the shipping address.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading