Skip to content

Commit 2e9ab84

Browse files
committed
Merge PR #430 into 14.0
Signed-off-by HaraldPanten
2 parents 9e57028 + 02bbb33 commit 2e9ab84

17 files changed

+743
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
================================================
2+
Account Fiscal Position Autodetect optional VIES
3+
================================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:a5d84c13438830b0b6ab28ee279fdd117fa1b0501f1a2722c7c1059b8c656b96
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--fiscal--rule-lightgray.png?logo=github
20+
:target: https://github.com/OCA/account-fiscal-rule/tree/14.0/account_fiscal_position_autodetect_optional_vies
21+
:alt: OCA/account-fiscal-rule
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/account-fiscal-rule-14-0/account-fiscal-rule-14-0-account_fiscal_position_autodetect_optional_vies
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-fiscal-rule&target_branch=14.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds vat VIES validation to fiscal positions auto detection system.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Configuration
39+
=============
40+
41+
- Create a new partner and define some country.
42+
43+
- Create a new Fiscal Position, with the following configuration:
44+
45+
* 'Detect Automatically' -> checked.
46+
* 'Vat required' -> checked.
47+
* 'Vat VIES required' -> checked.
48+
49+
Usage
50+
=====
51+
52+
Create a new Sale/Invoice and select the partner. Remember that the system recalculates the fiscal position according to the shipping address.
53+
54+
Bug Tracker
55+
===========
56+
57+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-fiscal-rule/issues>`_.
58+
In case of trouble, please check there if your issue has already been reported.
59+
If you spotted it first, help us to smash it by providing a detailed and welcomed
60+
`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**>`_.
61+
62+
Do not contact contributors directly about support or help with technical issues.
63+
64+
Credits
65+
=======
66+
67+
Authors
68+
~~~~~~~
69+
70+
* Tecnativa
71+
72+
Contributors
73+
~~~~~~~~~~~~
74+
75+
* `Tecnativa <https://www.tecnativa.com>`_:
76+
77+
* Pedro M. Baeza
78+
* Víctor Martínez
79+
80+
Maintainers
81+
~~~~~~~~~~~
82+
83+
This module is maintained by the OCA.
84+
85+
.. image:: https://odoo-community.org/logo.png
86+
:alt: Odoo Community Association
87+
:target: https://odoo-community.org
88+
89+
OCA, or the Odoo Community Association, is a nonprofit organization whose
90+
mission is to support the collaborative development of Odoo features and
91+
promote its widespread use.
92+
93+
.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px
94+
:target: https://github.com/victoralmau
95+
:alt: victoralmau
96+
97+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
98+
99+
|maintainer-victoralmau|
100+
101+
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.
102+
103+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2021 Tecnativa - Víctor Martínez
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Account Fiscal Position Autodetect optional VIES",
6+
"version": "14.0.1.0.0",
7+
"category": "Accounting & Finance",
8+
"license": "AGPL-3",
9+
"author": "Tecnativa, Odoo Community Association (OCA)",
10+
"maintainers": ["victoralmau"],
11+
"website": "https://github.com/OCA/account-fiscal-rule",
12+
"depends": ["base_vat_optional_vies"],
13+
"data": ["views/account_fiscal_position_view.xml"],
14+
"application": True,
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * account_fiscal_position_autodetect_optional_vies
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: account_fiscal_position_autodetect_optional_vies
17+
#: model:ir.model.fields,help:account_fiscal_position_autodetect_optional_vies.field_account_fiscal_position__vat_vies_required
18+
msgid "Apply only if VAT passed VIES validation."
19+
msgstr ""
20+
21+
#. module: account_fiscal_position_autodetect_optional_vies
22+
#: model:ir.model,name:account_fiscal_position_autodetect_optional_vies.model_account_fiscal_position
23+
msgid "Fiscal Position"
24+
msgstr ""
25+
26+
#. module: account_fiscal_position_autodetect_optional_vies
27+
#: model:ir.model.fields,field_description:account_fiscal_position_autodetect_optional_vies.field_account_fiscal_position__vat_vies_required
28+
msgid "Vat was VIES validated"
29+
msgstr ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import account_fiscal_position
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2021 Tecnativa - Víctor Martínez
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
from odoo.osv import expression
6+
7+
8+
class AccountFiscalPosition(models.Model):
9+
_inherit = "account.fiscal.position"
10+
11+
vat_vies_required = fields.Boolean(
12+
string="Vat was VIES validated",
13+
help="Apply only if VAT passed VIES validation.",
14+
)
15+
16+
@api.model
17+
def search(self, args, offset=0, limit=None, order=None, count=False):
18+
if "vat_vies_required" in self.env.context:
19+
args = expression.AND(
20+
(
21+
args,
22+
[
23+
(
24+
"vat_vies_required",
25+
"=",
26+
self.env.context.get("vat_vies_required"),
27+
)
28+
],
29+
)
30+
)
31+
return super().search(
32+
args, offset=offset, limit=limit, order=order, count=count
33+
)
34+
35+
@api.model
36+
def get_fiscal_position(self, partner_id, delivery_id=None):
37+
_self = self
38+
if partner_id:
39+
partner = self.env["res.partner"].browse(delivery_id or partner_id)
40+
_self = self.with_context(
41+
vat_vies_required=partner.commercial_partner_id.vies_passed
42+
)
43+
return super(AccountFiscalPosition, _self).get_fiscal_position(
44+
partner_id, delivery_id
45+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- Create a new partner and define some country.
2+
3+
- Create a new Fiscal Position, with the following configuration:
4+
5+
* 'Detect Automatically' -> checked.
6+
* 'Vat required' -> checked.
7+
* 'Vat VIES required' -> checked.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* `Tecnativa <https://www.tecnativa.com>`_:
2+
3+
* Pedro M. Baeza
4+
* Víctor Martínez
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module adds vat VIES validation to fiscal positions auto detection system.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Create a new Sale/Invoice and select the partner. Remember that the system recalculates the fiscal position according to the shipping address.
Loading

0 commit comments

Comments
 (0)