-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by rafaelbn
- Loading branch information
Showing
23 changed files
with
1,063 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
==================================== | ||
Account Fiscal Position Partner Type | ||
==================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Production/Stable | ||
.. |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/15.0/account_fiscal_position_partner_type | ||
: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-15-0/account-fiscal-rule-15-0-account_fiscal_position_partner_type | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/93/15.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds the concept of type applied to fiscal positions and partners. The idea is to categorize them for not applying fiscal positions that doesn't belong to the same type. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
User can configure the default value according to the system company going to: | ||
|
||
* Settings/Users & Companies/Companies. | ||
* Changing the value of the "Default Partner Fiscal Position Type" field. | ||
|
||
Usage | ||
===== | ||
|
||
Create a new partner and define the "Fiscal Position Type" field. | ||
|
||
Create a new Fiscal Position, with the following configuration: | ||
|
||
* 'Detect Automatically' -> checked. | ||
* 'Fiscal Position Type' | ||
|
||
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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/account-fiscal-rule/issues/new?body=module:%20account_fiscal_position_partner_type%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 | ||
~~~~~~~ | ||
|
||
* Sygel Technology | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Sygel <https://www.sygel.es>`_: | ||
|
||
* Harald Panten | ||
* Valentin Vinagre | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Pedro M. Baeza | ||
|
||
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-fiscal-rule <https://github.com/OCA/account-fiscal-rule/tree/15.0/account_fiscal_position_partner_type>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2021 Valentin Vinagre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2021 Valentín Vinagre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Account Fiscal Position Partner Type", | ||
"version": "16.0.1.0.0", | ||
"category": "Accounting & Finance", | ||
"website": "https://github.com/OCA/account-fiscal-rule", | ||
"author": "Sygel Technology," "Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"development_status": "Production/Stable", | ||
"depends": ["account"], | ||
"data": [ | ||
"views/res_company.xml", | ||
"views/res_partner.xml", | ||
"views/account_fiscal_position.xml", | ||
], | ||
} |
55 changes: 55 additions & 0 deletions
55
account_fiscal_position_partner_type/i18n/account_fiscal_position_partner_type.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_fiscal_position_partner_type | ||
# | ||
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_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_res_company | ||
msgid "Companies" | ||
msgstr "" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields.selection,name:account_fiscal_position_partner_type.selection__account_fiscal_position__fiscal_position_type__b2b | ||
msgid "Company (B2B)" | ||
msgstr "" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_res_partner | ||
msgid "Contact" | ||
msgstr "" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_company__default_fiscal_position_type | ||
msgid "Default Partner Fiscal Position Type" | ||
msgstr "" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields.selection,name:account_fiscal_position_partner_type.selection__account_fiscal_position__fiscal_position_type__b2c | ||
msgid "End customer (B2C)" | ||
msgstr "" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_account_fiscal_position | ||
msgid "Fiscal Position" | ||
msgstr "" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_partner__fiscal_position_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_users__fiscal_position_type | ||
msgid "Fiscal Position Type" | ||
msgstr "" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_account_fiscal_position__fiscal_position_type | ||
msgid "Type" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_fiscal_position_partner_type | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-03-30 07:56+0000\n" | ||
"PO-Revision-Date: 2023-03-30 07:56+0000\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_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_res_company | ||
msgid "Companies" | ||
msgstr "Compañías" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields.selection,name:account_fiscal_position_partner_type.selection__account_fiscal_position__fiscal_position_type__b2b | ||
msgid "Company (B2B)" | ||
msgstr "Compañía (B2B)" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_res_partner | ||
msgid "Contact" | ||
msgstr "Contacto" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_company__default_fiscal_position_type | ||
msgid "Default Partner Fiscal Position Type" | ||
msgstr "Tipo posición fiscal cliente por defecto" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields.selection,name:account_fiscal_position_partner_type.selection__account_fiscal_position__fiscal_position_type__b2c | ||
msgid "End customer (B2C)" | ||
msgstr "Consumidor final (B2C)" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_account_fiscal_position | ||
msgid "Fiscal Position" | ||
msgstr "Posición fiscal" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_partner__fiscal_position_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_users__fiscal_position_type | ||
msgid "Fiscal Position Type" | ||
msgstr "Tipo posición fiscal" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_account_fiscal_position__fiscal_position_type | ||
msgid "Type" | ||
msgstr "Tipo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_fiscal_position_partner_type | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2021-08-16 21:49+0000\n" | ||
"Last-Translator: Daniel Reis <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: pt_PT\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" | ||
"X-Generator: Weblate 4.3.2\n" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_res_company | ||
msgid "Companies" | ||
msgstr "Empresas" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields.selection,name:account_fiscal_position_partner_type.selection__account_fiscal_position__fiscal_position_type__b2b | ||
msgid "Company (B2B)" | ||
msgstr "Empresa (B2B)" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_res_partner | ||
msgid "Contact" | ||
msgstr "Contato" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_company__default_fiscal_position_type | ||
msgid "Default Partner Fiscal Position Type" | ||
msgstr "Posição Fiscal Predefinida para Parceiros" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_account_fiscal_position__display_name | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_company__display_name | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_partner__display_name | ||
msgid "Display Name" | ||
msgstr "Nome Apresentado" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields.selection,name:account_fiscal_position_partner_type.selection__account_fiscal_position__fiscal_position_type__b2c | ||
msgid "End customer (B2C)" | ||
msgstr "Client Final (B2C)" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model,name:account_fiscal_position_partner_type.model_account_fiscal_position | ||
msgid "Fiscal Position" | ||
msgstr "Posição Fiscal" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_partner__fiscal_position_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_users__fiscal_position_type | ||
msgid "Fiscal Position Type" | ||
msgstr "Tipo de Posição Fiscal" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_account_fiscal_position__id | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_company__id | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_partner__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_account_fiscal_position____last_update | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_company____last_update | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_res_partner____last_update | ||
msgid "Last Modified on" | ||
msgstr "Última Modificação em" | ||
|
||
#. module: account_fiscal_position_partner_type | ||
#: model:ir.model.fields,field_description:account_fiscal_position_partner_type.field_account_fiscal_position__fiscal_position_type | ||
msgid "Type" | ||
msgstr "Tipo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright 2021 Valentin Vinagre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import res_company | ||
from . import res_partner | ||
from . import account_fiscal_position |
49 changes: 49 additions & 0 deletions
49
account_fiscal_position_partner_type/models/account_fiscal_position.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2021 Valentin Vinagre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
from odoo.osv import expression | ||
|
||
|
||
class AccountFiscalPosition(models.Model): | ||
_inherit = "account.fiscal.position" | ||
|
||
fiscal_position_type = fields.Selection( | ||
selection=[("b2c", "End customer (B2C)"), ("b2b", "Company (B2B)")], | ||
string="Type", | ||
default=lambda self: self.env.company.default_fiscal_position_type, | ||
) | ||
|
||
@api.model | ||
def search(self, domain, offset=0, limit=None, order=None, count=False): | ||
if self.env.context.get("fiscal_position_type"): | ||
domain = expression.AND( | ||
( | ||
domain, | ||
[ | ||
( | ||
"fiscal_position_type", | ||
"=", | ||
self.env.context["fiscal_position_type"], | ||
) | ||
], | ||
) | ||
) | ||
return super().search( | ||
domain, offset=offset, limit=limit, order=order, count=count | ||
) | ||
|
||
@api.model | ||
def _get_fiscal_position(self, partner, delivery=None): | ||
fiscal_type = False | ||
if partner: | ||
delivery = delivery or partner | ||
# Only type has been configured | ||
if ( | ||
delivery.fiscal_position_type | ||
and not delivery.property_account_position_id | ||
): | ||
fiscal_type = delivery.fiscal_position_type | ||
return super( | ||
AccountFiscalPosition, self.with_context(fiscal_position_type=fiscal_type) | ||
)._get_fiscal_position(partner=partner, delivery=delivery) |
19 changes: 19 additions & 0 deletions
19
account_fiscal_position_partner_type/models/res_company.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2021 Valentin Vinagre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
default_fiscal_position_type = fields.Selection( | ||
selection="_selection_fiscal_position_type", | ||
string="Default Partner Fiscal Position Type", | ||
) | ||
|
||
def _selection_fiscal_position_type(self): | ||
field = "fiscal_position_type" | ||
return self.env["account.fiscal.position"].fields_get(allfields=[field])[field][ | ||
"selection" | ||
] |
Oops, something went wrong.