Skip to content
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

[17.0] [MIG] product margin classification: Migration to 17.0 #218

Open
wants to merge 54 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
dc40505
[ADD] new module 'product_margin_classification';
legalsylvain Jul 11, 2016
ee65e08
[FIX] typo;
legalsylvain Jul 11, 2016
b130310
[FIX] OCA as author
legalsylvain Jul 12, 2016
48c611b
[IMP] add need action to show product with prices different from the …
legalsylvain Sep 14, 2016
1d85a6d
OCA Transbot updated translations from Transifex
oca-transbot Nov 29, 2016
20f27c2
[UPD] Update product_margin_classification.pot
oca-travis Jun 24, 2018
b6168d0
[FIX+IMP] product_margin_classification
legalsylvain Feb 8, 2018
6a94861
[FIX] wording and update translation
legalsylvain Aug 1, 2018
f5fb364
[UPD] Update product_margin_classification.pot
oca-travis Jul 10, 2019
9c1d400
product_margin_classification 8.0.2.1.0
OCA-git-bot Jul 10, 2019
01b3f1c
Update translation files
oca-transbot Jul 20, 2019
bfad701
[MIG] product_margin_classification: Migration to 10.0
Aug 1, 2019
407326e
[FIX] product_margin_classification: Migration to 10.0
Aug 2, 2019
b2022df
[IMP] Migration to V10.0
legalsylvain Aug 2, 2019
7f00d04
[FIX] product_margin_classification: :green_apple: tests
Aug 9, 2019
3688980
[FIX] product_margin_classification: perf issue on change theor diff
Nov 22, 2019
7b308f9
[UPD] Update product_margin_classification.pot
oca-travis Feb 20, 2020
0b3e944
[UPD] README.rst
OCA-git-bot Feb 20, 2020
d3e8977
Update translation files
oca-transbot Mar 10, 2020
eef7950
Translated using Weblate (Catalan)
mtbochaca Mar 15, 2020
acde20f
Update translation files
oca-transbot Aug 16, 2020
1743ed1
[MIG][12.0] product_margin_classification (from OCA/sale-workflow/10.0)
legalsylvain Sep 16, 2020
053a061
[UPD] Update product_margin_classification.pot
oca-travis Jan 24, 2022
a1efe36
[UPD] README.rst
OCA-git-bot Jan 24, 2022
c253766
[ADD] icon.png
OCA-git-bot Jan 24, 2022
d3e64f0
[REF] apply pre-commit fixes
legalsylvain Jan 3, 2023
e7b2145
product_margin_classification 12.0.1.0.3
OCA-git-bot Jan 3, 2023
d56baa5
[IMP] product_margin_classification : display classification ordered …
legalsylvain Jun 24, 2022
52d5f32
[UPD] Update product_margin_classification.pot
Jan 3, 2023
cc574ef
product_margin_classification 12.0.1.0.4
OCA-git-bot Jan 3, 2023
b28a870
Update translation files
weblate Jan 3, 2023
ad63bcb
[IMP] product_margin_classification: black, isort, prettier
legalsylvain Apr 27, 2023
78b50ff
[MIG] product_margin_classification. (from 12.0 to 16.0)
legalsylvain Apr 27, 2023
39b53ad
[UPD] Update product_margin_classification.pot
Aug 9, 2023
9f62034
[UPD] README.rst
OCA-git-bot Aug 9, 2023
4a9d6b8
Update translation files
weblate Aug 9, 2023
6cad86c
[FIX] product_margin_classification : do not loose margin classificat…
legalsylvain Aug 18, 2023
4143fd2
product_margin_classification 16.0.1.0.1
OCA-git-bot Aug 24, 2023
0f60191
Translated using Weblate (Spanish)
Ivorra78 Aug 21, 2023
6b6d3f0
[UPD] README.rst
OCA-git-bot Sep 3, 2023
f56e467
Translated using Weblate (French)
kbentaleb Jan 8, 2024
ae0f72c
Added translation using Weblate (Italian)
mymage Jan 22, 2024
add2a31
Translated using Weblate (Italian)
mymage Feb 1, 2024
c5b9783
[16.0][IMP] product_margin_classification: set default company
aliciagaarzo Mar 11, 2024
cc8afec
[BOT] post-merge updates
OCA-git-bot Mar 11, 2024
2cbafd4
[ADD] product_margin_classification: Theoretical price actions on pro…
carmenbianca May 2, 2024
1581625
[UPD] Update product_margin_classification.pot
May 3, 2024
c70be1c
[BOT] post-merge updates
OCA-git-bot May 3, 2024
698bc36
Update translation files
weblate May 3, 2024
dfec247
Translated using Weblate (Italian)
mymage May 8, 2024
2aae224
[16.0][IMP] product_margin_classification: modify registration rule t…
aliciagaarzo May 24, 2024
ca04d5f
[BOT] post-merge updates
OCA-git-bot May 27, 2024
4a88fc3
[IMP] product_margin_classification: pro-commit auto fixes
Aug 21, 2024
4b650d6
[MIG] product_margin_classification: Migration to 17.0
Aug 21, 2024
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
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^product_margin_classification/|
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
Expand Down
150 changes: 150 additions & 0 deletions product_margin_classification/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
=============================
Product Margin Classification
=============================

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

.. |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%2Fmargin--analysis-lightgray.png?logo=github
:target: https://github.com/OCA/margin-analysis/tree/17.0/product_margin_classification
:alt: OCA/margin-analysis
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/margin-analysis-17-0/margin-analysis-17-0-product_margin_classification
: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/margin-analysis&target_branch=17.0
:alt: Try me on Runboat

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

