Skip to content

Commit

Permalink
[IMP]Changes after review, generate readme, index using oca-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
matteonext committed Aug 30, 2023
1 parent 9409841 commit f58e57c
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 34 deletions.
85 changes: 85 additions & 0 deletions sale_commission_settlement_payment_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
===========================================
Commission Settlement based on payment date
===========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a0074ce513f10f5b450f04b41643064c7431d31779f2aa4fa347bda7872a6b55
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_payment_date
: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_payment_date
: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 allows to settle commissions up to a specified payment date.
This only applies to commission types with "invoice status = payment based".

**Table of contents**

.. contents::
:local:

Usage
=====

For settling the commissions to agents with payments date limit
use the default settlement method and add on wizard invoice payment
date until you want to settle commissions.

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_payment_date%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
~~~~~~~

* Nextev
* Ooops404

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

* `Nextev <https://www.nextev.it>`

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/commission <https://github.com/OCA/commission/tree/14.0/sale_commission_settlement_payment_date>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion sale_commission_settlement_payment_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Commission Settlement base on payment date",
"name": "Commission Settlement based on payment date",
"version": "14.0.1.0.0",
"author": "Nextev," "Ooops404," "Odoo Community Association (OCA)",
"category": "Sales Management",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Sales Quick Commission</title>
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Commission Settlement based on payment date</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,61 +360,68 @@
</style>
</head>
<body>
<div class="document" id="sales-quick-commission">
<h1 class="title">Sales Quick Commission</h1>
<div class="document" id="commission-settlement-based-on-payment-date">
<h1 class="title">Commission Settlement based on payment date</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a0074ce513f10f5b450f04b41643064c7431d31779f2aa4fa347bda7872a6b55
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/commission/tree/14.0/sale_quick_commission"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_quick_commission"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/165/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module makes <strong>sale_commission</strong> and <strong>sale_quick</strong> compatible.</p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/commission/tree/14.0/sale_commission_settlement_payment_date"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_settlement_payment_date"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/commission&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to settle commissions up to a specified payment date.
This only applies to commission types with “invoice status = payment based”.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>For settling the commissions to agents with payments date limit
use the default settlement method and add on wizard invoice payment
date until you want to settle commissions.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/commission/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/commission/issues/new?body=module:%20sale_quick_commission%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/commission/issues/new?body=module:%20sale_commission_settlement_payment_date%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>Ilyas</li>
<li>Nextev</li>
<li>Ooops404</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.ooops404.com">Ooops404</a>:<ul>
<li>Ilyas &lt;<a class="reference external" href="mailto:irazor147&#64;gmail.com">irazor147&#64;gmail.com</a>&gt;</li>
</ul>
</li>
<li><cite>Nextev &lt;https://www.nextev.it&gt;</cite></li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id6">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>
<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>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/commission/tree/14.0/sale_quick_commission">OCA/commission</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/commission/tree/14.0/sale_commission_settlement_payment_date">OCA/commission</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
17 changes: 8 additions & 9 deletions sale_commission_settlement_payment_date/wizard/wizard_settle.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ def _get_agent_lines(self, agent, date_to_agent):
Exclude invoices with invoice payment date is after date_payment_to
"""
agent_lines = super()._get_agent_lines(agent, date_to_agent)
for line in agent_lines.filtered(
lambda r: r.commission_id.invoice_state == "paid"
and self.date_payment_to != "false"
):
if (
line.invoice_id.invoice_payments_widget != "false"
and not self.check_payment_date(line)
):
agent_lines -= line
if self.date_payment_to:
for line in agent_lines:
if (
line.commission_id.invoice_state == "paid"
and line.invoice_id.invoice_payments_widget != "false"
and not self.check_payment_date(line)
):
agent_lines -= line

Check warning on line 26 in sale_commission_settlement_payment_date/wizard/wizard_settle.py

View check run for this annotation

Codecov / codecov/patch

sale_commission_settlement_payment_date/wizard/wizard_settle.py#L26

Added line #L26 was not covered by tests
return agent_lines

def check_payment_date(self, agent_line):
Expand Down

0 comments on commit f58e57c

Please sign in to comment.