Skip to content

Commit

Permalink
[15.0][ADD] account_commission_skip_anglo_saxon
Browse files Browse the repository at this point in the history
  • Loading branch information
cormaza committed Jul 14, 2023
1 parent a5db7ef commit 017afd0
Show file tree
Hide file tree
Showing 13 changed files with 581 additions and 3 deletions.
9 changes: 6 additions & 3 deletions account_commission/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def _compute_any_settled(self):
for record in self:
record.any_settled = any(record.mapped("agent_ids.settled"))

def filter_commission_applicable_lines(self):
return self.filtered(
lambda x: x.move_id.partner_id and x.move_id.move_type[:3] == "out"
)

@api.depends("move_id.partner_id")
def _compute_agent_ids(self):
for res in self:
Expand All @@ -149,9 +154,7 @@ def _compute_agent_ids(self):
line.currency_id = False
line.commission_id = False
self.agent_ids = False # for resetting previous agents
for record in self.filtered(
lambda x: x.move_id.partner_id and x.move_id.move_type[:3] == "out"
):
for record in self.filter_commission_applicable_lines():
if not record.commission_free and record.product_id:
record.agent_ids = record._prepare_agents_vals_partner(
record.move_id.partner_id, settlement_type="sale_invoice"
Expand Down
76 changes: 76 additions & 0 deletions account_commission_skip_anglo_saxon/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
====================================================
Skip Anglo Saxon Entries in Account Commission Lines
====================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:07a8c2d1ab9ba4790d3073b14751ab22bcb4b6f1d44d3abfa977821dabe21e84
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/15.0/account_commission_skip_anglo_saxon
:alt: OCA/commission
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/commission-15-0/commission-15-0-account_commission_skip_anglo_saxon
: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=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module skip create commission lines when stock_account module is installed and anglo saxon is active

**Table of contents**

.. contents::
:local:

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:%20account_commission_skip_anglo_saxon%0Aversion:%2015.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
~~~~~~~

* Christopher Ormaza

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

* Christopher Ormaza <[email protected]>

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/15.0/account_commission_skip_anglo_saxon>`_ 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 account_commission_skip_anglo_saxon/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions account_commission_skip_anglo_saxon/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Skip Anglo Saxon Entries in Account Commission Lines",
"version": "15.0.1.0.0",
"summary": "Skip Anglo Saxon Entries in Account Commission Lines",
"author": "Christopher Ormaza, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/commission",
"category": "Sales Management",
"license": "AGPL-3",
"depends": ["account_commission", "stock_account"],
"data": [],
"demo": [],
"installable": True,
"auto_install": True,
}
1 change: 1 addition & 0 deletions account_commission_skip_anglo_saxon/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move
10 changes: 10 additions & 0 deletions account_commission_skip_anglo_saxon/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import models


class AccountMove(models.Model):

_inherit = "account.move"

def filter_commission_applicable_lines(self):
lines = super().filter_commission_applicable_lines()
return lines.filtered(lambda x: not x.is_anglo_saxon_line)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Christopher Ormaza <[email protected]>
1 change: 1 addition & 0 deletions account_commission_skip_anglo_saxon/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module skip create commission lines when stock_account module is installed and anglo saxon is active
Loading

0 comments on commit 017afd0

Please sign in to comment.