This module is designed to extend Sale Price computation in Odoo.

This module add a new model 'Margin Classifications' linked to Product
variants.

A margin classification has a 'Profit Margin' field and extra fields to
manage computation method, like in Pricelist Item model (Markup Rate,
Rounding and Surcharge fields)

This module use both
[Markup](https://en.wikipedia.org/wiki/Markup_(business)) and [Profit
Margin](https://en.wikipedia.org/wiki/Profit_margin) concepts.

You could be interested by native Pricelist functionalities, setting
sale prices based on Cost prices. The main problem of this design is
that sale price change automaticaly when cost price changes, that is not
desired in some user cases. For exemple, if you have a shop, you want to
changes sale prices when customers is not in the shop, and after having
changed labels in the shop.

**Table of contents**

.. contents::
:local:

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

- Go to : 'Sale > Configuration > Products > Margin Classifications
- Create new classifications
- Set classification to your products

On the Margin classification Form, user can change computation fields.
(Margin, Rounding method, ...) Three buttons are available to apply
theoretical prices: \* to all products, \* only for products that are
too expensive \* only for products that are too cheap

|image|

By clicking on the smart buttons on the right part of the form, all the
products will be displayed, and user can easily change prices

|image1|

User can also see easily products with incorrect margins in the margin
classification tree views:

|image2|

.. |image| image:: https://raw.githubusercontent.com/OCA/margin-analysis/17.0/product_margin_classification/static/description/margin_classification_form.png
.. |image1| image:: https://raw.githubusercontent.com/OCA/margin-analysis/17.0/product_margin_classification/static/description/product_product_tree_incorrect_price.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/margin-analysis/17.0/product_margin_classification/static/description/margin_classification_tree.png

Usage
=====

If product has a margin classification defined and the theoretical price
is not the same as the sale price, an extra field 'Theoretical Price' is
displayed, based on the Margin Classification and a button is available
to change sale price.

|image4|

.. |image4| image:: https://raw.githubusercontent.com/OCA/margin-analysis/17.0/product_margin_classification/static/description/product_product_form.png

Known issues / Roadmap
======================

- This module will not work for variants that have a not null
``price_extra`` value, due to the poor design of Odoo product module.
This issue can be maybe fixed in new version of Odoo.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/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/margin-analysis/issues/new?body=module:%20product_margin_classification%0Aversion:%2017.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
-------

* GRAP

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

- Sylvain LE GAL <https://twitter.com/legalsylvain>
- Marc Poch Mallandrich <[email protected]>

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-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
:target: https://github.com/legalsylvain
:alt: legalsylvain

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

|maintainer-legalsylvain|

This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/17.0/product_margin_classification>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_margin_classification/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
28 changes: 28 additions & 0 deletions product_margin_classification/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (C) 2016-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).

{
"name": "Product Margin Classification",
"version": "17.0.1.0.0",
"category": "Account",
"author": "GRAP,Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/margin-analysis",
"license": "AGPL-3",
"depends": ["sale"],
"data": [
"security/ir_rule.xml",
"security/ir.model.access.csv",
"data/decimal_precision.xml",
"views/view_product_product.xml",
"views/view_product_template.xml",
"views/view_product_margin_classification.xml",
],
"demo": [
"demo/res_groups.xml",
"demo/product_margin_classification.xml",
"demo/product_product.xml",
],
"installable": True,
}
14 changes: 14 additions & 0 deletions product_margin_classification/data/decimal_precision.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016-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 noupdate="1">

<record forcecreate="True" id="decimal_margin" model="decimal.precision">
<field name="name">Margin Rate</field>
<field name="digits">4</field>
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016-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 id="classification_normal_margin" model="product.margin.classification">
<field name="markup">50</field>
<field name="name">Normal Margin (33%)</field>
<field name="price_round">0.05</field>

</record>

<record id="classification_big_margin" model="product.margin.classification">
<field name="markup">100</field>
<field name="name">Big Margin (50%, with 95 cents)</field>
<field name="price_round">1</field>
<field name="price_surcharge">-0.05</field>
</record>

</odoo>
41 changes: 41 additions & 0 deletions product_margin_classification/demo/product_product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2016-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 id="product.product_product_7" model="product.product">
<field name="margin_classification_id" ref="classification_normal_margin" />
</record>

<record id="product.product_product_25" model="product.product">
<field name="margin_classification_id" ref="classification_normal_margin" />
</record>

<record id="product.product_product_27" model="product.product">
<field name="margin_classification_id" ref="classification_normal_margin" />
</record>

<record id="product.product_product_9" model="product.product">
<field name="margin_classification_id" ref="classification_big_margin" />
</record>

<record id="too_cheap_product" model="product.product">
<field name="default_code">CHEAP-PRODUCT</field>
<field name="name">Too Cheap Product</field>
<field name="standard_price">20</field>
<field name="list_price">30</field>
<field name="margin_classification_id" ref="classification_big_margin" />
</record>

<record id="too_expensive_product" model="product.product">
<field name="default_code">EXPENSIVE-PRODUCT</field>
<field name="name">Too Expensive Product</field>
<field name="standard_price">100</field>
<field name="list_price">300</field>
<field name="margin_classification_id" ref="classification_big_margin" />
</record>

</odoo>
18 changes: 18 additions & 0 deletions product_margin_classification/demo/res_groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 PlanetaTIC - Marc Poch <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="base.group_no_one" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record>

<record id="base.group_multi_company" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record>

<record id="sales_team.group_sale_manager" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record>

</odoo>
Loading
Loading