Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions sale_report_margin/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/margin-analysis/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20sale_report_margin%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* Sergio Teruel <sergio.teruel@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>

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 <https://github.com/OCA/margin-analysis/tree/11.0/sale_report_margin>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_report_margin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import reports
15 changes: 15 additions & 0 deletions sale_report_margin/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 2 additions & 0 deletions sale_report_margin/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Sergio Teruel <sergio.teruel@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
3 changes: 3 additions & 0 deletions sale_report_margin/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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.
1 change: 1 addition & 0 deletions sale_report_margin/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- To be added Gross Margin and comparisons.
2 changes: 2 additions & 0 deletions sale_report_margin/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Go to *Sales > Reporting > Sales* and you'll find the new *Purchase Price*
measure.
1 change: 1 addition & 0 deletions sale_report_margin/reports/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_report
20 changes: 20 additions & 0 deletions sale_report_margin/reports/sale_report.py
Original file line number Diff line number Diff line change
@@ -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