From f3054514c69ec54de110036171e76aa10e8251d1 Mon Sep 17 00:00:00 2001 From: Victor Champonnois Date: Thu, 19 May 2022 12:00:25 +0200 Subject: [PATCH] [REF] split beesdoo_product into: - product_main_supplier - sale_suggested_price - sale_adapt_price_wizard [REF] split beesdoo_product -> product_main_supplier [FIX] sale_suggested_price dep on product_main_supplier [ADD] module sale_edit_price_wizard [REF] rename sale_edit_price_wizard -> sale_adapt_price_wizard [REF] move rounding_method to sale_suggested_price [REF] refactor following PR 320 [REF] search product_code -> product_main_seller [FIX] bug adapt_sales_price [IMP] use float_compare to compare prices [REF] move list_price_write_date to sale_adapt_price_wizard [FIX] beesdoo_product: main_seller_id search [FIX] run precommit fix --- .copier-answers.yml | 2 +- beesdoo_account/__manifest__.py | 4 +- beesdoo_account/readme/CONTRIBUTORS.rst | 2 +- beesdoo_base/__manifest__.py | 4 +- beesdoo_crelan_csv/__manifest__.py | 4 +- beesdoo_crelan_csv/readme/CONTRIBUTORS.rst | 2 +- beesdoo_easy_my_coop/README.rst | 4 +- beesdoo_easy_my_coop/__manifest__.py | 2 +- beesdoo_inventory/__manifest__.py | 2 +- beesdoo_inventory/readme/CONTRIBUTORS.rst | 2 +- beesdoo_pos/__manifest__.py | 4 +- beesdoo_pos/readme/CONTRIBUTORS.rst | 2 +- beesdoo_pos_coop_status/__manifest__.py | 2 +- beesdoo_pos_email_ticket/__manifest__.py | 4 +- .../readme/CONTRIBUTORS.rst | 2 +- beesdoo_pos_reporting/readme/CONTRIBUTORS.rst | 2 +- .../data/product_print_category.xml | 2 +- beesdoo_product/__manifest__.py | 12 +- .../migrations/12.0.2.0.0/pre-migration.py | 55 +++ beesdoo_product/models/__init__.py | 1 - beesdoo_product/models/beesdoo_product.py | 263 +---------- beesdoo_product/readme/CONTRIBUTORS.rst | 2 +- beesdoo_product/readme/DESCRIPTION.rst | 25 - beesdoo_product/views/beesdoo_product.xml | 96 ---- beesdoo_product/views/point_of_sale_view.xml | 32 -- beesdoo_product/wizard/__init__.py | 1 - beesdoo_product_usability/README.rst | 2 +- beesdoo_product_usability/__manifest__.py | 2 +- .../readme/CONTRIBUTORS.rst | 2 +- beesdoo_purchase/__manifest__.py | 2 +- beesdoo_purchase/readme/CONTRIBUTORS.rst | 2 +- beesdoo_shift/__manifest__.py | 2 +- beesdoo_shift/readme/CONTRIBUTORS.rst | 2 +- beesdoo_shift_attendance/README.rst | 2 +- beesdoo_shift_attendance/__manifest__.py | 2 +- .../readme/CONTRIBUTORS.rst | 2 +- beesdoo_shift_welcome_screen/__manifest__.py | 2 +- beesdoo_stock/README.rst | 2 +- beesdoo_stock/readme/CONTRIBUTORS.rst | 2 +- beesdoo_website_eater/README.rst | 2 +- beesdoo_website_eater/readme/CONTRIBUTORS.rst | 2 +- .../readme/CONTRIBUTORS.rst | 2 +- beesdoo_website_shift/README.rst | 2 +- beesdoo_website_shift/readme/CONTRIBUTORS.rst | 2 +- beesdoo_website_theme/README.rst | 4 +- beesdoo_website_theme/readme/CONTRIBUTORS.rst | 2 +- beesdoo_worker_status/__manifest__.py | 2 +- beesdoo_worker_status/readme/CONTRIBUTORS.rst | 2 +- .../__manifest__.py | 2 +- cooperator_eater/README.rst | 4 +- cooperator_info_session/README.rst | 4 +- cooperator_worker/README.rst | 4 +- eater/__manifest__.py | 2 +- eater/readme/CONTRIBUTORS.rst | 2 +- eater_member_card/__manifest__.py | 2 +- eater_member_card/readme/CONTRIBUTORS.rst | 2 +- member_card/__manifest__.py | 2 +- member_card/readme/CONTRIBUTORS.rst | 2 +- product_main_supplier/README.rst | 58 +++ product_main_supplier/__init__.py | 1 + product_main_supplier/__manifest__.py | 20 + product_main_supplier/models/__init__.py | 2 + .../models/product_supplierinfo.py | 21 + .../models/product_template.py | 58 +++ product_main_supplier/readme/CONTRIBUTORS.rst | 2 + product_main_supplier/readme/DESCRIPTION.rst | 4 + product_main_supplier/readme/ROADMAP.rst | 0 .../static/description/index.html | 415 ++++++++++++++++ .../tests/__init__.py | 2 +- .../tests/test_main_seller_id.py | 41 ++ .../test_search_main_seller_product_code.py | 4 +- .../views/product_template_views.xml | 15 + .../models/product_template.py | 2 +- requirements.txt | 1 + sale_adapt_price_wizard/README.rst | 83 ++++ sale_adapt_price_wizard/__init__.py | 46 ++ sale_adapt_price_wizard/__manifest__.py | 35 ++ sale_adapt_price_wizard/models/__init__.py | 2 + .../models/product_template.py | 51 ++ .../models/res_config_settings.py | 37 ++ .../readme/CONTRIBUTORS.rst | 2 + .../readme/DESCRIPTION.rst | 16 + .../static/description/index.html | 447 ++++++++++++++++++ .../views/product_template_views.xml | 37 ++ .../views/purchase_views.xml | 0 .../views/res_config_settings_views.xml | 32 ++ .../views/sale_views.xml | 0 sale_adapt_price_wizard/wizard/__init__.py | 1 + .../wizard/adapt_sales_price_wizard.py | 0 .../views/adapt_sales_price_wizard_view.xml | 2 +- sale_suggested_price/README.rst | 77 +++ sale_suggested_price/__init__.py | 1 + sale_suggested_price/__manifest__.py | 30 ++ sale_suggested_price/models/__init__.py | 4 + .../models/product_category.py | 41 ++ .../models/product_template.py | 145 ++++++ .../models/res_config_settings.py | 23 +- sale_suggested_price/models/res_partner.py | 19 + sale_suggested_price/readme/CONTRIBUTORS.rst | 2 + sale_suggested_price/readme/DESCRIPTION.rst | 12 + sale_suggested_price/readme/ROADMAP.rst | 4 + .../static/description/index.html | 441 +++++++++++++++++ sale_suggested_price/tests/__init__.py | 1 + .../tests/test_suggested_price.py | 3 +- .../views/product_category_views.xml | 35 ++ .../views/product_template_views.xml | 18 + .../views/res_config_settings_views.xml | 12 - .../views/res_partner_views.xml | 13 + .../odoo/addons/product_main_supplier | 1 + setup/product_main_supplier/setup.py | 6 + .../odoo/addons/sale_adapt_price_wizard | 1 + setup/sale_adapt_price_wizard/setup.py | 6 + .../odoo/addons/sale_suggested_price | 1 + setup/sale_suggested_price/setup.py | 6 + 114 files changed, 2421 insertions(+), 523 deletions(-) create mode 100644 beesdoo_product/migrations/12.0.2.0.0/pre-migration.py delete mode 100644 beesdoo_product/views/point_of_sale_view.xml create mode 100644 product_main_supplier/README.rst create mode 100644 product_main_supplier/__init__.py create mode 100644 product_main_supplier/__manifest__.py create mode 100644 product_main_supplier/models/__init__.py create mode 100644 product_main_supplier/models/product_supplierinfo.py create mode 100644 product_main_supplier/models/product_template.py create mode 100644 product_main_supplier/readme/CONTRIBUTORS.rst create mode 100644 product_main_supplier/readme/DESCRIPTION.rst create mode 100644 product_main_supplier/readme/ROADMAP.rst create mode 100644 product_main_supplier/static/description/index.html rename {beesdoo_product => product_main_supplier}/tests/__init__.py (59%) create mode 100644 product_main_supplier/tests/test_main_seller_id.py rename {beesdoo_product => product_main_supplier}/tests/test_search_main_seller_product_code.py (90%) create mode 100644 product_main_supplier/views/product_template_views.xml create mode 100644 sale_adapt_price_wizard/README.rst create mode 100644 sale_adapt_price_wizard/__init__.py create mode 100644 sale_adapt_price_wizard/__manifest__.py create mode 100644 sale_adapt_price_wizard/models/__init__.py create mode 100644 sale_adapt_price_wizard/models/product_template.py create mode 100644 sale_adapt_price_wizard/models/res_config_settings.py create mode 100644 sale_adapt_price_wizard/readme/CONTRIBUTORS.rst create mode 100644 sale_adapt_price_wizard/readme/DESCRIPTION.rst create mode 100644 sale_adapt_price_wizard/static/description/index.html create mode 100644 sale_adapt_price_wizard/views/product_template_views.xml rename {beesdoo_product => sale_adapt_price_wizard}/views/purchase_views.xml (100%) create mode 100644 sale_adapt_price_wizard/views/res_config_settings_views.xml rename {beesdoo_product => sale_adapt_price_wizard}/views/sale_views.xml (100%) create mode 100644 sale_adapt_price_wizard/wizard/__init__.py rename {beesdoo_product => sale_adapt_price_wizard}/wizard/adapt_sales_price_wizard.py (100%) rename {beesdoo_product => sale_adapt_price_wizard}/wizard/views/adapt_sales_price_wizard_view.xml (94%) create mode 100644 sale_suggested_price/README.rst create mode 100644 sale_suggested_price/__init__.py create mode 100644 sale_suggested_price/__manifest__.py create mode 100644 sale_suggested_price/models/__init__.py create mode 100644 sale_suggested_price/models/product_category.py create mode 100644 sale_suggested_price/models/product_template.py rename {beesdoo_product => sale_suggested_price}/models/res_config_settings.py (59%) create mode 100644 sale_suggested_price/models/res_partner.py create mode 100644 sale_suggested_price/readme/CONTRIBUTORS.rst create mode 100644 sale_suggested_price/readme/DESCRIPTION.rst create mode 100644 sale_suggested_price/readme/ROADMAP.rst create mode 100644 sale_suggested_price/static/description/index.html create mode 100644 sale_suggested_price/tests/__init__.py rename {beesdoo_product => sale_suggested_price}/tests/test_suggested_price.py (94%) create mode 100644 sale_suggested_price/views/product_category_views.xml create mode 100644 sale_suggested_price/views/product_template_views.xml rename beesdoo_product/views/res_config_settings.xml => sale_suggested_price/views/res_config_settings_views.xml (73%) create mode 100644 sale_suggested_price/views/res_partner_views.xml create mode 120000 setup/product_main_supplier/odoo/addons/product_main_supplier create mode 100644 setup/product_main_supplier/setup.py create mode 120000 setup/sale_adapt_price_wizard/odoo/addons/sale_adapt_price_wizard create mode 100644 setup/sale_adapt_price_wizard/setup.py create mode 120000 setup/sale_suggested_price/odoo/addons/sale_suggested_price create mode 100644 setup/sale_suggested_price/setup.py diff --git a/.copier-answers.yml b/.copier-answers.yml index fa69ef5d7..146ff8738 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -11,7 +11,7 @@ org_slug: beescoop rebel_module_groups: - macavrac_base - polln_shift -repo_description: Specific module for the Beescoop +repo_description: Specific module for the BEES coop repo_name: Obeesdoo repo_slug: obeesdoo repo_website: https://coopiteasy.be diff --git a/beesdoo_account/__manifest__.py b/beesdoo_account/__manifest__.py index 5b7651f66..9ba5ca436 100644 --- a/beesdoo_account/__manifest__.py +++ b/beesdoo_account/__manifest__.py @@ -5,13 +5,13 @@ # - Augustin Borsu # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Beescoop Account Module", + "name": "BEES coop Account Module", "summary": """ - Makes date_invoice field required in account.invoice_form and account.invoice_supplier_form - Allow validating an invoice with a negative total amount """, - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Account Module", "version": "12.0.2.0.0", diff --git a/beesdoo_account/readme/CONTRIBUTORS.rst b/beesdoo_account/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_account/readme/CONTRIBUTORS.rst +++ b/beesdoo_account/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_base/__manifest__.py b/beesdoo_base/__manifest__.py index 7e04f4905..b10e3e71e 100644 --- a/beesdoo_base/__manifest__.py +++ b/beesdoo_base/__manifest__.py @@ -6,11 +6,11 @@ # - Thibault François # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Beescoop Base Module", + "name": "BEES coop Base Module", "summary": """ Module that customize the base module and contains some python tools """, - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Sales", "version": "12.0.2.0.0", diff --git a/beesdoo_crelan_csv/__manifest__.py b/beesdoo_crelan_csv/__manifest__.py index ddd3aaf5a..3db696343 100644 --- a/beesdoo_crelan_csv/__manifest__.py +++ b/beesdoo_crelan_csv/__manifest__.py @@ -3,11 +3,11 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Beescoop Crelan Import module", + "name": "BEES coop Crelan Import module", "summary": """ Import Crelan CSV Wizard """, - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Accounting & Finance", "version": "12.0.1.0.0", diff --git a/beesdoo_crelan_csv/readme/CONTRIBUTORS.rst b/beesdoo_crelan_csv/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_crelan_csv/readme/CONTRIBUTORS.rst +++ b/beesdoo_crelan_csv/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_easy_my_coop/README.rst b/beesdoo_easy_my_coop/README.rst index 2a9b46f04..015fa684b 100644 --- a/beesdoo_easy_my_coop/README.rst +++ b/beesdoo_easy_my_coop/README.rst @@ -42,13 +42,13 @@ Credits Authors ~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Contributors ~~~~~~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Maintainers diff --git a/beesdoo_easy_my_coop/__manifest__.py b/beesdoo_easy_my_coop/__manifest__.py index f899c0a7d..9f61a357e 100644 --- a/beesdoo_easy_my_coop/__manifest__.py +++ b/beesdoo_easy_my_coop/__manifest__.py @@ -1,5 +1,5 @@ { - "name": "Beescoop link with easy my coop", + "name": "BEES coop link with easy my coop", "summary": """Link between beesdoo customization and easy_my_coop""", "author": "BEES coop, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", diff --git a/beesdoo_inventory/__manifest__.py b/beesdoo_inventory/__manifest__.py index 9fa6c5279..87eac42b0 100644 --- a/beesdoo_inventory/__manifest__.py +++ b/beesdoo_inventory/__manifest__.py @@ -8,7 +8,7 @@ "name": "Beesdoo Inventory", "summary": "Restrict selectable products to those" " sold as main supplier by the picking partner.", - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Inventory", "version": "12.0.3.0.1", diff --git a/beesdoo_inventory/readme/CONTRIBUTORS.rst b/beesdoo_inventory/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_inventory/readme/CONTRIBUTORS.rst +++ b/beesdoo_inventory/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_pos/__manifest__.py b/beesdoo_pos/__manifest__.py index 95040e32c..17399cf17 100644 --- a/beesdoo_pos/__manifest__.py +++ b/beesdoo_pos/__manifest__.py @@ -8,10 +8,10 @@ # - Houssine Bakkali # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Beescoop Point of sale", + "name": "BEES coop Point of sale", "summary": """This module adds the eaters of the customer to the POS ActionpadWidget and PaymentScreenWidget.""", - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Point Of Sale", "version": "12.0.2.0.0", diff --git a/beesdoo_pos/readme/CONTRIBUTORS.rst b/beesdoo_pos/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_pos/readme/CONTRIBUTORS.rst +++ b/beesdoo_pos/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_pos_coop_status/__manifest__.py b/beesdoo_pos_coop_status/__manifest__.py index b97809736..c5a34f8b9 100644 --- a/beesdoo_pos_coop_status/__manifest__.py +++ b/beesdoo_pos_coop_status/__manifest__.py @@ -4,7 +4,7 @@ { - "name": "Beescoop Point of sale - Cooperator Status", + "name": "BEES coop Point of sale - Cooperator Status", "summary": """POS Support for cooperator status.""", "author": "Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", diff --git a/beesdoo_pos_email_ticket/__manifest__.py b/beesdoo_pos_email_ticket/__manifest__.py index ef59c5fed..efceeecbd 100644 --- a/beesdoo_pos_email_ticket/__manifest__.py +++ b/beesdoo_pos_email_ticket/__manifest__.py @@ -7,10 +7,10 @@ # - Grégoire Leeuwerck # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Beescoop Send POS ticket by email", + "name": "BEES coop Send POS ticket by email", "summary": """This module adds the eaters of the customer to the POS ActionpadWidget and PaymentScreenWidget.""", - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Point Of Sale", "version": "12.0.1.1.0", diff --git a/beesdoo_pos_email_ticket/readme/CONTRIBUTORS.rst b/beesdoo_pos_email_ticket/readme/CONTRIBUTORS.rst index 7c5c58643..7fcc7a651 100644 --- a/beesdoo_pos_email_ticket/readme/CONTRIBUTORS.rst +++ b/beesdoo_pos_email_ticket/readme/CONTRIBUTORS.rst @@ -1,3 +1,3 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC * Thibault Francois diff --git a/beesdoo_pos_reporting/readme/CONTRIBUTORS.rst b/beesdoo_pos_reporting/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_pos_reporting/readme/CONTRIBUTORS.rst +++ b/beesdoo_pos_reporting/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_print_label/data/product_print_category.xml b/beesdoo_print_label/data/product_print_category.xml index e98f3a405..a121d211c 100644 --- a/beesdoo_print_label/data/product_print_category.xml +++ b/beesdoo_print_label/data/product_print_category.xml @@ -8,7 +8,7 @@ name="field_ids" eval="[(6, 0, [ ref('product.field_product_template__name'), - ref('beesdoo_product.field_product_template__main_seller_id'), + ref('product_main_supplier.field_product_template__main_seller_id'), ref('beesdoo_product.field_product_template__eco_label'), ref('beesdoo_product.field_product_template__local_label'), ref('beesdoo_product.field_product_template__fair_label'), diff --git a/beesdoo_product/__manifest__.py b/beesdoo_product/__manifest__.py index 792358087..45bca15d9 100644 --- a/beesdoo_product/__manifest__.py +++ b/beesdoo_product/__manifest__.py @@ -12,15 +12,18 @@ "summary": """ Modification of product module for the needs of beescoop """, - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Sales", - "version": "12.0.1.4.1", + "version": "12.0.2.0.0", "depends": [ "product", "sale", "point_of_sale", "purchase", + "product_main_supplier", + "sale_suggested_price", + "sale_adapt_price_wizard", ], "data": [ "data/product_label.xml", @@ -28,12 +31,7 @@ "data/barcode_rule.xml", "data/product_sequence.xml", "views/beesdoo_product.xml", - "views/point_of_sale_view.xml", - "views/purchase_views.xml", - "views/sale_views.xml", "views/assets.xml", - "views/res_config_settings.xml", - "wizard/views/adapt_sales_price_wizard_view.xml", "wizard/views/label_printing_utils.xml", "security/ir.model.access.csv", ], diff --git a/beesdoo_product/migrations/12.0.2.0.0/pre-migration.py b/beesdoo_product/migrations/12.0.2.0.0/pre-migration.py new file mode 100644 index 000000000..17a545729 --- /dev/null +++ b/beesdoo_product/migrations/12.0.2.0.0/pre-migration.py @@ -0,0 +1,55 @@ +import logging + +from openupgradelib import openupgrade + +_logger = logging.getLogger(__name__ + " 12.0.2.0.0") + + +renamed_view_xml_ids = ( + ( + "beesdoo_product.beesdoo_product_category_form", + "sale_suggested_price.product_category_form_view", + ), + ( + "beesdoo_product.product_template_edit_price_tree_view", + "sale_suggested_price.product_template_edit_price_tree_view", + ), + ( + "beesdoo_product.beesdoo_product_category_list", + "sale_suggested_price.product_category_list_view", + ), + ( + "beesdoo_product.beesdoo_product_supplierinfo_tree_view", + "sale_suggested_price.product_supplierinfo_tree_view", + ), + ( + "beesdoo_product.product_template_edit_price_tree_view", + "sale_suggested_price.product_template_edit_price_tree_view", + ), + ( + "beesdoo_product.beesdoo_product_res_parter_form", + "sale_suggested_price.view_partner_form", + ), + ( + "beesdoo_product.res_config_settings_view_form", + "sale_suggested_price.res_config_settings_view_form", + ), +) + +modules_to_install = [ + "sale_suggested_price", + "product_main_suplier", +] + + +@openupgrade.migrate() +def migrate(env, version): + _logger.info("renaming view xml ids") + openupgrade.rename_xmlids(env.cr, renamed_view_xml_ids) + + for module in modules_to_install: + module_ids = env["ir.module.module"].search( + [("name", "=", module), ("state", "=", "uninstalled")] + ) + if module_ids: + module_ids.button_install() diff --git a/beesdoo_product/models/__init__.py b/beesdoo_product/models/__init__.py index b641813ab..0494b5ef9 100644 --- a/beesdoo_product/models/__init__.py +++ b/beesdoo_product/models/__init__.py @@ -1,2 +1 @@ from . import beesdoo_product -from . import res_config_settings diff --git a/beesdoo_product/models/beesdoo_product.py b/beesdoo_product/models/beesdoo_product.py index 1747253b0..d11a31f9d 100644 --- a/beesdoo_product/models/beesdoo_product.py +++ b/beesdoo_product/models/beesdoo_product.py @@ -3,11 +3,9 @@ import logging import uuid -from datetime import date from odoo import api, fields, models -from odoo.exceptions import UserError, ValidationError -from odoo.tools import float_round +from odoo.exceptions import UserError from odoo.tools.translate import _ from odoo.addons import decimal_precision as dp @@ -15,19 +13,6 @@ _logger = logging.getLogger(__name__) -class ResPartner(models.Model): - _inherit = "res.partner" - - profit_margin = fields.Float(string="Product Margin [%]") - - @api.multi - @api.constrains("profit_margin") - def _check_margin(self): - for product in self: - if product.profit_margin < 0.0: - raise UserError(_("Percentages for Profit Margin must >= 0.")) - - class BeesdooProductHazard(models.Model): _name = "beesdoo.product.hazard" _description = "beesdoo.product.hazard" @@ -64,21 +49,6 @@ class BeesdooProduct(models.Model): translate=True, ) - top_supplierinfo_id = fields.Many2one( - comodel_name="product.supplierinfo", - compute="_compute_main_seller_id", - store=True, - ) - main_seller_id = fields.Many2one( - string="Main Seller", - comodel_name="res.partner", - related="top_supplierinfo_id.name", - ) - main_seller_id_product_code = fields.Char( - string="Main Seller Product Code", - related="top_supplierinfo_id.product_code", - ) - display_unit = fields.Many2one("uom.uom") default_reference_unit = fields.Many2one("uom.uom") display_weight = fields.Float( @@ -111,17 +81,6 @@ class BeesdooProduct(models.Model): note = fields.Text("Comments", copy=False) - suggested_price = fields.Float( - string="Suggested Price", - compute="_compute_cost", - readOnly=True, - help=""" - This field computes a suggested price based on the 'Product Margin' - field on Partners (Vendors), if it's set, or otherwise on the 'Product - Margin' field in Product Categories (which has a default value). - """, - ) - deadline_for_sale = fields.Integer(string="Deadline for sale(days)") deadline_for_consumption = fields.Integer(string="Deadline for consumption(days)") ingredients = fields.Char(string="Ingredient") @@ -142,16 +101,6 @@ class BeesdooProduct(models.Model): compute="_compute_purchase_price", inverse="_inverse_purchase_price", ) - purchase_price_write_date = fields.Datetime( - string="Purchase Price Last Updated On", - compute="_compute_purchase_price_write_date", - readonly=True, - ) - list_price_write_date = fields.Datetime( - string="Sales Price Last Updated On", - default=fields.Datetime.now, - readonly=True, - ) @api.depends("uom_id", "uom_id.category_id", "uom_id.category_id.type") @api.multi @@ -162,23 +111,6 @@ def _compute_scale_sale_uom(self): elif product.uom_id.category_id.type == "weight": product.scale_sale_unit = "P" - def _get_main_supplier_info(self): - # fixme this function either returns a supplier or a collection. - # wouldn’t it be more logical to return a supplier or None? - - # supplierinfo w/o date_start come first - def sort_date_first(seller): - if seller.date_start: - return seller.date_start - else: - return date.max - - suppliers = self.seller_ids.sorted(key=sort_date_first, reverse=True) - if suppliers: - return suppliers[0] - else: - return suppliers - @api.multi def generate_barcode(self): self.ensure_one() @@ -217,18 +149,6 @@ def generate_barcode(self): _logger.info("barcode :", bc) self.barcode = bc - @api.multi - @api.depends("seller_ids", "seller_ids.date_start") - def _compute_main_seller_id(self): - for product in self: - # todo english code Calcule le vendeur associé qui a la date de - # début la plus récente et plus petite qu’aujourd’hui fixme - # could product.main_seller_id be used instead? it seems that - # “seller” and “supplier” are used interchangeably in this - # class. is this on purpose? - sellers_ids = product._get_main_supplier_info() - product.top_supplierinfo_id = sellers_ids and sellers_ids[0] or False - @api.multi @api.depends( "taxes_id", @@ -308,140 +228,6 @@ def _unit_same_category(self): ) ) - # fixme rename to _compute_suggested_price - # fixme move to new module product_suggested_price - # or sale_suggested_price - @api.multi - @api.depends( - "seller_ids", - "supplier_taxes_id", - "taxes_id", - "uom_id", - "uom_po_id", - "categ_id.should_round_suggested_price", - ) - def _compute_cost(self): - for product in self: - try: - product.suggested_price = product.calculate_suggested_price() - except ValueError: - pass - - @api.multi - @api.depends("seller_ids") - def _compute_purchase_price(self): - for product in self: - supplierinfo = product._get_main_supplier_info() - if supplierinfo: - product.purchase_price = supplierinfo.price - else: - product.purchase_price = 0 - - @api.multi - def _inverse_purchase_price(self): - for product in self: - supplierinfo = product._get_main_supplier_info() - if supplierinfo: - supplierinfo.price = product.purchase_price - else: - raise ValidationError( - _("No Vendor defined for product '%s'") % product.name - ) - - @api.multi - @api.depends("purchase_price", "seller_ids") - def _compute_purchase_price_write_date(self): - for product in self: - supplierinfo = product._get_main_supplier_info() - product.purchase_price_write_date = supplierinfo.price_write_date - - def write(self, vals): - if ( - self.env["ir.config_parameter"] - .sudo() - .get_param("beesdoo_product.auto_write_suggested_price") - ): - purchase_price = vals.get("purchase_price") - if purchase_price and purchase_price != self.purchase_price: - # force update of purchase_price (which actually modifies the - # suppliers’ price) to ensure that the next computations that - # depend on it are correct. there are 3 things to do: - # 1. set value in cache - with self.env.do_in_draft(): - self.purchase_price = purchase_price - # 2. call inverse compute method - self._inverse_purchase_price() - # 3. remove the value from vals, to avoid the process to happen a - # second time - del vals["purchase_price"] - - # Important note: The list price is _only_ changed here if the - # `purchase_price` field of the product is changed. If the - # `price` field of the supplierinfo changes normally, the list price - # here is NOT automatically affected. - self.adapt_list_price(vals) - - list_price = vals.get("list_price") - if list_price and list_price != self.list_price: - vals["list_price_write_date"] = fields.Datetime.now() - - super().write(vals) - - @api.multi - def adapt_list_price(self, vals, suggested_price=None): - self.ensure_one() - if suggested_price is None: - suggested_price = self.suggested_price - vals.setdefault("list_price", suggested_price) - - @api.multi - def calculate_suggested_price(self, price=None): - self.ensure_one() - suggested_price_reference = ( - self.env["ir.config_parameter"] - .sudo() - .get_param("beesdoo_product.suggested_price_reference") - ) - supplier = self._get_main_supplier_info() - if not supplier: - raise ValueError(_("No supplier found for product {}").format(self.id)) - if price is None: - price = supplier.price - product_category = supplier.product_tmpl_id.categ_id - supplier_taxes = self.supplier_taxes_id.filtered( - lambda t: t.amount_type == "percent" and t.price_include - ) - supplier_taxes_factor = 1 / (1 + sum(supplier_taxes.mapped("amount")) / 100) - sale_taxes = self.taxes_id.filtered( - lambda t: t.amount_type == "percent" and t.price_include - ) - sale_taxes_factor = 1 + sum(sale_taxes.mapped("amount")) / 100 - profit_margin_supplier = supplier.name.profit_margin - profit_margin_product_category = product_category.profit_margin - profit_margin = profit_margin_supplier or profit_margin_product_category - profit_margin_factor = ( - 1 / (1 - profit_margin / 100) - if suggested_price_reference == "sale_price" - else (1 + profit_margin / 100) - ) - - # price of purchase is given for uom_po_id - # suggested *sale* price must be adapted to uom_id - uom_factor = self.uom_po_id.factor / self.uom_id.factor - - suggested_price = ( - price - * uom_factor - * supplier_taxes_factor - * sale_taxes_factor - * profit_margin_factor - ) - - if product_category.should_round_suggested_price: - suggested_price = product_category._round(suggested_price) - - return suggested_price - @api.multi def create_request_label_printing_wizard(self): context = {"active_ids": self.ids} @@ -493,53 +279,6 @@ class BeesdooProductLabel(models.Model): active = fields.Boolean(default=True) -class BeesdooProductCategory(models.Model): - _inherit = "product.category" - - profit_margin = fields.Float(default="10.0", string="Product Margin [%]") - should_round_suggested_price = fields.Boolean(string="Round suggested price ?") - rounding_method = fields.Selection( - [("HALF-UP", "Half"), ("UP", "up"), ("DOWN", "down")], - default="HALF-UP", - ) - rounding_precision = fields.Float(default=0.05) - - @api.multi - @api.constrains("profit_margin") - def _check_margin(self): - for product in self: - if product.profit_margin < 0.0: - raise UserError(_("Percentages for Profit Margin must >= 0.")) - - def _round(self, price): - self.ensure_one() - # Use default value 0.05 and "HALF_UP" - # in case someone erase the value on the category - # Keep default value on the field to make it explicit to the end user - return float_round( - price, - precision_rounding=self.rounding_precision or 0.05, - rounding_method=self.rounding_method or "HALF_UP", - ) - - -class BeesdooProductSupplierInfo(models.Model): - _inherit = "product.supplierinfo" - - price = fields.Float("Price") - price_write_date = fields.Datetime( - string="Price Last Updated On", - default=fields.Datetime.now, - readonly=True, - ) - - def write(self, vals): - price = vals.get("price") - if price and price != self.price: - vals["price_write_date"] = fields.Datetime.now() - super().write(vals) - - class BeesdooUOMCateg(models.Model): _inherit = "uom.category" diff --git a/beesdoo_product/readme/CONTRIBUTORS.rst b/beesdoo_product/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_product/readme/CONTRIBUTORS.rst +++ b/beesdoo_product/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_product/readme/DESCRIPTION.rst b/beesdoo_product/readme/DESCRIPTION.rst index e7d0fbf0f..e371775be 100644 --- a/beesdoo_product/readme/DESCRIPTION.rst +++ b/beesdoo_product/readme/DESCRIPTION.rst @@ -2,7 +2,6 @@ Modification of product module for the needs of beescoop - Adds the label bio/ethique/provenance. - Adds hazard and FDS labels. -- Adds a main seller. - Calculates total price with VAT and deposit price. - Contains some facilitation for label printing. - Adds a 'Comments' field for use on labels. @@ -10,34 +9,10 @@ Modification of product module for the needs of beescoop - Adds an 'Ingredients' field. - Adds scale labels, sale units, and categories. - Generates barcodes. -- Adds 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. -- Round suggested price to 5 cents -- Adds "Edit Price" submenu on Point Of Sale, Purchase and Sale modules. - The user lands on an editable List View with the following columns : - Name (`name`) - - Main Seller (`main_seller_id`) - Purchase Price (`purchase_price`) - Purchase Unit of Measure (`uom_po_id`) - - Suggested Price (`suggested_price`) - - Sales Price (`list_price`) - Unit of Measure (`uom_id`) The only editable field is Purchase Price. - Through "Action > Adapt Sales Price", the user can, on the selected products, - adapt the Sales Price according to the Suggested Price. - Alternatively, 'Automatically write suggested price' can be enabled to make - this last step automatic. -- Allow searching a product given the product reference of the main - seller (also known as the `product_code` of the `product.supplierinfo` - object). - -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 - occur as duplicated products with one supplier each. diff --git a/beesdoo_product/views/beesdoo_product.xml b/beesdoo_product/views/beesdoo_product.xml index f199f031e..fc4285c13 100644 --- a/beesdoo_product/views/beesdoo_product.xml +++ b/beesdoo_product/views/beesdoo_product.xml @@ -14,13 +14,6 @@ attrs="{'invisible' : [('barcode','!=',False)]}" /> - - - 1 @@ -120,41 +113,6 @@ - - product.template.edit.price.tree - product.template - - - - - - - - - - - - - - - - bees.product.label.form beesdoo.product.label @@ -211,50 +169,7 @@ - - beesdoo.product.category.list - product.category - - - - - - - - - - - beesdoo.product.category.form - product.category - - - - - - - - - - - - - beesdoo.product.supplierinfo.tree - product.supplierinfo - - - - - - - - Product Labels @@ -295,17 +210,6 @@ - - res.partner.form - res.partner - - - - - - - - beesdoo.scale.category.list beesdoo.scale.category diff --git a/beesdoo_product/views/point_of_sale_view.xml b/beesdoo_product/views/point_of_sale_view.xml deleted file mode 100644 index aa02c9f8b..000000000 --- a/beesdoo_product/views/point_of_sale_view.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - Products - ir.actions.act_window - product.template - form - tree - {} - - - -

