Skip to content

Commit

Permalink
[MIG] sale_commission_formula: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fredzamoabg committed Jun 4, 2021
1 parent 0d288c3 commit 9f4c0a8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 29 deletions.
10 changes: 5 additions & 5 deletions sale_commission_formula/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Sale Commission Formula
: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/13.0/sale_commission_formula
:target: https://github.com/OCA/commission/tree/14.0/sale_commission_formula
:alt: OCA/commission
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/commission-13-0/commission-13-0-sale_commission_formula
:target: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_formula
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/165/13.0
:target: https://runbot.odoo-community.org/runbot/165/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -46,7 +46,7 @@ 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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/commission/issues/new?body=module:%20sale_commission_formula%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/commission/issues/new?body=module:%20sale_commission_formula%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.

Expand Down Expand Up @@ -81,6 +81,6 @@ 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/13.0/sale_commission_formula>`_ project on GitHub.
This module is part of the `OCA/commission <https://github.com/OCA/commission/tree/14.0/sale_commission_formula>`_ 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_formula/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Sale Commission Formula",
"version": "13.0.1.1.1",
"version": "14.0.1.0.0",
"category": "Sale",
"license": "AGPL-3",
"summary": "Sale commissions computed by formulas",
Expand Down
13 changes: 0 additions & 13 deletions sale_commission_formula/migrations/13.0.1.0.0/pre-migration.py

This file was deleted.

4 changes: 3 additions & 1 deletion sale_commission_formula/models/sale_commission.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
class SaleCommission(models.Model):
_inherit = "sale.commission"

commission_type = fields.Selection(selection_add=[("formula", "Formula")])
commission_type = fields.Selection(
selection_add=[("formula", "Formula")], ondelete={"formula": "set default"}
)
formula = fields.Text(
"Formula",
default="if line._name == 'sale.order.line':\n"
Expand Down
8 changes: 4 additions & 4 deletions sale_commission_formula/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<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/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Sale Commission Formula</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Sale Commission Formula</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/13.0/sale_commission_formula"><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-13-0/commission-13-0-sale_commission_formula"><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/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></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_formula"><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_formula"><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 extends sale_commission to introduce the use of formulas to
compute the agent commissions.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -395,7 +395,7 @@ <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_commission_formula%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/commission/issues/new?body=module:%20sale_commission_formula%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">
Expand Down Expand Up @@ -425,7 +425,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<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/13.0/sale_commission_formula">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_formula">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
10 changes: 5 additions & 5 deletions sale_commission_formula/tests/test_commission_formula.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _invoice_sale_order(self, sale_order):
def test_sale_order_commission(self):
# we test the '5% + 10% extra' we should return 41.25 since
# the order total amount is 750.00.
self.so_line.agents = False # Erase current agents
self.so_line.agent_ids = False # Erase current agents
self.env["sale.order.line.agent"].create(
{
"object_id": self.so_line.id,
Expand All @@ -44,11 +44,11 @@ def test_invoice_commission(self):
self.sale_order.action_confirm()
self.so_line.qty_delivered = self.so_line.product_uom_qty
self._invoice_sale_order(self.sale_order)
self.sale_order.invoice_ids.post()
self.sale_order.invoice_ids.action_post()
invoice = self.sale_order.invoice_ids[0]
# we add the commissions on the first invoice line
invoice_line = invoice.invoice_line_ids[0]
invoice_line.agents = False # Erase current agents
invoice_line.agent_ids = False # Erase current agents
self.env["account.invoice.line.agent"].create(
{
"object_id": invoice_line.id,
Expand All @@ -64,11 +64,11 @@ def test_invoice_refund_commission(self):
self.sale_order.action_confirm()
self.so_line.qty_delivered = self.so_line.product_uom_qty
self._invoice_sale_order(self.sale_order)
self.sale_order.invoice_ids.post()
self.sale_order.invoice_ids.action_post()
invoice = self.sale_order.invoice_ids[0]
# we add the commissions on the first invoice line
invoice_line = invoice.invoice_line_ids[0]
invoice_line.agents = False # Erase current agents
invoice_line.agent_ids = False # Erase current agents
self.env["account.invoice.line.agent"].create(
{
"object_id": invoice_line.id,
Expand Down

0 comments on commit 9f4c0a8

Please sign in to comment.