Skip to content

Commit

Permalink
Merge PR #1024 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 28, 2023
2 parents 30df8e5 + 88e4a95 commit 71488e4
Show file tree
Hide file tree
Showing 17 changed files with 831 additions and 0 deletions.
83 changes: 83 additions & 0 deletions pos_order_to_sale_order_sale_financial_risk/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
==========================
Sale Financial Risk in POS
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:39ff0f3d524db12a936d64030ab41c029b0f118112ea6c365464ceee95e247c8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_order_to_sale_order_sale_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_order_to_sale_order_sale_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|

This module is a bridging module between **sale_financial_risk** and **pos_order_to_sale_order**. It implements control for the Sale Orders created from POS.
Same warning or blocking message will be displayed in POS as if an order was created from the backend.

**Table of contents**

.. contents::
:local:

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_order_to_sale_order_sale_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

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_order_to_sale_order_sale_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_order_to_sale_order_sale_financial_risk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions pos_order_to_sale_order_sale_financial_risk/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Sale Financial Risk in POS",
"version": "16.0.1.0.0",
"category": "Sales/Point of Sale",
"summary": "Sale Financial Risk control for Sales Orders created from POS",
"depends": ["sale_financial_risk", "pos_order_to_sale_order_delivery"],
"website": "https://github.com/OCA/pos",
"author": "Cetmix,Odoo Community Association (OCA)",
"maintainers": ["geomer198", "CetmixGitDrone"],
"data": ["data/demo.xml"],
"installable": True,
"assets": {
"point_of_sale.assets": [
"pos_order_to_sale_order_sale_financial_risk/static/src/js/*.esm.js",
],
"web.assets_tests": [
"pos_order_to_sale_order_sale_financial_risk/static/src/tests/tours/SaleFinancialRiskPosCompatibility.tour.esm.js", # noqa
],
},
"license": "AGPL-3",
}
10 changes: 10 additions & 0 deletions pos_order_to_sale_order_sale_financial_risk/data/demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

<record id="test_partner" model="res.partner">
<field name="name">Test Partner</field>
<field name="risk_sale_order_limit">1.0</field>
<field name="credit_limit">1.0</field>
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import pos_session
from . import sale_order
17 changes: 17 additions & 0 deletions pos_order_to_sale_order_sale_financial_risk/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (C) 2023 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


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

def _get_pos_ui_res_users(self, params):
data = super()._get_pos_ui_res_users(params)
# Adding key that checks user has group 'risk exception'
user = self.env["res.users"].browse(data["id"])
data["has_role_risk_manager"] = user.has_group(
"account_financial_risk.group_overpass_partner_risk_exception",
)
return data
16 changes: 16 additions & 0 deletions pos_order_to_sale_order_sale_financial_risk/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2023 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class SaleOrder(models.Model):
_inherit = "sale.order"

@api.model
def create_order_from_pos(self, order_data, action):
if "bypass_risk" in order_data:
# Adding does not exist field in context for checking value on UI
bypass_risk = order_data.pop("bypass_risk")
self = self.with_context(bypass_risk=bypass_risk)
return super(SaleOrder, self).create_order_from_pos(order_data, action)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module is a bridging module between **sale_financial_risk** and **pos_order_to_sale_order**. It implements control for the Sale Orders created from POS.
Same warning or blocking message will be displayed in POS as if an order was created from the backend.
Loading

0 comments on commit 71488e4

Please sign in to comment.