- Create a new product -

- You must define a product for everything you purchase, - whether it's a physical product, a consumable or services. -

-
-
- - - - -
diff --git a/beesdoo_product/wizard/__init__.py b/beesdoo_product/wizard/__init__.py index 79a212be7..0d01ffadb 100644 --- a/beesdoo_product/wizard/__init__.py +++ b/beesdoo_product/wizard/__init__.py @@ -1,2 +1 @@ from . import label_printing_utils -from . import adapt_sales_price_wizard diff --git a/beesdoo_product_usability/README.rst b/beesdoo_product_usability/README.rst index 087f8b7f8..8d308996f 100644 --- a/beesdoo_product_usability/README.rst +++ b/beesdoo_product_usability/README.rst @@ -1,5 +1,5 @@ =========================== -BEES coop Product Usability +Beescoop Product Usability =========================== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/beesdoo_product_usability/__manifest__.py b/beesdoo_product_usability/__manifest__.py index e016d46bc..2eee8f6b9 100644 --- a/beesdoo_product_usability/__manifest__.py +++ b/beesdoo_product_usability/__manifest__.py @@ -5,7 +5,7 @@ "summary": """ Adapt the product views. """, - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Sales Management", "version": "12.0.1.1.0", diff --git a/beesdoo_product_usability/readme/CONTRIBUTORS.rst b/beesdoo_product_usability/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_product_usability/readme/CONTRIBUTORS.rst +++ b/beesdoo_product_usability/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_purchase/__manifest__.py b/beesdoo_purchase/__manifest__.py index d55b81574..3b8038885 100644 --- a/beesdoo_purchase/__manifest__.py +++ b/beesdoo_purchase/__manifest__.py @@ -4,7 +4,7 @@ Enhancements related to Purchase module : field, filter, PO reference, product's purchase and/or selling price """, - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Purchase", "version": "12.0.1.4.0", diff --git a/beesdoo_purchase/readme/CONTRIBUTORS.rst b/beesdoo_purchase/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_purchase/readme/CONTRIBUTORS.rst +++ b/beesdoo_purchase/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_shift/__manifest__.py b/beesdoo_shift/__manifest__.py index d3c967c9d..b77cb6a49 100644 --- a/beesdoo_shift/__manifest__.py +++ b/beesdoo_shift/__manifest__.py @@ -4,7 +4,7 @@ { - "name": "Beescoop Shift Management", + "name": "BEES coop Shift Management", "summary": """Generate and manage shifts for cooperators.""", "author": "Thibault Francois, Elouan Le Bars, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", diff --git a/beesdoo_shift/readme/CONTRIBUTORS.rst b/beesdoo_shift/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_shift/readme/CONTRIBUTORS.rst +++ b/beesdoo_shift/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_shift_attendance/README.rst b/beesdoo_shift_attendance/README.rst index efff066b1..82f0df673 100644 --- a/beesdoo_shift_attendance/README.rst +++ b/beesdoo_shift_attendance/README.rst @@ -20,7 +20,7 @@ Beescoop Shift Attendance Sheet |badge1| |badge2| |badge3| Volonteer Timetable Management -Attendance Sheet for BEES coop +Attendance Sheet for Beescoop **Table of contents** diff --git a/beesdoo_shift_attendance/__manifest__.py b/beesdoo_shift_attendance/__manifest__.py index 171c0c4f8..c4c4b7f78 100644 --- a/beesdoo_shift_attendance/__manifest__.py +++ b/beesdoo_shift_attendance/__manifest__.py @@ -4,7 +4,7 @@ # this module can be splitted into a generic part, and a specific part # that implement the worker_status rules. { - "name": "Beescoop Shift Attendance Sheet", + "name": "BEES coop Shift Attendance Sheet", "summary": """ Volonteer Timetable Management Attendance Sheet for BEES coop""", diff --git a/beesdoo_shift_attendance/readme/CONTRIBUTORS.rst b/beesdoo_shift_attendance/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_shift_attendance/readme/CONTRIBUTORS.rst +++ b/beesdoo_shift_attendance/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_shift_welcome_screen/__manifest__.py b/beesdoo_shift_welcome_screen/__manifest__.py index 8a9c4ffa1..03846ebfc 100644 --- a/beesdoo_shift_welcome_screen/__manifest__.py +++ b/beesdoo_shift_welcome_screen/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - "name": "Beescoop Shift Management - Welcome Screen", + "name": "BEES coop Shift Management - Welcome Screen", "summary": """ Volunteer Timetable Management""", "author": "Thibault Francois, Coop IT Easy SC", diff --git a/beesdoo_stock/README.rst b/beesdoo_stock/README.rst index 6241d3ad7..414aeb868 100644 --- a/beesdoo_stock/README.rst +++ b/beesdoo_stock/README.rst @@ -1,5 +1,5 @@ =============== -BEES coop Stock +Beescoop Stock =============== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/beesdoo_stock/readme/CONTRIBUTORS.rst b/beesdoo_stock/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_stock/readme/CONTRIBUTORS.rst +++ b/beesdoo_stock/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_website_eater/README.rst b/beesdoo_website_eater/README.rst index e6f248918..05b5e2a88 100644 --- a/beesdoo_website_eater/README.rst +++ b/beesdoo_website_eater/README.rst @@ -1,5 +1,5 @@ ======================= -BEES coop Website Eater +Beescoop Website Eater ======================= .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/beesdoo_website_eater/readme/CONTRIBUTORS.rst b/beesdoo_website_eater/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_website_eater/readme/CONTRIBUTORS.rst +++ b/beesdoo_website_eater/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_website_posorder_amount/readme/CONTRIBUTORS.rst b/beesdoo_website_posorder_amount/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_website_posorder_amount/readme/CONTRIBUTORS.rst +++ b/beesdoo_website_posorder_amount/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_website_shift/README.rst b/beesdoo_website_shift/README.rst index c65f4b895..c680dac6b 100644 --- a/beesdoo_website_shift/README.rst +++ b/beesdoo_website_shift/README.rst @@ -1,5 +1,5 @@ ======================= -BEES coop Website Shift +Beescoop Website Shift ======================= .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/beesdoo_website_shift/readme/CONTRIBUTORS.rst b/beesdoo_website_shift/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_website_shift/readme/CONTRIBUTORS.rst +++ b/beesdoo_website_shift/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_website_theme/README.rst b/beesdoo_website_theme/README.rst index 26aa993f7..7c2ab2fbf 100644 --- a/beesdoo_website_theme/README.rst +++ b/beesdoo_website_theme/README.rst @@ -1,5 +1,5 @@ ======================= -BEES coop Website Theme +Beescoop Website Theme ======================= .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -19,7 +19,7 @@ BEES coop Website Theme |badge1| |badge2| |badge3| -Apply BEES coop design rules. +Apply Beescoop design rules. **Table of contents** diff --git a/beesdoo_website_theme/readme/CONTRIBUTORS.rst b/beesdoo_website_theme/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_website_theme/readme/CONTRIBUTORS.rst +++ b/beesdoo_website_theme/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_worker_status/__manifest__.py b/beesdoo_worker_status/__manifest__.py index 12e7a9382..ab7e8e967 100644 --- a/beesdoo_worker_status/__manifest__.py +++ b/beesdoo_worker_status/__manifest__.py @@ -2,7 +2,7 @@ # Elouan Le Bars # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - "name": "Beescoop Worker Status manager", + "name": "BEES coop Worker Status manager", "summary": """ Worker status management specific to beescoop.""", "author": "Thibault Francois, Elouan Le Bars, Coop IT Easy SC", diff --git a/beesdoo_worker_status/readme/CONTRIBUTORS.rst b/beesdoo_worker_status/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/beesdoo_worker_status/readme/CONTRIBUTORS.rst +++ b/beesdoo_worker_status/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/beesdoo_worker_status_shift_swap/__manifest__.py b/beesdoo_worker_status_shift_swap/__manifest__.py index 79dc2590b..95d8e3153 100644 --- a/beesdoo_worker_status_shift_swap/__manifest__.py +++ b/beesdoo_worker_status_shift_swap/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - "name": "Beescoop Worker Status manager for beesdoo_shift_swap", + "name": "BEES coop Worker Status manager for beesdoo_shift_swap", "summary": """Worker status management specific to shift exchanges.""", "author": "Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", diff --git a/cooperator_eater/README.rst b/cooperator_eater/README.rst index c5aa2b9a6..5f74d8b5e 100644 --- a/cooperator_eater/README.rst +++ b/cooperator_eater/README.rst @@ -44,13 +44,13 @@ Credits Authors ~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Contributors ~~~~~~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Maintainers diff --git a/cooperator_info_session/README.rst b/cooperator_info_session/README.rst index 083e5f64a..9bbc2e1e8 100644 --- a/cooperator_info_session/README.rst +++ b/cooperator_info_session/README.rst @@ -46,13 +46,13 @@ Credits Authors ~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Contributors ~~~~~~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Maintainers diff --git a/cooperator_worker/README.rst b/cooperator_worker/README.rst index b3a0f5159..248e21abd 100644 --- a/cooperator_worker/README.rst +++ b/cooperator_worker/README.rst @@ -44,13 +44,13 @@ Credits Authors ~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Contributors ~~~~~~~~~~~~ -* BEES coop +* Beescoop * Coop IT Easy SC Maintainers diff --git a/eater/__manifest__.py b/eater/__manifest__.py index 07cd8d8ae..3546ef588 100644 --- a/eater/__manifest__.py +++ b/eater/__manifest__.py @@ -8,7 +8,7 @@ { "name": "Eater", "summary": "Add eaters to the workers of your structure.", - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Sales", "version": "12.0.1.0.0", diff --git a/eater/readme/CONTRIBUTORS.rst b/eater/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/eater/readme/CONTRIBUTORS.rst +++ b/eater/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/eater_member_card/__manifest__.py b/eater_member_card/__manifest__.py index 7d76da755..262ac8f6f 100644 --- a/eater_member_card/__manifest__.py +++ b/eater_member_card/__manifest__.py @@ -7,7 +7,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Eater Member Card", - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "summary": "Compute barcode based on eaters", "website": "https://github.com/beescoop/Obeesdoo", "category": "Sales", diff --git a/eater_member_card/readme/CONTRIBUTORS.rst b/eater_member_card/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/eater_member_card/readme/CONTRIBUTORS.rst +++ b/eater_member_card/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/member_card/__manifest__.py b/member_card/__manifest__.py index 28751d248..d4b65b32b 100644 --- a/member_card/__manifest__.py +++ b/member_card/__manifest__.py @@ -7,7 +7,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Member Card", - "author": "Beescoop - Cellule IT, Coop IT Easy SC", + "author": "BEES coop - Cellule IT, Coop IT Easy SC", "summary": "Create a member card and link it to a partner.", "website": "https://github.com/beescoop/Obeesdoo", "category": "Sales", diff --git a/member_card/readme/CONTRIBUTORS.rst b/member_card/readme/CONTRIBUTORS.rst index 7e5b98731..5cf09c295 100644 --- a/member_card/readme/CONTRIBUTORS.rst +++ b/member_card/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ -* Beescoop - Cellule IT +* BEES coop - Cellule IT * Coop IT Easy SC diff --git a/product_main_supplier/README.rst b/product_main_supplier/README.rst new file mode 100644 index 000000000..d88674aba --- /dev/null +++ b/product_main_supplier/README.rst @@ -0,0 +1,58 @@ +===================== +Product Main Supplier +===================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-coopiteasy%2Fobeesdoo-lightgray.png?logo=github + :target: https://github.com/coopiteasy/obeesdoo/tree/12.0/product_main_supplier + :alt: coopiteasy/obeesdoo + +|badge1| |badge2| |badge3| + +Add a main supplier + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Coop IT Easy SCRLfs + +Contributors +~~~~~~~~~~~~ + +* Beescoop - Cellule IT +* `Coop IT Easy SCRLfs `_: + +Maintainers +~~~~~~~~~~~ + +This module is part of the `coopiteasy/obeesdoo `_ project on GitHub. + +You are welcome to contribute. diff --git a/product_main_supplier/__init__.py b/product_main_supplier/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/product_main_supplier/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_main_supplier/__manifest__.py b/product_main_supplier/__manifest__.py new file mode 100644 index 000000000..e8609e461 --- /dev/null +++ b/product_main_supplier/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2022 Coop IT Easy SCRLfs +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Product Main Supplier", + "summary": "Add a main supplier", + "version": "12.0.1.0.0", + "category": "Sales", + "website": "https://github.com/beescoop/Obeesdoo", + "author": "Coop IT Easy SC", + "license": "AGPL-3", + "application": False, + "depends": [ + "product", + ], + "excludes": [], + "data": ["views/product_template_views.xml"], + "demo": [], + "qweb": [], +} diff --git a/product_main_supplier/models/__init__.py b/product_main_supplier/models/__init__.py new file mode 100644 index 000000000..be0e02ac6 --- /dev/null +++ b/product_main_supplier/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_template +from . import product_supplierinfo diff --git a/product_main_supplier/models/product_supplierinfo.py b/product_main_supplier/models/product_supplierinfo.py new file mode 100644 index 000000000..f204b8024 --- /dev/null +++ b/product_main_supplier/models/product_supplierinfo.py @@ -0,0 +1,21 @@ +# Copyright 2020 Coop IT Easy SCRL fs +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models +from odoo.tools import float_compare + + +class ProductSupplierInfo(models.Model): + _inherit = "product.supplierinfo" + + price_write_date = fields.Datetime( + string="Price Last Updated On", + default=fields.Datetime.now, + readonly=True, + ) + + def write(self, vals): + price = vals.get("price") + precision = self.env["decimal.precision"].precision_get("Product Price") + if price and float_compare(price, self.price, precision) != 0: + vals["price_write_date"] = fields.Datetime.now() + return super().write(vals) diff --git a/product_main_supplier/models/product_template.py b/product_main_supplier/models/product_template.py new file mode 100644 index 000000000..ef611ec91 --- /dev/null +++ b/product_main_supplier/models/product_template.py @@ -0,0 +1,58 @@ +# Copyright 2020 Coop IT Easy SCRL fs +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +import datetime + +from odoo import api, fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + main_supplierinfo_id = fields.Many2one( + comodel_name="product.supplierinfo", + compute="_compute_main_supplierinfo_id", + store=True, + ) + # main_seller_id is used as there exist a seller_ids that + # links to all the supplierinfo_ids + main_seller_id = fields.Many2one( + string="Main Seller", + comodel_name="res.partner", + related="main_supplierinfo_id.name", + store=True, + ) + main_seller_id_product_code = fields.Char( + string="Main Seller Product Code", + related="main_supplierinfo_id.product_code", + store=True, + ) + + @api.multi + @api.depends("seller_ids", "seller_ids.date_start") + def _compute_main_supplierinfo_id(self): + for product in self: + product.main_supplierinfo_id = product._get_main_supplier_info() + + def _get_main_supplier_info(self): + """Return the main supplierinfo linked to this product. + + The main supplierinfo is the most recent one based on the + supplierinfo.date_start. If date_start is empty then the + supplier is considered to be the most recent one. + + If there is no supplierinfo then it returns an empty recordset. + """ + self.ensure_one() + + # supplierinfo w/o date_start come first + def sort_date_asc(seller): + if seller.date_start: + return seller.date_start + else: + return datetime.date.max + + suppliers = self.seller_ids.sorted(key=sort_date_asc, reverse=True) + if suppliers: + return suppliers[0] + else: + return suppliers diff --git a/product_main_supplier/readme/CONTRIBUTORS.rst b/product_main_supplier/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..0fbcb4e37 --- /dev/null +++ b/product_main_supplier/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* BEES coop - Cellule IT +* `Coop IT Easy SCRLfs `_: diff --git a/product_main_supplier/readme/DESCRIPTION.rst b/product_main_supplier/readme/DESCRIPTION.rst new file mode 100644 index 000000000..470e0e253 --- /dev/null +++ b/product_main_supplier/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +- Add a main supplier +- Allow searching a product given the product reference of the main + supplier (also known as the `product_code` of the `product.supplierinfo` + object). diff --git a/product_main_supplier/readme/ROADMAP.rst b/product_main_supplier/readme/ROADMAP.rst new file mode 100644 index 000000000..e69de29bb diff --git a/product_main_supplier/static/description/index.html b/product_main_supplier/static/description/index.html new file mode 100644 index 000000000..728817a24 --- /dev/null +++ b/product_main_supplier/static/description/index.html @@ -0,0 +1,415 @@ + + + + + + +Product Main Supplier + + + +
+

Product Main Supplier

+ + +

Beta License: AGPL-3 coopiteasy/obeesdoo

+

Add a main supplier

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SCRLfs
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the coopiteasy/obeesdoo project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/beesdoo_product/tests/__init__.py b/product_main_supplier/tests/__init__.py similarity index 59% rename from beesdoo_product/tests/__init__.py rename to product_main_supplier/tests/__init__.py index edea4ba9c..739066059 100644 --- a/beesdoo_product/tests/__init__.py +++ b/product_main_supplier/tests/__init__.py @@ -1,2 +1,2 @@ from . import test_search_main_seller_product_code -from . import test_suggested_price +from . import test_main_seller_id diff --git a/product_main_supplier/tests/test_main_seller_id.py b/product_main_supplier/tests/test_main_seller_id.py new file mode 100644 index 000000000..647bb77d4 --- /dev/null +++ b/product_main_supplier/tests/test_main_seller_id.py @@ -0,0 +1,41 @@ +# Copyright 2021 Coop IT Easy SCRL fs +# Rémy Taymans +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +import datetime + +from odoo.tests import TransactionCase + + +class TestMainSeller(TransactionCase): + def setUp(self): + super().setUp() + self.product1 = self.env.ref("product.product_delivery_01") + self.product2 = self.env.ref("product.product_delivery_02") + self.product3 = self.env.ref("product.product_product_6") + self.product1_main_supplierinfo_id = self.product1.seller_ids[0] + self.product2_main_supplierinfo_id = self.product2.seller_ids[-1] + + # Set the first supplierinfo as the most recent one + for index, sup in enumerate(self.product1.seller_ids): + sup.date_start = datetime.date.today() - datetime.timedelta(weeks=index) + # Set the last supplierinfo as the most recent one + for index, sup in enumerate(self.product2.seller_ids): + sup.date_start = datetime.date.today() + datetime.timedelta(weeks=index) + # Remove all supplierinfo + self.product3.seller_ids = False + + def test_get_main_suppplierinfo(self): + """ + Check that the main supplierinfo is the most recent one. + """ + self.assertEqual( + self.product1.product_tmpl_id._get_main_supplier_info(), + self.product1_main_supplierinfo_id, + ) + self.assertEqual( + self.product2.product_tmpl_id._get_main_supplier_info(), + self.product2_main_supplierinfo_id, + ) + self.assertFalse(self.product3.product_tmpl_id._get_main_supplier_info()) + self.assertFalse(self.product3.product_tmpl_id._get_main_supplier_info().price) diff --git a/beesdoo_product/tests/test_search_main_seller_product_code.py b/product_main_supplier/tests/test_search_main_seller_product_code.py similarity index 90% rename from beesdoo_product/tests/test_search_main_seller_product_code.py rename to product_main_supplier/tests/test_search_main_seller_product_code.py index a2c559c60..f7f9088d3 100644 --- a/beesdoo_product/tests/test_search_main_seller_product_code.py +++ b/product_main_supplier/tests/test_search_main_seller_product_code.py @@ -27,7 +27,7 @@ def test_search_product_by_main_seller_product_code(self): ( "main_seller_id_product_code", "=", - self.product1.top_supplierinfo_id.product_code, + self.product1.main_supplierinfo_id.product_code, ) ] ) @@ -37,7 +37,7 @@ def test_search_product_by_main_seller_product_code(self): ( "main_seller_id_product_code", "=", - self.product2.top_supplierinfo_id.product_code, + self.product2.main_supplierinfo_id.product_code, ) ] ) diff --git a/product_main_supplier/views/product_template_views.xml b/product_main_supplier/views/product_template_views.xml new file mode 100644 index 000000000..8c190c77e --- /dev/null +++ b/product_main_supplier/views/product_template_views.xml @@ -0,0 +1,15 @@ + + + + product.template.main.seller.search + product.template + + + + + + + + + + diff --git a/purchase_order_generator/models/product_template.py b/purchase_order_generator/models/product_template.py index 1e5108dc0..bd15973d4 100644 --- a/purchase_order_generator/models/product_template.py +++ b/purchase_order_generator/models/product_template.py @@ -16,7 +16,7 @@ class SupplierInfo(models.Model): class ProductTemplate(models.Model): _inherit = "product.template" - + # fixme : already present in product_main_supplier main_supplier_id = fields.Many2one( "res.partner", compute="_compute_main_supplier_id", store=True ) diff --git a/requirements.txt b/requirements.txt index 9cd162922..180fc4978 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ # generated from manifests external_dependencies +openupgradelib diff --git a/sale_adapt_price_wizard/README.rst b/sale_adapt_price_wizard/README.rst new file mode 100644 index 000000000..0db73c45b --- /dev/null +++ b/sale_adapt_price_wizard/README.rst @@ -0,0 +1,83 @@ +==================== +sale_suggested_price +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-coopiteasy%2Fobeesdoo-lightgray.png?logo=github + :target: https://github.com/coopiteasy/obeesdoo/tree/12.0/sale_suggested_price + :alt: coopiteasy/obeesdoo + +|badge1| |badge2| |badge3| + +- 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. +- Round suggested price to 5 cents +- Adds "Edit Price" submenu on Point Of Sale, Purchase and Sale modules. + The user lands on an editable List View with the following columns : + + - Name (`name`) + - Main Seller (`main_seller_id`) + - Purchase Price (`purchase_price`) + - Purchase Unit of Measure (`uom_po_id`) + - Suggested Price (`suggested_price`) + - Sales Price (`list_price`) + - Unit of Measure (`uom_id`) + + The only editable field is Purchase Price. + Through "Action > Adapt Sales Price", the user can, on the selected products, + adapt the Sales Price according to 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 + occur as duplicated products with one supplier each. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Coop IT Easy SCRLfs + +Contributors +~~~~~~~~~~~~ + +* Beescoop - Cellule IT +* `Coop IT Easy SCRLfs `_: + +Maintainers +~~~~~~~~~~~ + +This module is part of the `coopiteasy/obeesdoo `_ project on GitHub. + +You are welcome to contribute. diff --git a/sale_adapt_price_wizard/__init__.py b/sale_adapt_price_wizard/__init__.py new file mode 100644 index 000000000..786761245 --- /dev/null +++ b/sale_adapt_price_wizard/__init__.py @@ -0,0 +1,46 @@ +from . import models +from . import wizard + +from odoo import api, SUPERUSER_ID +from openupgradelib import openupgrade + + +renamed_view_xml_ids = ( + ( + "beesdoo_product.purchase_product_edit_price", + "sale_adapt_price_wizard.purchase_product_edit_price", + ), + ( + "beesdoo_product.menu_purchase_edit_price", + "sale_adapt_price_wizard.menu_purchase_edit_price", + ), + ( + "beesdoo_product.sale_product_edit_price", + "sale_adapt_price_wizard.sale_product_edit_price", + ), + ( + "beesdoo_product.menu_sale_edit_price", + "sale_adapt_price_wizard.menu_sale_edit_price", + ), + ( + "beesdoo_product.purchase_product_edit_price", + "sale_adapt_price_wizard.purchase_product_edit_price", + ), + ( + "beesdoo_product.purchase_product_edit_price", + "sale_adapt_price_wizard.purchase_product_edit_price", + ), + ( + "beesdoo_product.product_template_edit_price_tree_view", + "sale_adapt_price_wizard.product_template_edit_price_tree_view", + ), + ( + "beesdoo_product.adapt_sales_price_wizard", + "sale_adapt_price_wizard.adapt_sales_price_wizard", + ), +) + + +def rename_xml_ids(cr): + env = api.Environment(cr, SUPERUSER_ID, {}) + openupgrade.rename_xmlids(env.cr, renamed_view_xml_ids) diff --git a/sale_adapt_price_wizard/__manifest__.py b/sale_adapt_price_wizard/__manifest__.py new file mode 100644 index 000000000..c94824b4d --- /dev/null +++ b/sale_adapt_price_wizard/__manifest__.py @@ -0,0 +1,35 @@ +# Copyright 2022 Coop IT Easy SCRLfs +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Edit Price Wizard", + "summary": """ + Add "Edit Price" submenu on Purchase and Sale modules.""", + "version": "12.0.1.0.0", + "category": "Sales", + "website": "https://github.com/beescoop/Obeesdoo", + "author": "Coop IT Easy SC", + "license": "AGPL-3", + "application": False, + "depends": [ + "product", + "purchase", + "sale", + "sale_suggested_price", + "product_main_supplier", + ], + "external_dependencies": { + "python": ["openupgradelib"], + }, + "excludes": [], + "data": [ + "views/product_template_views.xml", + "views/purchase_views.xml", + "views/sale_views.xml", + "views/res_config_settings_views.xml", + "wizard/views/adapt_sales_price_wizard_view.xml", + ], + "demo": [], + "qweb": [], + "pre_init_hook": "rename_xml_ids", +} diff --git a/sale_adapt_price_wizard/models/__init__.py b/sale_adapt_price_wizard/models/__init__.py new file mode 100644 index 000000000..1fb059380 --- /dev/null +++ b/sale_adapt_price_wizard/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_template +from . import res_config_settings diff --git a/sale_adapt_price_wizard/models/product_template.py b/sale_adapt_price_wizard/models/product_template.py new file mode 100644 index 000000000..267f030b3 --- /dev/null +++ b/sale_adapt_price_wizard/models/product_template.py @@ -0,0 +1,51 @@ +# Copyright 2020 Coop IT Easy SCRL fs +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + list_price_write_date = fields.Datetime( + string="Sales Price Last Updated On", + default=fields.Datetime.now, + readonly=True, + ) + + def write(self, vals): + if self.env["ir.config_parameter"].get_param( + "sale_adapt_price_wizard.auto_write_suggested_price" + ): + purchase_price = vals.get("purchase_price") + if purchase_price and purchase_price != self.purchase_price: + # force update of purchase_price (which actually modifies the + # suppliers’ price) to ensure that the next computations that + # depend on it are correct. there are 3 things to do: + # 1. set value in cache + with self.env.do_in_draft(): + self.purchase_price = purchase_price + # 2. call inverse compute method + self._inverse_purchase_price() + # 3. remove the value from vals, to avoid the process to happen a + # second time + del vals["purchase_price"] + + # Important note: The list price is _only_ changed here if the + # `purchase_price` field of the product is changed. If the + # `price` field of the supplierinfo changes normally, the list price + # here is NOT automatically affected. + self.adapt_list_price(vals) + + list_price = vals.get("list_price") + if list_price and list_price != self.list_price: + vals["list_price_write_date"] = fields.Datetime.now() + + super().write(vals) + + @api.multi + def adapt_list_price(self, vals, suggested_price=None): + self.ensure_one() + if suggested_price is None: + suggested_price = self.suggested_price + vals.setdefault("list_price", suggested_price) diff --git a/sale_adapt_price_wizard/models/res_config_settings.py b/sale_adapt_price_wizard/models/res_config_settings.py new file mode 100644 index 000000000..b2a71a863 --- /dev/null +++ b/sale_adapt_price_wizard/models/res_config_settings.py @@ -0,0 +1,37 @@ +# Copyright 2019-2020 Elouan Le Bars +# 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" + + auto_write_suggested_price = fields.Boolean( + string="Automatically write suggested price", + help=""" + When editing the purchase price of a product (only in the 'Edit Price' menu), + automatically set its sales price as the calculated suggested price. + """, + config_parameter="sale_adapt_price_wizard.auto_write_suggested_price", + default=False, + ) + + @api.model + def get_values(self): + res = super(ResConfigSettings, self).get_values() + auto_write_suggested_price = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("sale_adapt_price_wizard.auto_write_suggested_price") + ) + res.update({"auto_write_suggested_price": auto_write_suggested_price}) + return res + + @api.multi + def set_values(self): + super(ResConfigSettings, self).set_values() + self.env["ir.config_parameter"].sudo().set_param( + "sale_suggested_price.auto_write_suggested_price", + self.auto_write_suggested_price, + ) diff --git a/sale_adapt_price_wizard/readme/CONTRIBUTORS.rst b/sale_adapt_price_wizard/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..0fbcb4e37 --- /dev/null +++ b/sale_adapt_price_wizard/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* BEES coop - Cellule IT +* `Coop IT Easy SCRLfs `_: diff --git a/sale_adapt_price_wizard/readme/DESCRIPTION.rst b/sale_adapt_price_wizard/readme/DESCRIPTION.rst new file mode 100644 index 000000000..663f29f9d --- /dev/null +++ b/sale_adapt_price_wizard/readme/DESCRIPTION.rst @@ -0,0 +1,16 @@ +- Adds "Edit Price" submenu on Purchase and Sale modules. + The user lands on an editable List View with the following columns : + + - Name (`name`) + - Main Seller (`main_seller_id`) + - Purchase Price (`purchase_price`) + - Purchase Unit of Measure (`uom_po_id`) + - Suggested Price (`suggested_price`) + - Sales Price (`list_price`) + - Unit of Measure (`uom_id`) + + The only editable field is Purchase Price. + Through "Action > Adapt Sales Price", the user can, on the selected products, + adapt the Sales Price according to the Suggested Price. + Alternatively, 'Automatically write suggested price' can be enabled to make + this last step automatic. diff --git a/sale_adapt_price_wizard/static/description/index.html b/sale_adapt_price_wizard/static/description/index.html new file mode 100644 index 000000000..9aeb843c6 --- /dev/null +++ b/sale_adapt_price_wizard/static/description/index.html @@ -0,0 +1,447 @@ + + + + + + +sale_suggested_price + + + +
+

sale_suggested_price

+ + +

Beta License: AGPL-3 coopiteasy/obeesdoo

+
    +
  • 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.

    +
  • +
  • Round suggested price to 5 cents

    +
  • +
  • Adds “Edit Price” submenu on Point Of Sale, Purchase and Sale modules. +The user lands on an editable List View with the following columns :

    +
      +
    • Name (name)
    • +
    • Main Seller (main_seller_id)
    • +
    • Purchase Price (purchase_price)
    • +
    • Purchase Unit of Measure (uom_po_id)
    • +
    • Suggested Price (suggested_price)
    • +
    • Sales Price (list_price)
    • +
    • Unit of Measure (uom_id)
    • +
    +

    The only editable field is Purchase Price. +Through “Action > Adapt Sales Price”, the user can, on the selected products, +adapt the Sales Price according to 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 +occur as duplicated products with one supplier each.
  • +
+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SCRLfs
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the coopiteasy/obeesdoo project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/sale_adapt_price_wizard/views/product_template_views.xml b/sale_adapt_price_wizard/views/product_template_views.xml new file mode 100644 index 000000000..8f31dbc3f --- /dev/null +++ b/sale_adapt_price_wizard/views/product_template_views.xml @@ -0,0 +1,37 @@ + + + + sale_adapt_price_wizard.template.edit.price.tree + product.template + + + + + + + + + + + + + + + + diff --git a/beesdoo_product/views/purchase_views.xml b/sale_adapt_price_wizard/views/purchase_views.xml similarity index 100% rename from beesdoo_product/views/purchase_views.xml rename to sale_adapt_price_wizard/views/purchase_views.xml diff --git a/sale_adapt_price_wizard/views/res_config_settings_views.xml b/sale_adapt_price_wizard/views/res_config_settings_views.xml new file mode 100644 index 000000000..6a35741d7 --- /dev/null +++ b/sale_adapt_price_wizard/views/res_config_settings_views.xml @@ -0,0 +1,32 @@ + + + + + res.config.settings.form + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+ +
diff --git a/beesdoo_product/views/sale_views.xml b/sale_adapt_price_wizard/views/sale_views.xml similarity index 100% rename from beesdoo_product/views/sale_views.xml rename to sale_adapt_price_wizard/views/sale_views.xml diff --git a/sale_adapt_price_wizard/wizard/__init__.py b/sale_adapt_price_wizard/wizard/__init__.py new file mode 100644 index 000000000..8574cc589 --- /dev/null +++ b/sale_adapt_price_wizard/wizard/__init__.py @@ -0,0 +1 @@ +from . import adapt_sales_price_wizard diff --git a/beesdoo_product/wizard/adapt_sales_price_wizard.py b/sale_adapt_price_wizard/wizard/adapt_sales_price_wizard.py similarity index 100% rename from beesdoo_product/wizard/adapt_sales_price_wizard.py rename to sale_adapt_price_wizard/wizard/adapt_sales_price_wizard.py diff --git a/beesdoo_product/wizard/views/adapt_sales_price_wizard_view.xml b/sale_adapt_price_wizard/wizard/views/adapt_sales_price_wizard_view.xml similarity index 94% rename from beesdoo_product/wizard/views/adapt_sales_price_wizard_view.xml rename to sale_adapt_price_wizard/wizard/views/adapt_sales_price_wizard_view.xml index 80f9e2a23..d54e724c2 100644 --- a/beesdoo_product/wizard/views/adapt_sales_price_wizard_view.xml +++ b/sale_adapt_price_wizard/wizard/views/adapt_sales_price_wizard_view.xml @@ -26,6 +26,6 @@ view_id="adapt_sales_price_wizard" target="new" key2="client_action_multi" - id="beesdoo_product_pricelist_action_adapt_sales_price" + id="pricelist_action_adapt_sales_price" /> diff --git a/sale_suggested_price/README.rst b/sale_suggested_price/README.rst new file mode 100644 index 000000000..d4a9ba065 --- /dev/null +++ b/sale_suggested_price/README.rst @@ -0,0 +1,77 @@ +==================== +sale_suggested_price +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-coopiteasy%2Fobeesdoo-lightgray.png?logo=github + :target: https://github.com/coopiteasy/obeesdoo/tree/12.0/sale_suggested_price + :alt: coopiteasy/obeesdoo + +|badge1| |badge2| |badge3| + +- 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. +- Round suggested price to 5 cents + +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 + occur as duplicated products with one supplier each. + +**Table of contents** + +.. contents:: + :local: + +Known issues / Roadmap +====================== + +- During migration : rationalise with odoo standard module's sale_margin +- Refactor product_category._round: + set rounding_precision and rounding_method to required + remove default values from the _round method + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Coop IT Easy SC + +Contributors +~~~~~~~~~~~~ + +* Beescoop - Cellule IT +* `Coop IT Easy SCRLfs `_: + +Maintainers +~~~~~~~~~~~ + +This module is part of the `coopiteasy/obeesdoo `_ project on GitHub. + +You are welcome to contribute. diff --git a/sale_suggested_price/__init__.py b/sale_suggested_price/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/sale_suggested_price/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_suggested_price/__manifest__.py b/sale_suggested_price/__manifest__.py new file mode 100644 index 000000000..e84da5821 --- /dev/null +++ b/sale_suggested_price/__manifest__.py @@ -0,0 +1,30 @@ +# Copyright 2022 Coop IT Easy SCRLfs +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Sale Suggested Price", + "summary": """ + Add a suggested price to products, dependent on a product margin in + partners and product categories.""", + "version": "12.0.1.0.0", + "category": "Sales", + "website": "https://github.com/beescoop/Obeesdoo", + "author": "Coop IT Easy SC", + "license": "AGPL-3", + "application": False, + "depends": [ + "product_main_supplier", + "product", + "purchase", + "sale", + ], + "excludes": [], + "data": [ + "views/product_category_views.xml", + "views/product_template_views.xml", + "views/res_config_settings_views.xml", + "views/res_partner_views.xml", + ], + "demo": [], + "qweb": [], +} diff --git a/sale_suggested_price/models/__init__.py b/sale_suggested_price/models/__init__.py new file mode 100644 index 000000000..89b42e6dc --- /dev/null +++ b/sale_suggested_price/models/__init__.py @@ -0,0 +1,4 @@ +from . import product_category +from . import product_template +from . import res_config_settings +from . import res_partner diff --git a/sale_suggested_price/models/product_category.py b/sale_suggested_price/models/product_category.py new file mode 100644 index 000000000..1fb259e2a --- /dev/null +++ b/sale_suggested_price/models/product_category.py @@ -0,0 +1,41 @@ +# Copyright 2020 Coop IT Easy SCRL fs +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models +from odoo.exceptions import UserError +from odoo.tools import float_round +from odoo.tools.translate import _ + + +class ProductCategory(models.Model): + _inherit = "product.category" + + # TODO: Make this default configurable? + profit_margin = fields.Float(default="10.0", string="Product Margin [%]") + should_round_suggested_price = fields.Boolean( + default=False, string="Round suggested price to 5 cents?" + ) + + rounding_method = fields.Selection( + [("HALF-UP", "Half"), ("UP", "up"), ("DOWN", "down")], + default="HALF-UP", + ) + rounding_precision = fields.Float(default=0.05) + + @api.multi + @api.constrains("profit_margin") + def _check_margin(self): + for product in self: + if product.profit_margin < 0.0: + raise UserError(_("Percentages for Profit Margin must >= 0.")) + + def _round(self, price): + self.ensure_one() + # Use default value 0.05 and "HALF_UP" + # in case someone erase the value on the category + # Keep default value on the field to make it explicit to the end user + return float_round( + price, + precision_rounding=self.rounding_precision or 0.05, + rounding_method=self.rounding_method or "HALF_UP", + ) diff --git a/sale_suggested_price/models/product_template.py b/sale_suggested_price/models/product_template.py new file mode 100644 index 000000000..e6fce6b6f --- /dev/null +++ b/sale_suggested_price/models/product_template.py @@ -0,0 +1,145 @@ +# Copyright 2020 Coop IT Easy SCRL fs +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models +from odoo.exceptions import ValidationError +from odoo.tools.translate import _ + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + suggested_price = fields.Float( + string="Suggested Price", + compute="_compute_suggested_price", + readonly=True, + help=""" + This field computes a suggested price based on the 'Product Margin' + field on Partners (Vendors), if it's set, or otherwise on the 'Product + Margin' field in Product Categories (which has a default value). + """, + ) + purchase_price = fields.Float( + string="Purchase Price", + compute="_compute_purchase_price", + inverse="_inverse_purchase_price", + ) + + purchase_price_write_date = fields.Datetime( + string="Purchase Price Last Updated On", + compute="_compute_purchase_price_write_date", + readonly=True, + ) + + @api.multi + def calculate_suggested_price(self, price=None): + self.ensure_one() + suggested_price_reference = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("sale_suggested_price.suggested_price_reference") + ) + supplier = self.main_supplierinfo_id + if not supplier: + raise ValueError(_("No supplier found for product {}").format(self.id)) + if price is None: + price = supplier.price + product_category = supplier.product_tmpl_id.categ_id + supplier_taxes = self.supplier_taxes_id.filtered( + lambda t: t.amount_type == "percent" and t.price_include + ) + supplier_taxes_factor = 1 / (1 + sum(supplier_taxes.mapped("amount")) / 100) + sale_taxes = self.taxes_id.filtered( + lambda t: t.amount_type == "percent" and t.price_include + ) + sale_taxes_factor = 1 + sum(sale_taxes.mapped("amount")) / 100 + profit_margin_supplier = supplier.name.profit_margin + profit_margin_product_category = product_category.profit_margin + profit_margin = profit_margin_supplier or profit_margin_product_category + profit_margin_factor = ( + 1 / (1 - profit_margin / 100) + if suggested_price_reference == "sale_price" + else (1 + profit_margin / 100) + ) + + # price of purchase is given for uom_po_id + # suggested *sale* price must be adapted to uom_id + uom_factor = self.uom_po_id.factor / self.uom_id.factor + + suggested_price = ( + price + * uom_factor + * supplier_taxes_factor + * sale_taxes_factor + * profit_margin_factor + ) + + if product_category.should_round_suggested_price: + suggested_price = product_category._round(suggested_price) + + return suggested_price + + @api.multi + @api.depends("seller_ids") + def _compute_purchase_price(self): + for product in self: + supplierinfo = product.main_supplierinfo_id + if supplierinfo: + product.purchase_price = supplierinfo.price + else: + product.purchase_price = 0 + + @api.multi + def _inverse_purchase_price(self): + for product in self: + supplierinfo = product._get_main_supplier_info() + if supplierinfo: + supplierinfo.price = product.purchase_price + else: + raise ValidationError( + _("No Vendor defined for product '%s'") % product.name + ) + + @api.multi + @api.depends( + "seller_ids", + "supplier_taxes_id", + "taxes_id", + "uom_id", + "uom_po_id", + "categ_id.should_round_suggested_price", + ) + def _compute_suggested_price(self): + for product in self: + try: + product.suggested_price = product.calculate_suggested_price() + except ValueError: + pass + + @api.multi + @api.depends("seller_ids") + def _compute_purchase_price(self): + for product in self: + supplierinfo = product._get_main_supplier_info() + if supplierinfo: + product.purchase_price = supplierinfo.price + else: + product.purchase_price = 0 + + @api.multi + def _inverse_purchase_price(self): + for product in self: + supplierinfo = product._get_main_supplier_info() + if supplierinfo: + supplierinfo.price = product.purchase_price + else: + raise ValidationError( + _("No Vendor defined for product '%s'") % product.name + ) + + @api.multi + @api.depends("purchase_price", "seller_ids") + def _compute_purchase_price_write_date(self): + for product in self: + supplierinfo = product._get_main_supplier_info() + product.purchase_price_write_date = supplierinfo.price_write_date diff --git a/beesdoo_product/models/res_config_settings.py b/sale_suggested_price/models/res_config_settings.py similarity index 59% rename from beesdoo_product/models/res_config_settings.py rename to sale_suggested_price/models/res_config_settings.py index 72ba5a8e9..29a132794 100644 --- a/beesdoo_product/models/res_config_settings.py +++ b/sale_suggested_price/models/res_config_settings.py @@ -23,15 +23,6 @@ class ResConfigSettings(models.TransientModel): """, default="supplier_price", ) - auto_write_suggested_price = fields.Boolean( - string="Automatically write suggested price", - help=""" - When editing the purchase price of a product (only in the 'Edit Price' menu), - automatically set its sales price as the calculated suggested price. - """, - config_parameter="beesdoo_product.auto_write_suggested_price", - default=False, - ) @api.model def get_values(self): @@ -39,25 +30,15 @@ def get_values(self): suggested_price_reference = ( self.env["ir.config_parameter"] .sudo() - .get_param("beesdoo_product.suggested_price_reference") + .get_param("sale_suggested_price.suggested_price_reference") ) res.update({"suggested_price_reference": suggested_price_reference}) - auto_write_suggested_price = ( - self.env["ir.config_parameter"] - .sudo() - .get_param("beesdoo_product.auto_write_suggested_price") - ) - res.update({"auto_write_suggested_price": auto_write_suggested_price}) return res @api.multi def set_values(self): super(ResConfigSettings, self).set_values() self.env["ir.config_parameter"].sudo().set_param( - "beesdoo_product.suggested_price_reference", + "sale_suggested_price.suggested_price_reference", self.suggested_price_reference, ) - self.env["ir.config_parameter"].sudo().set_param( - "beesdoo_product.auto_write_suggested_price", - self.auto_write_suggested_price, - ) diff --git a/sale_suggested_price/models/res_partner.py b/sale_suggested_price/models/res_partner.py new file mode 100644 index 000000000..aca42a5de --- /dev/null +++ b/sale_suggested_price/models/res_partner.py @@ -0,0 +1,19 @@ +# Copyright 2020 Coop IT Easy SCRL fs +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models +from odoo.exceptions import UserError +from odoo.tools.translate import _ + + +class ResPartner(models.Model): + _inherit = "res.partner" + + profit_margin = fields.Float(string="Product Margin [%]") + + @api.multi + @api.constrains("profit_margin") + def _check_margin(self): + for product in self: + if product.profit_margin < 0.0: + raise UserError(_("Percentages for Profit Margin must >= 0.")) diff --git a/sale_suggested_price/readme/CONTRIBUTORS.rst b/sale_suggested_price/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..0fbcb4e37 --- /dev/null +++ b/sale_suggested_price/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* BEES coop - Cellule IT +* `Coop IT Easy SCRLfs `_: diff --git a/sale_suggested_price/readme/DESCRIPTION.rst b/sale_suggested_price/readme/DESCRIPTION.rst new file mode 100644 index 000000000..8d6b4550e --- /dev/null +++ b/sale_suggested_price/readme/DESCRIPTION.rst @@ -0,0 +1,12 @@ +- 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. +- Round suggested price to 5 cents + +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 + occur as duplicated products with one supplier each. diff --git a/sale_suggested_price/readme/ROADMAP.rst b/sale_suggested_price/readme/ROADMAP.rst new file mode 100644 index 000000000..7fedb72e0 --- /dev/null +++ b/sale_suggested_price/readme/ROADMAP.rst @@ -0,0 +1,4 @@ +- During migration : rationalise with odoo standard module's sale_margin +- Refactor product_category._round: + set rounding_precision and rounding_method to required + remove default values from the _round method diff --git a/sale_suggested_price/static/description/index.html b/sale_suggested_price/static/description/index.html new file mode 100644 index 000000000..88b0b9c35 --- /dev/null +++ b/sale_suggested_price/static/description/index.html @@ -0,0 +1,441 @@ + + + + + + +sale_suggested_price + + + +
+

