Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] Add l10n_br_sale_commission module
- Loading branch information
Showing
12 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,63 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
========================== | ||
L10n BR Sales Commission | ||
========================== | ||
|
||
This module extends sale_commission to adapt invoice form and add the option of | ||
use amount_gross in commission calc. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
* Go to Sales, Commission Types and create a commission with base "Valor venda s/ impostos" | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/165/8.0 | ||
|
||
Known issues / Roadmap | ||
====================== | ||
* Tests | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/odoo-brazil/odoo-brazil-commission/issues>`_. 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 `feedback | ||
<https://github.com/odoo-brazil-commission/issues/issues/new?body=module:%20 | ||
l10n_br_sale_commission%0Aversion:%20 | ||
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
* Luis Felipe Mileo <mileo@kmee.com.br> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: http://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: http://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
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,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 KMEE INFORMATICA LTDA (https://www.kmee.com.br) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
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,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 KMEE INFORMATICA LTDA (https://www.kmee.com.br) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
{ | ||
'name': 'L10n BR Sale Commission', | ||
'version': '8.0.0.0.0', | ||
'category': 'Sale', | ||
'license': 'AGPL-3', | ||
'summary': 'Sale commissions computed without tax', | ||
'author': "KMEE," | ||
"Odoo Community Association (OCA)", | ||
'website': 'http://www.kmee.com.br', | ||
'depends': [ | ||
'l10n_br_sale_product', | ||
'sale_commission' | ||
], | ||
'data': [ | ||
'view/account_invoice_view.xml' | ||
], | ||
'demo': [ | ||
'demo/commission_demo.xml' | ||
], | ||
'installable': True, | ||
'active': False, | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<openerp> | ||
<data> | ||
<record id="commission_notax" model="sale.commission"> | ||
<field name="name">10% s/ IPI</field> | ||
<field name="commission_type">fixed</field> | ||
<field name="active">True</field> | ||
<field name="fix_qty">10.0</field> | ||
<field name="base">notax</field> | ||
</record> | ||
</data> | ||
</openerp> |
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,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 KMEE INFORMATICA LTDA (https://www.kmee.com.br) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import account_invoice | ||
from . import sale_commission | ||
from . import sale_order |
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,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 KMEE INFORMATICA LTDA (https://www.kmee.com.br) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openerp import models, api | ||
from openerp.tools.safe_eval import safe_eval | ||
|
||
|
||
class AccountInvoiceLineAgent(models.Model): | ||
_inherit = 'account.invoice.line.agent' | ||
|
||
@api.depends('commission.commission_type', 'invoice_line.price_subtotal', | ||
'commission.amount_base_type') | ||
def _compute_amount(self): | ||
for line in self: | ||
line.amount = 0.0 | ||
if (line.commission.amount_base_type == 'notax' and | ||
not line.invoice_line.product_id.commission_free and | ||
line.commission): | ||
subtotal = line.invoice_line.price_gross | ||
if line.commission.commission_type == 'fixed': | ||
line.amount = subtotal * (line.commission.fix_qty / 100.0) | ||
else: | ||
line.amount = line.commission.calculate_section(subtotal) | ||
else: | ||
return super(AccountInvoiceLineAgent, line)._compute_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,12 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 KMEE INFORMATICA LTDA (https://www.kmee.com.br) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openerp import models, fields | ||
|
||
|
||
class Commission(models.Model): | ||
_inherit = 'sale.commission' | ||
|
||
amount_base_type = fields.Selection(selection_add=[("notax", | ||
"Valor venda s/ impostos")]) |
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,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 KMEE INFORMATICA LTDA (https://www.kmee.com.br) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openerp import models, api | ||
from openerp.tools.safe_eval import safe_eval | ||
|
||
|
||
class SaleOrderLineAgent(models.Model): | ||
_inherit = 'sale.order.line.agent' | ||
|
||
@api.depends('commission.commission_type', 'sale_line.price_subtotal', | ||
'commission.amount_base_type') | ||
def _compute_amount(self): | ||
for line in self: | ||
line.amount = 0.0 | ||
if (line.commission.amount_base_type == 'notax' and | ||
not line.sale_line.product_id.commission_free and | ||
line.commission): | ||
subtotal = line.sale_line.price_gross | ||
if line.commission.commission_type == 'fixed': | ||
line.amount = subtotal * (line.commission.fix_qty / 100.0) | ||
else: | ||
line.amount = line.commission.calculate_section(subtotal) | ||
else: | ||
return super(SaleOrderLineAgent, line)._compute_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,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<record id="sale_commission.invoice_line_form_agent" model="ir.ui.view"> | ||
<field name="active">False</field> | ||
</record> | ||
<record model="ir.ui.view" id="view_l10n_br_account_invoice_line_commission_form"> | ||
<field name="name">l10n_br_account.invoice.line.form</field> | ||
<field name="model">account.invoice.line</field> | ||
<field name="inherit_id" ref="l10n_br_account_product.view_l10n_br_account_invoice_line_form" /> | ||
<field name="priority">36</field> | ||
<field name="arch" type="xml"> | ||
<notebook position="inside"> | ||
<page string="Comissão"> | ||
<group> | ||
<group> | ||
<field name="commission_free"/> | ||
<field name="agents" | ||
attrs="{'readonly': [('commission_free', '=', True)]}"/> | ||
</group> | ||
</group> | ||
</page> | ||
</notebook> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |