Skip to content

Commit

Permalink
[ADD]sale_commission_settlement_report: manage settlement report visu…
Browse files Browse the repository at this point in the history
…alization
  • Loading branch information
PicchiSeba committed Jul 23, 2024
1 parent 2c5d08a commit 6c3a55a
Show file tree
Hide file tree
Showing 16 changed files with 725 additions and 0 deletions.
97 changes: 97 additions & 0 deletions sale_commission_settlement_report/README.rst
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.
1 change: 1 addition & 0 deletions sale_commission_settlement_report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions sale_commission_settlement_report/__manifest__.py
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,
}
4 changes: 4 additions & 0 deletions sale_commission_settlement_report/models/__init__.py
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
14 changes: 14 additions & 0 deletions sale_commission_settlement_report/models/res_company.py
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 sale_commission_settlement_report/models/res_config_settings.py
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,
)
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

Check warning on line 18 in sale_commission_settlement_report/models/sale_commission_settlement.py

View check run for this annotation

Codecov / codecov/patch

sale_commission_settlement_report/models/sale_commission_settlement.py#L18

Added line #L18 was not covered by tests
if record.company_id.settlement_skip_zero_amount_lines:
lines = lines.filtered(lambda line: line.settled_amount)
record.showable_line_ids = lines

Check warning on line 21 in sale_commission_settlement_report/models/sale_commission_settlement.py

View check run for this annotation

Codecov / codecov/patch

sale_commission_settlement_report/models/sale_commission_settlement.py#L21

Added line #L21 was not covered by tests
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",
)
12 changes: 12 additions & 0 deletions sale_commission_settlement_report/readme/CONFIGURE.rst
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"
2 changes: 2 additions & 0 deletions sale_commission_settlement_report/readme/DESCRIPTION.rst
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
Loading

0 comments on commit 6c3a55a

Please sign in to comment.