sale_suggested_price

+ + +

Beta License: AGPL-3 coopiteasy/obeesdoo

+
    +
  • 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.
  • +
  • Round suggested price to 5 cents
  • +
+

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 +occur as duplicated products with one supplier each.
  • +
+

Table of contents

+ +
+

Known issues / Roadmap

+
    +
  • During migration : rationalise with odoo standard module’s sale_margin
  • +
  • +
    Refactor product_category._round:
    +
    set rounding_precision and rounding_method to required +remove default values from the _round method
    +
    +
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SC
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the coopiteasy/obeesdoo project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/sale_suggested_price/tests/__init__.py b/sale_suggested_price/tests/__init__.py new file mode 100644 index 000000000..3b67f665b --- /dev/null +++ b/sale_suggested_price/tests/__init__.py @@ -0,0 +1 @@ +from . import test_suggested_price diff --git a/beesdoo_product/tests/test_suggested_price.py b/sale_suggested_price/tests/test_suggested_price.py similarity index 94% rename from beesdoo_product/tests/test_suggested_price.py rename to sale_suggested_price/tests/test_suggested_price.py index 36b368786..3121b2c3c 100644 --- a/beesdoo_product/tests/test_suggested_price.py +++ b/sale_suggested_price/tests/test_suggested_price.py @@ -14,9 +14,10 @@ def setUp(self): ( self.env["ir.config_parameter"] .sudo() - .set_param("beesdoo_product.suggested_price_reference", "sale_price") + .set_param("sale_suggested_price.suggested_price_reference", "sale_price") ) self.account_type_ass = self.env.ref("account.data_account_type_current_assets") + self.account_type_ass = self.env.ref("account.data_account_type_current_assets") self.a_debit_vat = self.env["account.account"].create( { "code": "debvat_acc", diff --git a/sale_suggested_price/views/product_category_views.xml b/sale_suggested_price/views/product_category_views.xml new file mode 100644 index 000000000..0a5898f72 --- /dev/null +++ b/sale_suggested_price/views/product_category_views.xml @@ -0,0 +1,35 @@ + + + + sale_suggested_price.product.category.list + product.category + + + + + + + + + + + sale_suggested_price.product.category.form + product.category + + + + + + + + + + + + diff --git a/sale_suggested_price/views/product_template_views.xml b/sale_suggested_price/views/product_template_views.xml new file mode 100644 index 000000000..317dc48df --- /dev/null +++ b/sale_suggested_price/views/product_template_views.xml @@ -0,0 +1,18 @@ + + + + sale_suggested_price.template.product.form + product.template + + + + + + + + + diff --git a/beesdoo_product/views/res_config_settings.xml b/sale_suggested_price/views/res_config_settings_views.xml similarity index 73% rename from beesdoo_product/views/res_config_settings.xml rename to sale_suggested_price/views/res_config_settings_views.xml index 04e438157..35d25b11d 100644 --- a/beesdoo_product/views/res_config_settings.xml +++ b/sale_suggested_price/views/res_config_settings_views.xml @@ -36,18 +36,6 @@ -
-
- -
-
-
-
diff --git a/sale_suggested_price/views/res_partner_views.xml b/sale_suggested_price/views/res_partner_views.xml new file mode 100644 index 000000000..1b47635fc --- /dev/null +++ b/sale_suggested_price/views/res_partner_views.xml @@ -0,0 +1,13 @@ + + + + res.partner.form + res.partner + + + + + + + + diff --git a/setup/product_main_supplier/odoo/addons/product_main_supplier b/setup/product_main_supplier/odoo/addons/product_main_supplier new file mode 120000 index 000000000..80c7c57aa --- /dev/null +++ b/setup/product_main_supplier/odoo/addons/product_main_supplier @@ -0,0 +1 @@ +../../../../product_main_supplier \ No newline at end of file diff --git a/setup/product_main_supplier/setup.py b/setup/product_main_supplier/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/product_main_supplier/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/sale_adapt_price_wizard/odoo/addons/sale_adapt_price_wizard b/setup/sale_adapt_price_wizard/odoo/addons/sale_adapt_price_wizard new file mode 120000 index 000000000..2418e4a2a --- /dev/null +++ b/setup/sale_adapt_price_wizard/odoo/addons/sale_adapt_price_wizard @@ -0,0 +1 @@ +../../../../sale_adapt_price_wizard \ No newline at end of file diff --git a/setup/sale_adapt_price_wizard/setup.py b/setup/sale_adapt_price_wizard/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/sale_adapt_price_wizard/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/sale_suggested_price/odoo/addons/sale_suggested_price b/setup/sale_suggested_price/odoo/addons/sale_suggested_price new file mode 120000 index 000000000..c4ee30746 --- /dev/null +++ b/setup/sale_suggested_price/odoo/addons/sale_suggested_price @@ -0,0 +1 @@ +../../../../sale_suggested_price \ No newline at end of file diff --git a/setup/sale_suggested_price/setup.py b/setup/sale_suggested_price/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/sale_suggested_price/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)