Skip to content

Commit

Permalink
Merge af545de into 5792e1b
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Dupont committed Jun 25, 2018
2 parents 5792e1b + af545de commit 618211a
Show file tree
Hide file tree
Showing 15 changed files with 351 additions and 0 deletions.
71 changes: 71 additions & 0 deletions product_sale_tax_price_included/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

==============
Product sale tax price included
==============

This module permits to quickly see the different prices of a product : price with taxes and price without taxes.

.. image:: /product_sale_tax_price_included/static/description/product_different_prices.png
:alt: Product with his price and the price without taxes
:width: 40%

The four use cases
=====

In Customer taxes, there's a boolean called "Tax included in Price".

.. image:: /product_sale_tax_price_included/static/description/taxes_creation.png
:alt: Choice of customer taxes
:width: 40%

**According to the customer taxes** of the product (choosen in accouting part), there are 4 possibilities :

- The sale price **AND** the sale price without taxes are displayed.

.. image:: /product_sale_tax_price_included/static/description/product_tax_included.png
:alt: A product with sale price and sale price without taxes
:width: 75%

- **Or** the sale price **AND** the sale price with taxes.

.. image:: /product_sale_tax_price_included/static/description/product_tax_excluded.png
:alt: A product with sale price and sale price with taxes
:width: 75%

- **Or** if you choose two customer taxes, one included in price, and the other one not included in price,
this module displays the sale price and the two calculated prices.

.. image:: /product_sale_tax_price_included/static/description/product_tax_included_and_not.png
:alt: A product with sale price and a warning message
:width: 75%

- **And lastly** if there's no taxe choosen, only the normal price is displayed.

Credits
=======

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

* Quentin Dupont, GRAP <quentin.dupont@grap.coop> (http://www.grap.coop/)
* Sylvain Legal, GRAP <sylvain.legal@grap.coop> (http://www.grap.coop/)

Do not contact contributors directly about support or help with technical issues.

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.
4 changes: 4 additions & 0 deletions product_sale_tax_price_included/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
29 changes: 29 additions & 0 deletions product_sale_tax_price_included/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Copyright 2017, Grap
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Product sale tax price included",
"summary": "Module summary",
"version": "8.0.1.0.0",
"category": "Uncategorized",
"website": "https://github.com/OCA/product-attribute",
"author": "GRAP, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"external_dependencies": {
"python": [],
"bin": [],
},
"depends": [
"product",
"account",
],
"data": [
'views/product_template.xml',
],
"demo": [
'demo/account_tax_demo.xml',
'demo/product_template_demo.xml'
],
}
21 changes: 21 additions & 0 deletions product_sale_tax_price_included/demo/account_tax_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017, Grap
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<openerp><data>

<record model="account.tax" id="account_tax_included_in_price">
<field name="name">Demo - New Tax Included In Price (20%)</field>
<field name="price_include">True</field>
<field name="type">percent</field>
<field name="amount">0.2</field>
</record>

<record model="account.tax" id="account_tax_excluded_in_price">
<field name="name">Demo - New Tax Not Included In Price (10%)</field>
<field name="price_include"></field>
<field name="type">percent</field>
<field name="amount">0.1</field>
</record>

</data></openerp>
30 changes: 30 additions & 0 deletions product_sale_tax_price_included/demo/product_template_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017, Grap
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<openerp><data>

<record model="product.template" id="product_template_demo_1">
<field name="name">Demo Product 01 - Taxes included in price</field>
<field name="list_price">100</field>
<field name="taxes_id" eval="[(6,0,[ref('account_tax_included_in_price')])]" />
</record>

<record model="product.template" id="product_template_demo_2">
<field name="name">Demo Product 02 - Taxes not included in price</field>
<field name="list_price">100</field>
<field name="taxes_id" eval="[(6,0,[ref('account_tax_excluded_in_price')])]" />
</record>

<record model="product.template" id="product_template_demo_3">
<field name="name">Demo Product 03 - Taxes included and not included in price</field>
<field name="list_price">100</field>
<field name="taxes_id" eval="[(6,0,[ref('account_tax_excluded_in_price'),ref('account_tax_included_in_price')])]" />
</record>

<record model="product.template" id="product_template_demo_4">
<field name="name">Demo Product 04 - No Taxes</field>
<field name="list_price">100</field>
</record>

</data></openerp>
102 changes: 102 additions & 0 deletions product_sale_tax_price_included/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_sale_tax_price_included
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-22 09:49+0000\n"
"PO-Revision-Date: 2018-01-22 09:49+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: product_sale_tax_price_included
#: field:product.template,warning_various_taxes:0
msgid "/!\\ Taxes are not ALL included in Sale Price"
msgstr "/!\\ Toutes les Taxes ne sont pas comprises dans le Prix de vente\"
#. module: product_sale_tax_price_included
#: selection:product.template,sale_tax_price_include:0
msgid "All taxes are included in sale price"
msgstr "Prix de vente TTC"

#. module: product_sale_tax_price_included
#: model:account.tax,name:product_sale_tax_price_included.account_tax_included_in_price
msgid "Demo - New Tax Included In Price (20%)"
msgstr "Demo - Nouvelle Taxe Comprise Dans le Prix de Vente (20%)"

#. module: product_sale_tax_price_included
#: model:account.tax,name:product_sale_tax_price_included.account_tax_excluded_in_price
msgid "Demo - New Tax Not Included In Price (10%)"
msgstr "Demo - Nouvelle Taxe Non Comprise dans le Prix de Vente (10%)"

