-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_it_sale_commission_riba: black, isort, prettier
- Loading branch information
1 parent
c626f2c
commit 201101a
Showing
11 changed files
with
72 additions
and
50 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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
'name': 'Italian Localization - Sale commission - Ri.Ba', | ||
'summary': 'Modulo ponte tra provvigioni agenti e Ri.Ba', | ||
'version': '12.0.1.0.0', | ||
'category': 'Sales', | ||
'website': 'https://github.com/OCA/l10n-italy', | ||
'author': 'Nextev Srl, Odoo Community Association (OCA)', | ||
'license': 'AGPL-3', | ||
'application': False, | ||
'installable': True, | ||
'depends': [ | ||
'sale_commission', | ||
'l10n_it_ricevute_bancarie', | ||
"name": "Italian Localization - Sale commission - Ri.Ba", | ||
"summary": "Modulo ponte tra provvigioni agenti e Ri.Ba", | ||
"version": "14.0.1.0.0", | ||
"category": "Sales", | ||
"website": "https://github.com/OCA/l10n-italy", | ||
"author": "Nextev Srl, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"sale_commission", | ||
"l10n_it_ricevute_bancarie", | ||
], | ||
'data': [ | ||
'views/invoice_no_commission.xml', | ||
'views/configuration_riba_view.xml', | ||
"data": [ | ||
"views/invoice_no_commission.xml", | ||
"views/configuration_riba_view.xml", | ||
], | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from . import account_invoice | ||
from . import account_move | ||
from . import riba_config |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from odoo import models, fields | ||
from odoo import fields, models | ||
|
||
|
||
class RibaConfiguration(models.Model): | ||
|
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
14 changes: 10 additions & 4 deletions
14
l10n_it_sale_commission_riba/views/configuration_riba_view.xml
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 |
---|---|---|
@@ -1,13 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record model="ir.ui.view" id="riba_safety_days"> | ||
<field name="name">riba.conf.form.safety.days</field> | ||
<field name="model">riba.configuration</field> | ||
<field name="inherit_id" ref="l10n_it_ricevute_bancarie.view_riba_configuration_form"/> | ||
<field | ||
name="inherit_id" | ||
ref="l10n_it_ricevute_bancarie.view_riba_configuration_form" | ||
/> | ||
<field name="arch" type="xml"> | ||
<field name="type" position="after"> | ||
<field name="safety_days" attrs="{'invisible': [('type', '!=', 'sbf')]}"/> | ||
<field | ||
name="safety_days" | ||
attrs="{'invisible': [('type', '!=', 'sbf')]}" | ||
/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> | ||
</odoo> |
12 changes: 6 additions & 6 deletions
12
l10n_it_sale_commission_riba/views/invoice_no_commission.xml
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record model="ir.ui.view" id="invoice_no_commission_form"> | ||
<field name="name">invoice.no.commission.form</field> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.invoice_form"/> | ||
<field name="model">account.move</field> | ||
<field name="inherit_id" ref="account.view_move_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="team_id" position="after"> | ||
<field name="no_commission"/> | ||
</field> | ||
<group id="header_right_group" position="inside"> | ||
<field name="no_commission" /> | ||
</group> | ||
</field> | ||
</record> | ||
</odoo> |
40 changes: 24 additions & 16 deletions
40
l10n_it_sale_commission_riba/wizard/wizard_riba_commissions_settle.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 |
---|---|---|
@@ -1,37 +1,45 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
from datetime import date, timedelta | ||
|
||
from odoo import models | ||
|
||
|
||
class SaleCommissionMakeSettle(models.TransientModel): | ||
_inherit = "sale.commission.make.settle" | ||
|
||
def _get_agent_lines(self, agent, date_to_agent): | ||
""" | ||
Exclude outstanding invoices, those with Ri.Ba subject to collection payment | ||
if at least safety days haven't passed since expiration date and those that | ||
have manually set the flag 'no_commission' (for example if it has been | ||
outstanding for years now). | ||
Exclude outstanding invoices, those with Ri.Ba subject to collection payment | ||
if at least safety days haven't passed since expiration date and those that | ||
have manually set the flag 'no_commission' (for example if it has been | ||
outstanding for years now). | ||
""" | ||
agent_lines = super()._get_agent_lines(agent, date_to_agent) | ||
# rimuove righe delle fatture che hanno impostato flag "no_commission" | ||
agent_lines = agent_lines.filtered(lambda al: not al.invoice.no_commission) | ||
agent_lines = agent_lines.filtered(lambda al: not al.invoice_id.no_commission) | ||
for line in agent_lines: | ||
# filtro su Ri.Ba | ||
if line.invoice.payment_term_id.riba: | ||
if line.invoice_id.invoice_payment_term_id.riba: | ||
# rimuove le righe se ri.ba è insoluta o nel caso sia sbf non siano | ||
# passati almeno i giorni di sicurezza da data di scadenza del pagamento | ||
# per tenersi un margine e verificare che sia stata pagata | ||
riba_mv_line = self.env['riba.distinta.move.line'].search([ | ||
('move_line_id.invoice_id', '=', line.invoice.id) | ||
]) | ||
riba_mv_line = self.env["riba.distinta.move.line"].search( | ||
[("move_line_id.move_id", "=", line.invoice_id.id)] | ||
) | ||
riba_type = riba_mv_line.riba_line_id.type | ||
if line.commission.invoice_state == 'paid' and ( | ||
line.invoice.is_unsolved or ( | ||
(line.invoice.date_due + timedelta( | ||
days=riba_mv_line.riba_line_id.config_id.safety_days) | ||
> date.today()) | ||
and riba_type == 'sbf')): | ||
if line.commission_id.invoice_state == "paid" and ( | ||
line.invoice_id.is_unsolved | ||
or ( | ||
( | ||
line.invoice_id.invoice_date_due | ||
+ timedelta( | ||
days=riba_mv_line.riba_line_id.config_id.safety_days | ||
) | ||
> date.today() | ||
) | ||
and riba_type == "sbf" | ||
) | ||
): | ||
agent_lines -= line | ||
return agent_lines |
1 change: 1 addition & 0 deletions
1
setup/l10n_it_sale_commission_riba/odoo/addons/l10n_it_sale_commission_riba
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 @@ | ||
../../../../l10n_it_sale_commission_riba |
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 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pdfminer.six # needed by attachment_indexation module | ||
odoo14-addon-l10n_it_sale_commission_riba @ git+https://github.com/OCA/commission.git@refs/pull/407/head#subdirectory=setup/sale_commission |