-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] sale_margin_delivered_dropshipping: Compute delivered margins o…
…n Dropshipping
- Loading branch information
Showing
15 changed files
with
721 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
================================== | ||
Sale Margin Delivered Dropshipping | ||
================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:5a597b346c2f49f2ccba1b1f44ed58c0c66d0bf10be25e6e8aeb9c56e4674328 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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%2Fmargin--analysis-lightgray.png?logo=github | ||
:target: https://github.com/OCA/margin-analysis/tree/16.0/sale_margin_delivered_dropshipping | ||
: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-16-0/margin-analysis-16-0-sale_margin_delivered_dropshipping | ||
: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/margin-analysis&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Computes sale order lines margins for the delivered items. | ||
|
||
This module takes in consideration Outgoing, Returns and Dropship. | ||
|
||
.. 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: | ||
|
||
Configuration | ||
============= | ||
|
||
#. To grant Sales Margin view privileges to a user, go to *Settings > Users & | ||
Companies > Users*, select the user and set *Show Sale Margin* on. | ||
#. Go to *Settings > Purchase > Logistics* and activate *Dropshipping*. | ||
#. Configure Dropship Product: Create or Edit an Storable product, | ||
activate Dropship route on *Inventory Tab > Routes* and | ||
add a Product Supplierinfo under *Purchase tab > Vendors*. | ||
|
||
Usage | ||
===== | ||
|
||
#. Go to *Sales > Orders > Quotations*. | ||
#. Create a new *Sales Order* and add a line with an stockable product. Set a | ||
quantity higher than one. | ||
#. Confirm the *Sales Order* and deliver just a partial amount of product in | ||
the picking. | ||
#. Go to *Sales > Reporting > Sales* and unfold the *Order Reference* dimension | ||
and the *Margin* and *Margin Delivered* to compare them. | ||
|
||
For example: | ||
|
||
In an order line with a product at a cost of 10 and a sell price of 25 we | ||
deliver 2 of 3 units. Then, the reported margins would be: | ||
|
||
`margin`: 45 (3 * 15) | ||
`margin_delivered`: 30 (2 * 15) | ||
|
||
Additionally, you can check the margin and the margin percent in the sales | ||
order line. | ||
|
||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20sale_margin_delivered_dropshipping%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/>`__) | ||
* Rafael Blasco (`Moduon <https://www.moduon.team/>`__) | ||
|
||
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 | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-Shide| | ||
|
||
This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/16.0/sale_margin_delivered_dropshipping>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 Moduon Team | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Sale Margin Delivered Dropshipping", | ||
"version": "16.0.1.0.0", | ||
"author": "Moduon, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/margin-analysis", | ||
"category": "Sales", | ||
"license": "AGPL-3", | ||
"depends": ["sale_margin_delivered", "stock_dropshipping"], | ||
"data": [], | ||
"installable": True, | ||
"auto_install": True, | ||
"development_status": "Alpha", | ||
"maintainers": ["Shide"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import sale_margin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2024 Moduon Team | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class SaleOrderLine(models.Model): | ||
_inherit = "sale.order.line" | ||
|
||
def _get_delivered_margin_valuation_layers(self): | ||
"""Adds Valuation Layers that involves Dropshipping and not considered | ||
in other scenarios.""" | ||
valuation_layers = super()._get_delivered_margin_valuation_layers() | ||
for move in self.move_ids.filtered(lambda m: m.state == "done"): | ||
if ( | ||
move.location_dest_usage == "customer" | ||
and move.location_usage == "supplier" | ||
): | ||
# Dropship moves have 2 valuation layers. Use negative one | ||
valuation_layers |= move.stock_valuation_layer_ids.filtered( | ||
lambda vl: vl.quantity < 0 | ||
) | ||
return valuation_layers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#. To grant Sales Margin view privileges to a user, go to *Settings > Users & | ||
Companies > Users*, select the user and set *Show Sale Margin* on. | ||
#. Go to *Settings > Purchase > Logistics* and activate *Dropshipping*. | ||
#. Configure Dropship Product: Create or Edit an Storable product, | ||
activate Dropship route on *Inventory Tab > Routes* and | ||
add a Product Supplierinfo under *Purchase tab > Vendors*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__) | ||
* Rafael Blasco (`Moduon <https://www.moduon.team/>`__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Computes sale order lines margins for the delivered items. | ||
|
||
This module takes in consideration Outgoing, Returns and Dropship. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#. Go to *Sales > Orders > Quotations*. | ||
#. Create a new *Sales Order* and add a line with an stockable product. Set a | ||
quantity higher than one. | ||
#. Confirm the *Sales Order* and deliver just a partial amount of product in | ||
the picking. | ||
#. Go to *Sales > Reporting > Sales* and unfold the *Order Reference* dimension | ||
and the *Margin* and *Margin Delivered* to compare them. | ||
|
||
For example: | ||
|
||
In an order line with a product at a cost of 10 and a sell price of 25 we | ||
deliver 2 of 3 units. Then, the reported margins would be: | ||
|
||
`margin`: 45 (3 * 15) | ||
`margin_delivered`: 30 (2 * 15) | ||
|
||
Additionally, you can check the margin and the margin percent in the sales | ||
order line. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.