Skip to content

Commit

Permalink
Merge PR #1018 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by ivantodorovich
  • Loading branch information
OCA-git-bot committed Dec 27, 2023
2 parents 3bdffdd + 1632a68 commit 5a94f69
Show file tree
Hide file tree
Showing 20 changed files with 862 additions and 0 deletions.
122 changes: 122 additions & 0 deletions pos_financial_risk/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
============================
Point of Sale Financial Risk
============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:fb8495a13cf20e3ad4d1b279ec17e2e541168b09533d33a7870480db35107179
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fpos-lightgray.png?logo=github
:target: https://github.com/OCA/pos/tree/16.0/pos_financial_risk
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_financial_risk
: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/pos&target_branch=16.0
:alt: Try me on Runboat

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

Extends Partner Financial Risk to manage POS orders.

If POS order exceeds partner credit limit POS only non restricted payment methods will remain available.

Payment method availability can be specified both system wide and for a particular POS.

If no restrictions are specified for a POS global ones will be applied.

**Table of contents**

.. contents::
:local:

Configuration
=============

To restrict a payment method for all POS:

Go to **Post of Sale**/**Configuration**/**Payment Methods** and select a payment method.

Enable **Credit Limit Restricted** to restrict usage of this payment method if credit limit threshold is overrun.



To specify restriction for a selected POS:

Go to **Settings**/**Point of Sale** select a POS and scroll down to the **Payment** section.

Add payment methods to the **Credit Limit Restricted** field.

Usage
=====

To use this module, you need to:

Go to Customers > Financial Risk

Set limits and choose options to compute in credit limit.

Go to POS -> Open POS and create a new order.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/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/pos/issues/new?body=module:%20pos_financial_risk%0Aversion:%2016.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
~~~~~~~

* Cetmix

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

* Cetmix <https://cetmix.com/>
* Maksim Shurupov

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.

.. |maintainer-geomer198| image:: https://github.com/geomer198.png?size=40px
:target: https://github.com/geomer198
:alt: geomer198
.. |maintainer-CetmixGitDrone| image:: https://github.com/CetmixGitDrone.png?size=40px
:target: https://github.com/CetmixGitDrone
:alt: CetmixGitDrone

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

|maintainer-geomer198| |maintainer-CetmixGitDrone|

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_financial_risk>`_ 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 pos_financial_risk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions pos_financial_risk/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Point of Sale Financial Risk",
"version": "16.0.1.0.0",
"category": "Sales/Point of Sale",
"summary": "Point of Sale Fonancial Risk",
"depends": ["point_of_sale", "account_financial_risk"],
"website": "https://github.com/OCA/pos",
"author": "Cetmix,Odoo Community Association (OCA)",
"maintainers": ["geomer198", "CetmixGitDrone"],
"data": [
"views/pos_payment_method_views.xml",
"views/res_config_settings_views.xml",
],
"installable": True,
"assets": {
"point_of_sale.assets": [
"pos_financial_risk/static/src/js/*.js",
"pos_financial_risk/static/src/scss/*.scss",
"pos_financial_risk/static/src/xml/*.xml",
],
},
"license": "AGPL-3",
}
4 changes: 4 additions & 0 deletions pos_financial_risk/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import pos_config
from . import pos_payment_method
from . import pos_session
from . import res_config_settings
13 changes: 13 additions & 0 deletions pos_financial_risk/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from odoo import fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

payment_credit_limit_restricted_ids = fields.Many2many(
comodel_name="pos.payment.method",
relation="pos_config_payment_method_restricted_rel",
column1="config_id",
column2="payment_method_id",
string="Credit Limit Restricted",
)
7 changes: 7 additions & 0 deletions pos_financial_risk/models/pos_payment_method.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class PosPaymentMethod(models.Model):
_inherit = "pos.payment.method"

credit_limit_restricted = fields.Boolean()
10 changes: 10 additions & 0 deletions pos_financial_risk/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def _loader_params_pos_payment_method(self):
params = super(PosSession, self)._loader_params_pos_payment_method()
params["search_params"]["fields"].append("credit_limit_restricted")
return params
10 changes: 10 additions & 0 deletions pos_financial_risk/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

pos_payment_credit_limit_restricted_ids = fields.Many2many(
related="pos_config_id.payment_credit_limit_restricted_ids",
readonly=False,
)
13 changes: 13 additions & 0 deletions pos_financial_risk/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
To restrict a payment method for all POS:

Go to **Post of Sale**/**Configuration**/**Payment Methods** and select a payment method.

Enable **Credit Limit Restricted** to restrict usage of this payment method if credit limit threshold is overrun.



To specify restriction for a selected POS:

Go to **Settings**/**Point of Sale** select a POS and scroll down to the **Payment** section.

Add payment methods to the **Credit Limit Restricted** field.
2 changes: 2 additions & 0 deletions pos_financial_risk/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Cetmix <https://cetmix.com/>
* Maksim Shurupov
7 changes: 7 additions & 0 deletions pos_financial_risk/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extends Partner Financial Risk to manage POS orders.

If POS order exceeds partner credit limit POS only non restricted payment methods will remain available.

Payment method availability can be specified both system wide and for a particular POS.

If no restrictions are specified for a POS global ones will be applied.
7 changes: 7 additions & 0 deletions pos_financial_risk/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To use this module, you need to:

Go to Customers > Financial Risk

Set limits and choose options to compute in credit limit.

Go to POS -> Open POS and create a new order.
Loading

0 comments on commit 5a94f69

Please sign in to comment.