Skip to content

Commit

Permalink
Merge pull request #244 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/sale-reporting (16.0)
  • Loading branch information
bt-admin authored Oct 29, 2024
2 parents e0dcf0c + f1ada6b commit 2a54952
Show file tree
Hide file tree
Showing 24 changed files with 798 additions and 30 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ addon | version | maintainers | summary
[sale_packaging_report](sale_packaging_report/) | 16.0.1.1.0 | [![yajo](https://github.com/yajo.png?size=30px)](https://github.com/yajo) | Packaging data in sale reports
[sale_report_commitment_date](sale_report_commitment_date/) | 16.0.1.0.0 | [![ivantodorovich](https://github.com/ivantodorovich.png?size=30px)](https://github.com/ivantodorovich) | Display the commitment date on Sales Order analysis reports
[sale_report_country_state](sale_report_country_state/) | 16.0.1.0.0 | | Sale Report Filter by State
[sale_report_delivered](sale_report_delivered/) | 16.0.1.0.2 | [![sergio-teruel](https://github.com/sergio-teruel.png?size=30px)](https://github.com/sergio-teruel) | Sale Report Delivered
[sale_report_delivered](sale_report_delivered/) | 16.0.2.0.0 | [![sergio-teruel](https://github.com/sergio-teruel.png?size=30px)](https://github.com/sergio-teruel) | Sale Report Delivered
[sale_report_delivered_deposit](sale_report_delivered_deposit/) | 16.0.2.0.0 | [![Shide](https://github.com/Shide.png?size=30px)](https://github.com/Shide) [![rafaelbn](https://github.com/rafaelbn.png?size=30px)](https://github.com/rafaelbn) | Allow to view Customer Deposits on Sale Report Delivered
[sale_report_delivered_subtotal](sale_report_delivered_subtotal/) | 16.0.1.0.1 | [![sergio-teruel](https://github.com/sergio-teruel.png?size=30px)](https://github.com/sergio-teruel) | Sale Report Delivered subtotal
[sale_report_delivered_volume](sale_report_delivered_volume/) | 16.0.1.0.0 | | Sale Report Delivered Volume

Expand Down
2 changes: 1 addition & 1 deletion sale_report_delivered/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sale Report Delivered
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8645afe85a3e91c52ab23400c732943a2023967a35e0c13af2abfc08326cd4f2
!! source digest: sha256:c48a54d2727459314d85370ba53999cd4f21af3cdd95121d11ae04d42ce135b8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion sale_report_delivered/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Report Delivered",
"version": "16.0.1.0.2",
"version": "16.0.2.0.0",
"author": "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-reporting",
"category": "Sales",
Expand Down
69 changes: 48 additions & 21 deletions sale_report_delivered/reports/sale_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ def _select(self):
"""
return select_str

def _sub_select_signed_qty(self):
"""Sub select to calculate the cases for the signed quantity"""
return """
WHEN source_location.usage = 'internal' AND dest_location.usage = 'customer'
THEN 1
WHEN source_location.usage = 'customer' AND dest_location.usage = 'internal'
THEN -1
WHEN source_location.usage = 'supplier' AND dest_location.usage = 'customer'
THEN 1
WHEN source_location.usage = 'customer' AND dest_location.usage = 'supplier'
THEN -1
"""

def _sub_select(self):
sub_select_str = """
SELECT
Expand All @@ -111,14 +124,7 @@ def _sub_select(self):
CASE
WHEN dest_location.usage IS NULL
THEN 1
WHEN source_location.usage = 'internal' AND dest_location.usage = 'customer'
THEN 1
WHEN source_location.usage = 'customer' AND dest_location.usage = 'internal'
THEN -1
WHEN source_location.usage = 'supplier' AND dest_location.usage = 'customer'
THEN 1
WHEN source_location.usage = 'customer' AND dest_location.usage = 'supplier'
THEN -1
{sub_select_signed_qty}
ELSE 0
END AS signed_qty,
(CASE WHEN t.type IN ('product', 'consu') THEN COALESCE(sm.product_uom_qty, 0.0)
Expand Down Expand Up @@ -150,8 +156,10 @@ def _sub_select(self):
s.id as order_id,
sp.id as picking_id,
sol.purchase_price AS unsigned_purchase_price,
ROUND(COALESCE(svl.value, 0.0), cur.decimal_places) AS amount_cost
"""
ROUND(svl.value, cur.decimal_places) AS amount_cost
""".format(
sub_select_signed_qty=self._sub_select_signed_qty()
)
return sub_select_str

def _from(self):
Expand All @@ -175,26 +183,45 @@ def _from(self):
"""
return from_str

def _where(self):
"""Take into account only stock moves from:
def _sub_where(self):
"""
Take into account only stock moves from:
Outgoing: Internal to Customer
Returns: Customer to Internal + to_refund
Dropship: Supplier to Customer
Dropship return: Customer to Supplier
"""
return """
WHERE (sm.state = 'done' OR sm.state IS NULL) AND (
(source_location.usage = 'internal' AND dest_location.usage = 'customer') OR
(source_location.usage = 'customer' AND dest_location.usage = 'internal'
AND sm.to_refund) OR
(source_location.usage = 'supplier' AND dest_location.usage = 'customer'
AND svl.quantity < 0) OR
(source_location.usage = 'customer' AND dest_location.usage = 'supplier'
AND svl.quantity > 0)
)
(
source_location.usage = 'internal' AND
dest_location.usage = 'customer'
) OR
(
source_location.usage = 'customer' AND
dest_location.usage = 'internal' AND
sm.to_refund
) OR
(
source_location.usage = 'supplier' AND
dest_location.usage = 'customer' AND
svl.quantity < 0
) OR
(
source_location.usage = 'customer' AND
dest_location.usage = 'supplier' AND
svl.quantity > 0
)
"""

def _where(self):
"""Where clause with only done mvoes or without state"""
return """
WHERE (sm.state = 'done' OR sm.state IS NULL) AND ({sub_where})
""".format(
sub_where=self._sub_where()
)

def _group_by(self):
group_by_str = """
GROUP BY sub.product_id,
Expand Down
13 changes: 8 additions & 5 deletions sale_report_delivered/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -366,7 +367,7 @@ <h1 class="title">Sale Report Delivered</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8645afe85a3e91c52ab23400c732943a2023967a35e0c13af2abfc08326cd4f2
!! source digest: sha256:c48a54d2727459314d85370ba53999cd4f21af3cdd95121d11ae04d42ce135b8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-reporting/tree/16.0/sale_report_delivered"><img alt="OCA/sale-reporting" src="https://img.shields.io/badge/github-OCA%2Fsale--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-reporting-16-0/sale-reporting-16-0-sale_report_delivered"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-reporting&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Adds subtotal price based on the delivered quantities field to the
Expand Down Expand Up @@ -424,7 +425,9 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down
120 changes: 120 additions & 0 deletions sale_report_delivered_deposit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
===============================
Sale Report Delivered - Deposit
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:05c19bad73ebed077d749044beaac73ad885e44498d52a23567cdfb351d44e65
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |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%2Fsale--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/sale-reporting/tree/16.0/sale_report_delivered_deposit
:alt: OCA/sale-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-reporting-16-0/sale-reporting-16-0-sale_report_delivered_deposit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-reporting&target_branch=16.0
:alt: Try me on Runboat

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

This module extends the functionality of Sale Report Delivered to
support view lines that comes from Customer Deposits and to allow you to
have a better view of Deliveries.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

This module was developed because we want to show Customer Deposits on
Sale Report Delivered report.

It will be useful for you if want to take into account customer
deposits.

Usage
=====

To use this module, you need to:

1. Go to your Warehouse and activate Customer Deposits
2. Go to Sales and create and send a Customer Deposit
3. Go to Sale Delivered Report
4. Check the deposit is shown

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-reporting/issues/new?body=module:%20sale_report_delivered_deposit%0Aversion:%2016.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
-------

* Moduon

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

- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)

Other credits
-------------

The development of this module has been financially supported by:

- Comercial Ulzama

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-Shide| image:: https://github.com/Shide.png?size=40px
:target: https://github.com/Shide
:alt: Shide
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
:target: https://github.com/rafaelbn
:alt: rafaelbn

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

|maintainer-Shide| |maintainer-rafaelbn|

This module is part of the `OCA/sale-reporting <https://github.com/OCA/sale-reporting/tree/16.0/sale_report_delivered_deposit>`_ 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_delivered_deposit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import report
22 changes: 22 additions & 0 deletions sale_report_delivered_deposit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Moduon Team S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

{
"name": "Sale Report Delivered - Deposit",
"summary": "Allow to view Customer Deposits on Sale Report Delivered",
"version": "16.0.2.0.0",
"development_status": "Alpha",
"category": "Sales",
"website": "https://github.com/OCA/sale-reporting",
"author": "Moduon, Odoo Community Association (OCA)",
"maintainers": ["Shide", "rafaelbn"],
"license": "AGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": [
"sale_report_delivered",
"stock_customer_deposit",
],
"data": [],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_report_delivered_deposit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_report_delivered_deposit
#: model:ir.model,name:sale_report_delivered_deposit.model_sale_report_delivered
msgid "Sales Delivered Analysis Report"
msgstr ""
3 changes: 3 additions & 0 deletions sale_report_delivered_deposit/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module was developed because we want to show Customer Deposits on Sale Report Delivered report.

It will be useful for you if want to take into account customer deposits.
2 changes: 2 additions & 0 deletions sale_report_delivered_deposit/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Eduardo de Miguel ([Moduon](https://www.moduon.team/))

3 changes: 3 additions & 0 deletions sale_report_delivered_deposit/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The development of this module has been financially supported by:

- Comercial Ulzama
1 change: 1 addition & 0 deletions sale_report_delivered_deposit/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module extends the functionality of Sale Report Delivered to support view lines that comes from Customer Deposits and to allow you to have a better view of Deliveries.
6 changes: 6 additions & 0 deletions sale_report_delivered_deposit/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use this module, you need to:

1. Go to your Warehouse and activate Customer Deposits
2. Go to Sales and create and send a Customer Deposit
3. Go to Sale Delivered Report
4. Check the deposit is shown
1 change: 1 addition & 0 deletions sale_report_delivered_deposit/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_report
Loading

0 comments on commit 2a54952

Please sign in to comment.