From 8b05cd7118f52e7bd722a80a43866b91097c707d Mon Sep 17 00:00:00 2001 From: David Date: Tue, 10 Jul 2018 11:17:39 +0200 Subject: [PATCH 1/3] [ADD] sale_report_purchase_price: New Module --- sale_report_purchase_price/__init__.py | 1 + sale_report_purchase_price/__manifest__.py | 15 ++++++++++++++ .../readme/CONTRIBUTORS.rst | 2 ++ .../readme/DESCRIPTION.rst | 1 + sale_report_purchase_price/readme/USAGE.rst | 2 ++ .../reports/__init__.py | 1 + .../reports/sale_report.py | 20 +++++++++++++++++++ 7 files changed, 42 insertions(+) create mode 100644 sale_report_purchase_price/__init__.py create mode 100644 sale_report_purchase_price/__manifest__.py create mode 100644 sale_report_purchase_price/readme/CONTRIBUTORS.rst create mode 100644 sale_report_purchase_price/readme/DESCRIPTION.rst create mode 100644 sale_report_purchase_price/readme/USAGE.rst create mode 100644 sale_report_purchase_price/reports/__init__.py create mode 100644 sale_report_purchase_price/reports/sale_report.py diff --git a/sale_report_purchase_price/__init__.py b/sale_report_purchase_price/__init__.py new file mode 100644 index 000000000..65323532b --- /dev/null +++ b/sale_report_purchase_price/__init__.py @@ -0,0 +1 @@ +from . import reports diff --git a/sale_report_purchase_price/__manifest__.py b/sale_report_purchase_price/__manifest__.py new file mode 100644 index 000000000..4b9ab4787 --- /dev/null +++ b/sale_report_purchase_price/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2018 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Sale Report Margin", + "version": "11.0.1.0.0", + 'author': 'Tecnativa,' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/sale-reporting', + "category": "Sales", + "license": "AGPL-3", + "depends": [ + "sale_margin", + ], + "installable": True, +} diff --git a/sale_report_purchase_price/readme/CONTRIBUTORS.rst b/sale_report_purchase_price/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..5505ba54f --- /dev/null +++ b/sale_report_purchase_price/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Sergio Teruel +* David Vidal diff --git a/sale_report_purchase_price/readme/DESCRIPTION.rst b/sale_report_purchase_price/readme/DESCRIPTION.rst new file mode 100644 index 000000000..640a7a88c --- /dev/null +++ b/sale_report_purchase_price/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Adds `purchase_price` field to sale report. diff --git a/sale_report_purchase_price/readme/USAGE.rst b/sale_report_purchase_price/readme/USAGE.rst new file mode 100644 index 000000000..49e8a8f07 --- /dev/null +++ b/sale_report_purchase_price/readme/USAGE.rst @@ -0,0 +1,2 @@ +Go to *Sales > Reporting > Sales* and you'll find the new *Purchase Price* +measure. diff --git a/sale_report_purchase_price/reports/__init__.py b/sale_report_purchase_price/reports/__init__.py new file mode 100644 index 000000000..cd23411b8 --- /dev/null +++ b/sale_report_purchase_price/reports/__init__.py @@ -0,0 +1 @@ +from . import sale_report diff --git a/sale_report_purchase_price/reports/sale_report.py b/sale_report_purchase_price/reports/sale_report.py new file mode 100644 index 000000000..dac971834 --- /dev/null +++ b/sale_report_purchase_price/reports/sale_report.py @@ -0,0 +1,20 @@ +# Copyright 2018 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleReport(models.Model): + _inherit = "sale.report" + + purchase_price = fields.Float( + string='Purchase Price', + readonly=True, + ) + + def _select(self): + select_str = super(SaleReport, self)._select() + select_str += """, + SUM(l.purchase_price / COALESCE(cr.rate, 1.0)) as purchase_price + """ + return select_str From 2c75d6a0f63d05ceb256fdde28d1648b19be8c56 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 11 Jul 2018 11:20:20 +0200 Subject: [PATCH 2/3] fixup! [ADD] sale_report_purchase_price: New Module --- sale_report_purchase_price/readme/DESCRIPTION.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sale_report_purchase_price/readme/DESCRIPTION.rst b/sale_report_purchase_price/readme/DESCRIPTION.rst index 640a7a88c..f5de88888 100644 --- a/sale_report_purchase_price/readme/DESCRIPTION.rst +++ b/sale_report_purchase_price/readme/DESCRIPTION.rst @@ -1 +1,3 @@ -Adds `purchase_price` field to sale report. +Adds `purchase_price` field to sale report. This field comes from the *Cost* +field configured in the products themselves and on the defined inventory +valuation method. From 718770de63369d415c926dfc9f85876285b5a894 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 17 Jul 2018 09:08:27 +0200 Subject: [PATCH 3/3] fixup! fixup! [ADD] sale_report_purchase_price: New Module --- sale_report_margin/README.rst | 87 +++++++++++++++++++ .../__init__.py | 0 .../__manifest__.py | 0 .../readme/CONTRIBUTORS.rst | 0 .../readme/DESCRIPTION.rst | 0 sale_report_margin/readme/ROADMAP.rst | 1 + .../readme/USAGE.rst | 0 .../reports/__init__.py | 0 .../reports/sale_report.py | 0 9 files changed, 88 insertions(+) create mode 100644 sale_report_margin/README.rst rename {sale_report_purchase_price => sale_report_margin}/__init__.py (100%) rename {sale_report_purchase_price => sale_report_margin}/__manifest__.py (100%) rename {sale_report_purchase_price => sale_report_margin}/readme/CONTRIBUTORS.rst (100%) rename {sale_report_purchase_price => sale_report_margin}/readme/DESCRIPTION.rst (100%) create mode 100644 sale_report_margin/readme/ROADMAP.rst rename {sale_report_purchase_price => sale_report_margin}/readme/USAGE.rst (100%) rename {sale_report_purchase_price => sale_report_margin}/reports/__init__.py (100%) rename {sale_report_purchase_price => sale_report_margin}/reports/sale_report.py (100%) diff --git a/sale_report_margin/README.rst b/sale_report_margin/README.rst new file mode 100644 index 000000000..a20d4cfd9 --- /dev/null +++ b/sale_report_margin/README.rst @@ -0,0 +1,87 @@ +================== +Sale Report Margin +================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github + :target: https://github.com/OCA/margin-analysis/tree/11.0/sale_report_margin + :alt: OCA/margin-analysis +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/margin-analysis-11-0/margin-analysis-11-0-sale_report_margin + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/132/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds `purchase_price` field to sale report. This field comes from the *Cost* +field configured in the products themselves and on the defined inventory +valuation method. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Go to *Sales > Reporting > Sales* and you'll find the new *Purchase Price* +measure. + +Known issues / Roadmap +====================== + +- To be added Gross Margin and comparisons. + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Sergio Teruel +* David Vidal + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/margin-analysis `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_report_purchase_price/__init__.py b/sale_report_margin/__init__.py similarity index 100% rename from sale_report_purchase_price/__init__.py rename to sale_report_margin/__init__.py diff --git a/sale_report_purchase_price/__manifest__.py b/sale_report_margin/__manifest__.py similarity index 100% rename from sale_report_purchase_price/__manifest__.py rename to sale_report_margin/__manifest__.py diff --git a/sale_report_purchase_price/readme/CONTRIBUTORS.rst b/sale_report_margin/readme/CONTRIBUTORS.rst similarity index 100% rename from sale_report_purchase_price/readme/CONTRIBUTORS.rst rename to sale_report_margin/readme/CONTRIBUTORS.rst diff --git a/sale_report_purchase_price/readme/DESCRIPTION.rst b/sale_report_margin/readme/DESCRIPTION.rst similarity index 100% rename from sale_report_purchase_price/readme/DESCRIPTION.rst rename to sale_report_margin/readme/DESCRIPTION.rst diff --git a/sale_report_margin/readme/ROADMAP.rst b/sale_report_margin/readme/ROADMAP.rst new file mode 100644 index 000000000..8a8078b80 --- /dev/null +++ b/sale_report_margin/readme/ROADMAP.rst @@ -0,0 +1 @@ +- To be added Gross Margin and comparisons. diff --git a/sale_report_purchase_price/readme/USAGE.rst b/sale_report_margin/readme/USAGE.rst similarity index 100% rename from sale_report_purchase_price/readme/USAGE.rst rename to sale_report_margin/readme/USAGE.rst diff --git a/sale_report_purchase_price/reports/__init__.py b/sale_report_margin/reports/__init__.py similarity index 100% rename from sale_report_purchase_price/reports/__init__.py rename to sale_report_margin/reports/__init__.py diff --git a/sale_report_purchase_price/reports/sale_report.py b/sale_report_margin/reports/sale_report.py similarity index 100% rename from sale_report_purchase_price/reports/sale_report.py rename to sale_report_margin/reports/sale_report.py