-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from beescoop/12.0-supplier_margin
[12.0][ADD] beesdoo_product: profit margin on suppliers
- Loading branch information
Showing
7 changed files
with
151 additions
and
12 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# - Elouan Lebars <[email protected]> | ||
# - Rémy Taymans <[email protected]> | ||
# - Houssine BAKKALI <[email protected]> | ||
# - Manuel Claeys Bouuaert <[email protected]> | ||
# - Elise Dupont | ||
# - Thibault François | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
@@ -13,14 +14,15 @@ | |
"author": "Beescoop - Cellule IT, Coop IT Easy SCRLfs", | ||
"website": "https://github.com/beescoop/Obeesdoo", | ||
"category": "Sales", | ||
"version": "12.0.1.0.0", | ||
"version": "12.0.1.0.1", | ||
"depends": ["beesdoo_base", "product", "sale", "point_of_sale"], | ||
"data": [ | ||
"data/product_label.xml", | ||
"data/barcode_rule.xml", | ||
"data/product_sequence.xml", | ||
"views/beesdoo_product.xml", | ||
"views/assets.xml", | ||
"views/res_config_settings.xml", | ||
"wizard/views/label_printing_utils.xml", | ||
"security/ir.model.access.csv", | ||
], | ||
|
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import beesdoo_product | ||
from . import res_config_settings |
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
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,41 @@ | ||
# Copyright 2019-2020 Elouan Le Bars <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
suggested_price_reference = fields.Selection( | ||
selection=[ | ||
("supplier_price", "On Supplier Price"), | ||
("sale_price", "On Sale Price"), | ||
], | ||
string="Suggested price reference for margin", | ||
help=""" | ||
Price on which the margin is applied when computing the suggested sale price. | ||
- Margin on Supplier Price : Suggested sale price = supplier price * (1 + margin / 100) (default) | ||
- Margin on Sale Price: Suggested sale price = supplier price * (1 / (1 - margin / 100)) | ||
""", | ||
default="supplier_price", | ||
) | ||
|
||
@api.model | ||
def get_values(self): | ||
res = super(ResConfigSettings, self).get_values() | ||
select_type = self.env["ir.config_parameter"].sudo() | ||
suggested_price_reference = select_type.get_param( | ||
"beesdoo_product.suggested_price_reference" | ||
) | ||
res.update({"suggested_price_reference": suggested_price_reference}) | ||
return res | ||
|
||
@api.multi | ||
def set_values(self): | ||
super(ResConfigSettings, self).set_values() | ||
select_type = self.env["ir.config_parameter"].sudo() | ||
select_type.set_param( | ||
"beesdoo_product.suggested_price_reference", | ||
self.suggested_price_reference, | ||
) |
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 |
---|---|---|
@@ -1,2 +1,8 @@ | ||
Modification of product module for the needs of beescoop | ||
- SOOO5 - Ajout de label bio/ethique/provenance | ||
- SOOO5 - Adds the label bio/ethique/provenance | ||
- Add a 'Suggested Price' field on products, and a 'Product Margin' field on Partners (Vendors) and Product Categories. The first margin is used if set, otherwise the second margin (which has a default value) is used. | ||
- The reference price on which this margin is applied (supplier price or sale price) can be selected in the general settings. | ||
- Also, sale and supplier taxes that are of type 'percentage' and that are marked as 'included in price' are taken into account when computing the suggested price. | ||
|
||
Please note that this model makes assumptions when computing the suggested price: | ||
- It supposes that each product has only one supplier and that products coming from multiple suppliers occure as duplicated products with one supplier each. |
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
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,31 @@ | ||
<?xml version="1.0"?> | ||
<odoo> | ||
|
||
<record id="res_config_settings_view_form" model="ir.ui.view"> | ||
<field name="name">res.config.settings.form</field> | ||
<field name="model">res.config.settings</field> | ||
<field name="inherit_id" ref="purchase.res_config_settings_view_form_purchase"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='group_manage_vendor_price']/../../.." position="inside"> | ||
<div class="col-xs-12 col-md-6 o_setting_box"> | ||
<div class="o_setting_left_pane"> | ||
</div> | ||
<div class="o_setting_right_pane"> | ||
<label for="suggested_price_reference"/> | ||
<div class="text-muted"> | ||
Price on which the margin is applied when computing the suggested sale price.<br/> | ||
- Margin on Supplier Price : Suggested sale price = supplier price * (1 + margin / 100) (default)<br/> | ||
- Margin on Sale Price: Suggested sale price = supplier price * (1 / (1 - margin / 100)) | ||
</div> | ||
<div class="content-group"> | ||
<div class="mt16"> | ||
<field name="suggested_price_reference" class="o_light_label" widget="radio"/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |