-
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD]sale_commission_settlement_report: manage settlement report visu…
…alization
- Loading branch information
1 parent
2c5d08a
commit 6c3a55a
Showing
16 changed files
with
725 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,97 @@ | ||
=================================== | ||
Sales Commissions Settlement Report | ||
=================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:ce159e2233d2f40f3a1d6e7cdfe31935afd20bc5832eac1478134bf93ae09fe1 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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%2Fcommission-lightgray.png?logo=github | ||
:target: https://github.com/OCA/commission/tree/14.0/sale_commission_settlement_report | ||
:alt: OCA/commission | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_settlement_report | ||
: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/commission&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module contains some settings applied to the settlement itself or the report. | ||
Refer to the Configuration section for the details | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
To show the partner in settlement lines: | ||
|
||
#. Go to *Settings > Sales > Quotations & Orders*: | ||
|
||
* enable the setting "Show partner details in settlements report" | ||
|
||
|
||
To hide lines with amount equals to 0: | ||
|
||
#. Go to *Settings > Sales > Quotations & Orders*: | ||
|
||
* enable the setting "Skip lines in settlements with zero amount" | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/commission/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/commission/issues/new?body=module:%20sale_commission_settlement_report%0Aversion:%2014.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 | ||
~~~~~~~ | ||
|
||
* Ooops404 | ||
* PyTech-SRL | ||
|
||
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-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px | ||
:target: https://github.com/PicchiSeba | ||
:alt: PicchiSeba | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-PicchiSeba| | ||
|
||
This module is part of the `OCA/commission <https://github.com/OCA/commission/tree/14.0/sale_commission_settlement_report>`_ 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,17 @@ | ||
{ | ||
"name": "Sales Commissions Settlement Report", | ||
"summary": "Settings to customize the settlement report", | ||
"version": "14.0.1.0.0", | ||
"author": "Odoo Community Association (OCA), Ooops404, PyTech-SRL", | ||
"maintainers": ["PicchiSeba"], | ||
"category": "Sales", | ||
"website": "https://github.com/OCA/commission", | ||
"license": "AGPL-3", | ||
"depends": ["sale_commission"], | ||
"data": [ | ||
"views/report_settlement_templates.xml", | ||
"views/res_config_settings_view.xml", | ||
"views/sale_commission_settlement_view.xml", | ||
], | ||
"installable": True, | ||
} |
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,4 @@ | ||
from . import res_company | ||
from . import res_config_settings | ||
from . import sale_commission_settlement | ||
from . import sale_commission_settlement_line |
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,14 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
show_partner_settlement_report = fields.Boolean( | ||
"Show partner details in settlements report", | ||
default=False, | ||
) | ||
settlement_skip_zero_amount_lines = fields.Boolean( | ||
"Skip lines in settlements with zero amount", | ||
default=False, | ||
) |
14 changes: 14 additions & 0 deletions
14
sale_commission_settlement_report/models/res_config_settings.py
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,14 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
show_partner_settlement_report = fields.Boolean( | ||
related="company_id.show_partner_settlement_report", | ||
readonly=False, | ||
) | ||
settlement_skip_zero_amount_lines = fields.Boolean( | ||
related="company_id.settlement_skip_zero_amount_lines", | ||
readonly=False, | ||
) |
21 changes: 21 additions & 0 deletions
21
sale_commission_settlement_report/models/sale_commission_settlement.py
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,21 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class SaleCommissionSettlement(models.Model): | ||
_inherit = "sale.commission.settlement" | ||
|
||
showable_line_ids = fields.Many2many( | ||
"sale.commission.settlement.line", | ||
compute="_compute_showable_line_ids", | ||
) | ||
show_partner_settlement_report = fields.Boolean( | ||
related="company_id.show_partner_settlement_report", | ||
) | ||
|
||
@api.depends("line_ids", "line_ids.settled_amount") | ||
def _compute_showable_line_ids(self): | ||
for record in self: | ||
lines = record.line_ids | ||
if record.company_id.settlement_skip_zero_amount_lines: | ||
lines = lines.filtered(lambda line: line.settled_amount) | ||
record.showable_line_ids = lines | ||
13 changes: 13 additions & 0 deletions
13
sale_commission_settlement_report/models/sale_commission_settlement_line.py
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,13 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class SettlementLine(models.Model): | ||
_inherit = "sale.commission.settlement.line" | ||
|
||
partner_id = fields.Many2one( | ||
"res.partner", | ||
related="invoice_line_id.partner_id", | ||
) | ||
show_partner_settlement_report = fields.Boolean( | ||
related="company_id.show_partner_settlement_report", | ||
) |
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,12 @@ | ||
To show the partner in settlement lines: | ||
|
||
#. Go to *Settings > Sales > Quotations & Orders*: | ||
|
||
* enable the setting "Show partner details in settlements report" | ||
|
||
|
||
To hide lines with amount equals to 0: | ||
|
||
#. Go to *Settings > Sales > Quotations & Orders*: | ||
|
||
* enable the setting "Skip lines in settlements with zero amount" |
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 @@ | ||
This module contains some settings applied to the settlement itself or the report. | ||
Refer to the Configuration section for the details |
Oops, something went wrong.