Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
36,114 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,112 @@ | ||
======================================= | ||
Account Product - Fiscal Classification | ||
======================================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/12.0/account_product_fiscal_classification | ||
: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-12-0/account-fiscal-rule-12-0-account_product_fiscal_classification | ||
: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/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
* Add a new light concept 'fiscal_classification' to associate possible | ||
purchase and sale taxes; | ||
|
||
.. image:: https://raw.githubusercontent.com/account_product_fiscal_classification/static/description/img/fiscal_classification_form.png | ||
|
||
* Make more usable taxes selection in product view. The user has now the | ||
possibility to select a fiscal classification, instead of select manually | ||
all the taxes; | ||
|
||
.. image:: https://raw.githubusercontent.com/account_product_fiscal_classification/static/description/img/product_template_accounting_setting.png | ||
|
||
* Prevent users to select incompatible purchase and sale taxes. | ||
French Exemple: A product can not be configured with: | ||
|
||
* Purchase Taxes: 5.5%; | ||
* Sale Taxes: 20%; | ||
|
||
* Provides the possibility to the account manager to change incorrect | ||
parameters massively; | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
* Add possibility to restrict fiscal settings on product, depending of its | ||
category | ||
|
||
.. image:: https://raw.githubusercontent.com/account_product_fiscal_classification/static/description/img/category_with_fiscal_restriction.png | ||
|
||
If you do so, user will not have the possibility to set a fiscal classification | ||
if product category settings do not allow. | ||
|
||
Accounting people can see products that are bad set, in product category form | ||
view. | ||
|
||
.. image:: https://raw.githubusercontent.com/account_product_fiscal_classification/static/description/img/product_bad_settings.png | ||
|
||
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_product_fiscal_classification%0Aversion:%2012.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 | ||
~~~~~~~ | ||
|
||
* Akretion | ||
* GRAP | ||
* La Louve | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Sylvain LE GAL (https://twitter.com/legalsylvain); | ||
* Sébastien BEAU <sebastien.beau@akretion.com>; | ||
* Danimar RIBEIRO; | ||
* Pierrick Brun <pierrick.brun@akretion.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-fiscal-rule <https://github.com/OCA/account-fiscal-rule/tree/12.0/account_product_fiscal_classification>`_ 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,52 @@ | ||
# Copyright (C) 2014-Today GRAP (http://www.grap.coop) | ||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
import logging | ||
|
||
from odoo import api, SUPERUSER_ID | ||
|
||
from . import models | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def create_fiscal_classification_from_product_template(cr, registry): | ||
"""Generate Fiscal Classification for each combinations of Taxes set | ||
in product""" | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
|
||
template_obj = env['product.template'] | ||
classification_obj = env['account.product.fiscal.classification'] | ||
|
||
classifications_keys = {} | ||
|
||
# Get all product template | ||
templates = template_obj.search([ | ||
'|', ('active', '=', False), ('active', '=', True)]) | ||
|
||
counter = 0 | ||
total = len(templates) | ||
# Associate product template to Fiscal Classifications | ||
for template in templates: | ||
counter += 1 | ||
arg_list = [ | ||
template.company_id and template.company_id.id or False, | ||
sorted([x.id for x in template.taxes_id]), | ||
sorted([x.id for x in template.supplier_taxes_id])] | ||
if arg_list not in classifications_keys.values(): | ||
_logger.info( | ||
"""create new Fiscal Classification. Product templates""" | ||
""" managed %s/%s""" % (counter, total)) | ||
classification_id = classification_obj.find_or_create(*arg_list) | ||
classifications_keys[classification_id] = arg_list | ||
# associate product template to the new Fiscal Classification | ||
template.fiscal_classification_id = classification_id | ||
else: | ||
# associate product template to existing Fiscal Classification | ||
fiscal_classification_id = False | ||
for k, v in classifications_keys.items(): | ||
if v == arg_list: | ||
fiscal_classification_id = k | ||
break | ||
template.fiscal_classification_id = fiscal_classification_id |
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,37 @@ | ||
# Copyright (C) 2014-Today GRAP (http://www.grap.coop) | ||
# Copyright (C) 2016-Today La Louve (<http://www.lalouve.net/>) | ||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
'name': 'Account Product - Fiscal Classification', | ||
'summary': 'Simplify taxes management for products', | ||
'version': '12.0.1.0.0', | ||
'category': 'Accounting', | ||
'author': 'Akretion,GRAP,La Louve,Odoo Community Association (OCA)', | ||
'website': 'https://github.com/OCA/account-fiscal-rule', | ||
'license': 'AGPL-3', | ||
'depends': [ | ||
'account', | ||
], | ||
'data': [ | ||
'security/ir_rule.xml', | ||
'security/ir.model.access.csv', | ||
'views/view_product_template.xml', | ||
'wizard/view_wizard_change_fiscal_classification.xml', | ||
'wizard/view_wizard_account_product_fiscal_classification.xml', | ||
'views/view_product_category.xml', | ||
'views/view_account_product_fiscal_classification.xml', | ||
'views/view_account_product_fiscal_classification_template.xml', | ||
], | ||
'demo': [ | ||
'demo/account_tax.xml', | ||
'demo/account_product_fiscal_classification.xml', | ||
'demo/product_template.xml', | ||
'demo/product_category.xml', | ||
'demo/res_groups.xml', | ||
], | ||
'post_init_hook': | ||
'create_fiscal_classification_from_product_template', | ||
'installable': True, | ||
} |
33 changes: 33 additions & 0 deletions
33
account_product_fiscal_classification/demo/account_product_fiscal_classification.xml
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,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (C) 2014-Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
Copyright (C) 2019-Today Akretion (https://akretion.com) | ||
@author Pierrick Brun <pierrick.brun@akretion.com> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
|
||
<odoo> | ||
<record model="account.product.fiscal.classification" id="fiscal_classification_1"> | ||
<field name="name">Demo Fiscal Classification 1</field> | ||
<field name="company_id" ref="base.main_company"/> | ||
<field name="purchase_tax_ids" eval="[(6, 0, [ref('account_tax_purchase_1')])]"/> | ||
<field name="sale_tax_ids" eval="[(6, 0, [ | ||
ref('account_tax_sale_1'), | ||
ref('account_tax_sale_2')])]"/> | ||
</record> | ||
<record model="account.product.fiscal.classification" id="fiscal_classification_2"> | ||
<field name="name">Demo Fiscal Classification 2</field> | ||
<field name="company_id" ref="base.main_company"/> | ||
<field name="sale_tax_ids" eval="[(6, 0, [ref('account_tax_sale_2')])]"/> | ||
</record> | ||
<record model="account.product.fiscal.classification" id="fiscal_classification_3"> | ||
<field name="name">Demo Fiscal Classification 3</field> | ||
<field name="company_id" ref="base.main_company"/> | ||
<field name="purchase_tax_ids" eval="[(6, 0, [ref('account_tax_purchase_1')])]"/> | ||
</record> | ||
<record model="account.product.fiscal.classification" id="global_fiscal_classification_1"> | ||
<field name="company_id" eval="False"/> | ||
<field name="name">Demo Global Fiscal Classification 1</field> | ||
</record> | ||
</odoo> |
28 changes: 28 additions & 0 deletions
28
account_product_fiscal_classification/demo/account_tax.xml
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,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (C) 2014 -Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain | ||
Copyright (C) 2019-Today Akretion (http://www.akretion.com) | ||
@author Pierrick Brun <pierrick.brun@akretion.com> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
<odoo> | ||
<record model="account.tax" id="account_tax_purchase_1"> | ||
<field name="name">Demo Purchase Tax 10%</field> | ||
<field name="company_id" ref="base.main_company"/> | ||
<field name="type_tax_use">purchase</field> | ||
<field name="amount">0.1</field> | ||
</record> | ||
<record model="account.tax" id="account_tax_sale_1"> | ||
<field name="name">Demo Sale Tax 10%</field> | ||
<field name="company_id" ref="base.main_company"/> | ||
<field name="type_tax_use">sale</field> | ||
<field name="amount">0.1</field> | ||
</record> | ||
<record model="account.tax" id="account_tax_sale_2"> | ||
<field name="name">Demo Sale Tax 3%</field> | ||
<field name="company_id" ref="base.main_company"/> | ||
<field name="type_tax_use">sale</field> | ||
<field name="amount">0.03</field> | ||
</record> | ||
</odoo> |
15 changes: 15 additions & 0 deletions
15
account_product_fiscal_classification/demo/product_category.xml
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (C) 2016-Today La Louve (<http://www.lalouve.net/>) | ||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
|
||
<odoo> | ||
<record model="product.category" id="category_with_fiscal_restriction"> | ||
<field name="name">Category with Fiscal Restriction</field> | ||
<field name="fiscal_restriction" eval="True" /> | ||
<field name="fiscal_classification_ids" eval="[(4, ref('fiscal_classification_1'))]"/> | ||
</record> | ||
|
||
</odoo> |
21 changes: 21 additions & 0 deletions
21
account_product_fiscal_classification/demo/product_template.xml
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (C) 2014-Today GRAP (http://www.grap.coop) | ||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
Copyright (C) 2019-Today Akretion (http://www.akretion.com) | ||
@author Pierrick Brun <pierrick.brun@akretion.com> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
<odoo> | ||
<record model="product.template" id="product_template_1"> | ||
<field name="name">Demo Product With Fiscal Classification</field> | ||
<field name="company_id" ref="base.main_company"/> | ||
<field name="categ_id" ref="product.product_category_all"/> | ||
<field name="type">service</field> | ||
<field name="standard_price">20.0</field> | ||
<field name="list_price">30.0</field> | ||
<field name="fiscal_classification_id" ref="fiscal_classification_1"/> | ||
<field name="uom_id" ref="uom.product_uom_unit"/> | ||
<field name="uom_po_id" ref="uom.product_uom_unit"/> | ||
</record> | ||
</odoo> |
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (C) 2014-Today GRAP (http://www.grap.coop) | ||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
<odoo> | ||
|
||
<record model="res.groups" id="base.group_multi_company"> | ||
<field name="users" eval="[(6, 0, [ref('base.user_admin')])]"/> | ||
</record> | ||
|
||
</odoo> |
Oops, something went wrong.