Skip to content

Commit

Permalink
Merge PR #543 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jul 17, 2024
2 parents 20b699b + 43f80d8 commit 4ee240d
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 33 deletions.
40 changes: 33 additions & 7 deletions sale_commission_check_deposit/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,23 @@ Sales commission check deposit

The module allows you to integrate check deposit with agent commissions.

When generating agent commissions, an invoice with checks payment
will be taken into consideration only after the number of days set in
the "Safety Days" field in journal configuration from due date set in
check payment.
When generating agent settlements, select a
payment date until which commissions should be settled.

Invoices with checks payment will be taken
into consideration only if the number of
days set in the "Safety days for commission"
field in journal configuration from due date
set in check payment have passed from settlement payment date.

Eg:

- Invoice 0001 is paid with check
- Check due date: January 1st
- "Safety days for commission" set in check journal: 10
- In settlement wizard:
- Settle commissions until payment date: January 5th => commission is not settled for check
- Settle commissions until payment date: January 15th => commission is settled for check

**Table of contents**

Expand All @@ -52,7 +65,6 @@ For pay and register a checks deposit:

#. Create an invoice and using Checks to pay it.
#. Add a new checks deposit adding that payment.
#. Validate checks deposit.

For settling the commissions to agents:

Expand All @@ -64,8 +76,8 @@ For settling the commissions to agents:
#. You can settle only certain agents if you select them on the "Agents"
section. Leave it empty for settling all.
#. Click on "Make settlements" button.
#. If safety days have passed from due date set in checks payment commission will be
settled properly.
#. If safety days have passed between settlement payment date and check due date,
commission will be settled properly.

Bug Tracker
===========
Expand Down Expand Up @@ -103,6 +115,20 @@ 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-aleuffre| image:: https://github.com/aleuffre.png?size=40px
:target: https://github.com/aleuffre
:alt: aleuffre
.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px
:target: https://github.com/renda-dev
:alt: renda-dev
.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px
:target: https://github.com/PicchiSeba
:alt: PicchiSeba

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

|maintainer-aleuffre| |maintainer-renda-dev| |maintainer-PicchiSeba|

This module is part of the `OCA/commission <https://github.com/OCA/commission/tree/14.0/sale_commission_check_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_commission_check_deposit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "Sales commission check deposit",
"version": "14.0.1.0.0",
"author": "Nextev Srl," "Odoo Community Association (OCA)",
"maintainers": ["aleuffre", "renda-dev", "PicchiSeba"],
"category": "Sales Management",
"license": "AGPL-3",
"depends": [
Expand Down
6 changes: 5 additions & 1 deletion sale_commission_check_deposit/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ class AccountJournal(models.Model):
_inherit = "account.journal"

is_check_journal = fields.Boolean()
safety_days = fields.Integer(default=5)
safety_days = fields.Integer(
string="Safety days for commission",
help="Days after expiration date for commission settlement",
default=5,
)
21 changes: 17 additions & 4 deletions sale_commission_check_deposit/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
The module allows you to integrate check deposit with agent commissions.

When generating agent commissions, an invoice with checks payment
will be taken into consideration only after the number of days set in
the "Safety Days" field in journal configuration from due date set in
check payment.
When generating agent settlements, select a
payment date until which commissions should be settled.

Invoices with checks payment will be taken
into consideration only if the number of
days set in the "Safety days for commission"
field in journal configuration from due date
set in check payment have passed from settlement payment date.

Eg:

- Invoice 0001 is paid with check
- Check due date: January 1st
- "Safety days for commission" set in check journal: 10
- In settlement wizard:
- Settle commissions until payment date: January 5th => commission is not settled for check
- Settle commissions until payment date: January 15th => commission is settled for check
5 changes: 2 additions & 3 deletions sale_commission_check_deposit/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ For pay and register a checks deposit:

#. Create an invoice and using Checks to pay it.
#. Add a new checks deposit adding that payment.
#. Validate checks deposit.

For settling the commissions to agents:

Expand All @@ -19,5 +18,5 @@ For settling the commissions to agents:
#. You can settle only certain agents if you select them on the "Agents"
section. Leave it empty for settling all.
#. Click on "Make settlements" button.
#. If safety days have passed from due date set in checks payment commission will be
settled properly.
#. If safety days have passed between settlement payment date and check due date,
commission will be settled properly.
48 changes: 33 additions & 15 deletions sale_commission_check_deposit/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
: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 @@ -275,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 @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

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

span.section-subtitle {
Expand Down Expand Up @@ -371,10 +371,28 @@ <h1 class="title">Sales commission check deposit</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/commission/tree/14.0/sale_commission_check_deposit"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_check_deposit"><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/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>The module allows you to integrate check deposit with agent commissions.</p>
<p>When generating agent commissions, an invoice with checks payment
will be taken into consideration only after the number of days set in
the “Safety Days” field in journal configuration from due date set in
check payment.</p>
<p>When generating agent settlements, select a
payment date until which commissions should be settled.</p>
<p>Invoices with checks payment will be taken
into consideration only if the number of
days set in the “Safety days for commission”
field in journal configuration from due date
set in check payment have passed from settlement payment date.</p>
<p>Eg:</p>
<ul class="simple">
<li>Invoice 0001 is paid with check</li>
<li>Check due date: January 1st</li>
<li>“Safety days for commission” set in check journal: 10</li>
<li><dl class="first docutils">
<dt>In settlement wizard:</dt>
<dd><ul class="first last">
<li>Settle commissions until payment date: January 5th =&gt; commission is not settled for check</li>
<li>Settle commissions until payment date: January 15th =&gt; commission is settled for check</li>
</ul>
</dd>
</dl>
</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -399,7 +417,6 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<ol class="arabic simple">
<li>Create an invoice and using Checks to pay it.</li>
<li>Add a new checks deposit adding that payment.</li>
<li>Validate checks deposit.</li>
</ol>
<p>For settling the commissions to agents:</p>
<ol class="arabic simple">
Expand All @@ -411,11 +428,8 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<li>You can settle only certain agents if you select them on the “Agents”
section. Leave it empty for settling all.</li>
<li>Click on “Make settlements” button.</li>
<li><dl class="first docutils">
<dt>If safety days have passed from due date set in checks payment commission will be</dt>
<dd>settled properly.</dd>
</dl>
</li>
<li>If safety days have passed between settlement payment date and check due date,
commission will be settled properly.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
Expand Down Expand Up @@ -443,10 +457,14 @@ <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>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/aleuffre"><img alt="aleuffre" src="https://github.com/aleuffre.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/renda-dev"><img alt="renda-dev" src="https://github.com/renda-dev.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/PicchiSeba"><img alt="PicchiSeba" src="https://github.com/PicchiSeba.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/commission/tree/14.0/sale_commission_check_deposit">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>
Expand Down
5 changes: 2 additions & 3 deletions sale_commission_check_deposit/wizard/wizard_check_settle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import json
from datetime import date, timedelta
from datetime import timedelta

from odoo import models

Expand Down Expand Up @@ -31,13 +31,12 @@ def get_move_ids(self, payments_widget):
[
("move_id", "in", account_move_ids),
("journal_id.is_check_journal", "=", True),
("check_deposit_id", "!=", False),
]
)
return all(
[
x.date_maturity + timedelta(days=x.journal_id.safety_days)
< date.today()
< self.date_payment_to
for x in move_lines
]
)

0 comments on commit 4ee240d

Please sign in to comment.