#. module: product_sale_tax_price_included
#: model:product.template,name:product_sale_tax_price_included.product_template_demo_1
msgid "Demo Product 01 - Taxes included in price"
msgstr "Demo Produit 01 - Taxes comprises dans le prix"

#. module: product_sale_tax_price_included
#: model:product.template,name:product_sale_tax_price_included.product_template_demo_2
msgid "Demo Product 02 - Taxes not included in price"
msgstr "Demo Produit 02 - Taxes non comprises dans le prix"

#. module: product_sale_tax_price_included
#: model:product.template,name:product_sale_tax_price_included.product_template_demo_3
msgid "Demo Product 03 - Taxes included and not included in price"
msgstr "Demo Produit 03 - Taxes comprises et non comprises dans le prix"

#. module: product_sale_tax_price_included
#: model:product.template,name:product_sale_tax_price_included.product_template_demo_4
msgid "Demo Product 04 - No Taxes"
msgstr "Demo Produit 04 - Aucune Taxe"

#. module: product_sale_tax_price_included
#: help:product.template,sale_tax_price_include:0
msgid "Indicate if the Sale Price include Taxes or not"
msgstr "Indique si les Taxes sont comprises ou non dans le Prix de Vente"

#. module: product_sale_tax_price_included
#: selection:product.template,sale_tax_price_include:0
msgid "No sale tax"
msgstr "Pas de taxe à la vente"

#. module: product_sale_tax_price_included
#: model:ir.model,name:product_sale_tax_price_included.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"

#. module: product_sale_tax_price_included
#: field:product.template,price_vat_excl:0
msgid "Sale Price Taxes Excluded"
msgstr "Prix de vente HT"

#. module: product_sale_tax_price_included
#: field:product.template,price_vat_incl:0
msgid "Sale Price Taxes Included"
msgstr "Prix de vente TTC"

#. module: product_sale_tax_price_included
#: selection:product.template,sale_tax_price_include:0
msgid "Sale price may include taxes"
msgstr "Prix de vente HT & TTC"

#. module: product_sale_tax_price_included
#: help:product.template,warning_various_taxes:0
msgid "See the customer taxes for this product"
msgstr "Voir les taxes à la vente choisies pour ce produit"

#. module: product_sale_tax_price_included
#: selection:product.template,sale_tax_price_include:0
msgid "Taxes are not included in sale price"
msgstr "Prix de vente HT"

#. module: product_sale_tax_price_included
#: field:product.template,sale_tax_price_include:0
msgid "Taxes in Sale Price"
msgstr "Taxes dans le prix de vente"

4 changes: 4 additions & 0 deletions product_sale_tax_price_included/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import product_template
63 changes: 63 additions & 0 deletions product_sale_tax_price_included/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
# Copyright 2017, Grap
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openerp import api, fields, models


class ProductTemplate(models.Model):
_inherit = 'product.template'

sale_tax_price_include = fields.Selection(
[('no_tax', 'No sale tax'),
('all_tax_excl', 'Taxes are not included in sale price'),
('all_tax_incl', 'All taxes are included in sale price'),
('various_taxes', 'Sale price may include taxes')],
compute='_compute_sale_tax_price_include',
string='Taxes in Sale Price',
help='Indicate if the Sale Price include Taxes or not',
)

price_vat_excl = fields.Float(
compute='_compute_price_vat_incl_excl', multi='price_vat_incl_excl',
string='Sale Price Taxes Excluded',
)
price_vat_incl = fields.Float(
compute='_compute_price_vat_incl_excl', multi='price_vat_incl_excl',
string='Sale Price Taxes Included',
)

@api.multi
@api.depends('list_price', 'taxes_id', 'taxes_id.type', 'taxes_id.amount')
def _compute_price_vat_incl_excl(self):
for template in self:
info = template.taxes_id.compute_all(template.list_price, 1)
template.price_vat_incl = info['total_included']
template.price_vat_excl = info['total']

@api.multi
@api.depends('taxes_id')
def _compute_sale_tax_price_include(self):
for template in self:
sale_tax_price_include = ''

if not template.taxes_id:
template.sale_tax_price_include = 'no_tax'
else:
for taxes in template.taxes_id:
if sale_tax_price_include == '':
if taxes.price_include:
sale_tax_price_include = 'all_tax_incl'
else:
sale_tax_price_include = 'all_tax_excl'
elif taxes.price_include:
if sale_tax_price_include == 'all_tax_incl':
sale_tax_price_include = 'all_tax_incl'
else:
sale_tax_price_include = 'various_taxes'
else:
if sale_tax_price_include == 'all_tax_excl':
sale_tax_price_include = 'all_tax_excl'
else:
sale_tax_price_include = 'various_taxes'
template.sale_tax_price_include = sale_tax_price_include
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions product_sale_tax_price_included/views/product_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Grap, OCA
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<openerp><data>

<!-- PRODUCT TEMPLATE-->
<!-- Form view -->
<record id="product_template_view_form" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<field name="list_price" position="before">
<field name="sale_tax_price_include" attrs="{'invisible': 1}"/>
</field>
<field name="list_price" position="before">
<field name="price_vat_excl" attrs="{'invisible': [('sale_tax_price_include', '!=', 'all_tax_incl'),
('sale_tax_price_include', '!=', 'various_taxes')]}"/>
</field>
<field name="list_price" position="after">
<field name="price_vat_incl" attrs="{'invisible': [('sale_tax_price_include', '!=', 'all_tax_excl'),
('sale_tax_price_include', '!=', 'various_taxes')]}"/>
</field>
</field>
</record>

</data></openerp>

0 comments on commit 618211a

Please sign in to comment.