Skip to content

Commit

Permalink
Merge PR #377 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jun 18, 2024
2 parents fc2e7f7 + 0c79ab7 commit 954f57c
Show file tree
Hide file tree
Showing 75 changed files with 8,947 additions and 0 deletions.
100 changes: 100 additions & 0 deletions sale_financial_risk/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
===================
Sale Financial Risk
===================

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

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

Extends Partner Financial Risk to manage sales orders.

Adds a new risk amount field in sale order line to compute risk based on
the difference between ordered quantity (or delivered in some cases) and
invoiced quantity.

If any limit is exceed the partner gets forbidden to confirm sale
orders.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

1. Go to *Customers > Financial Risk*
2. Set limits and choose options to compute in credit limit.
3. Go to *Sales -> Orders -> Orders* and create a new Sales Orders.

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

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

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Carlos Dauden
- Pedro M. Baeza
- Ernesto Tejeda
- Stefan Ungureanu

- Agathe Mollé <agathe.molle@savoirfairelinux.com>
- Ugne Sinkeviciene <ugne@versada.eu>

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/credit-control <https://github.com/OCA/credit-control/tree/17.0/sale_financial_risk>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions sale_financial_risk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .hooks import pre_init_hook
from . import models
20 changes: 20 additions & 0 deletions sale_financial_risk/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2016-2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Sale Financial Risk",
"summary": "Manage partner risk in sales orders",
"version": "17.0.1.0.0",
"category": "Sales Management",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/credit-control",
"depends": ["sale", "account_financial_risk"],
"data": [
"views/res_partner_view.xml",
"views/sale_financial_risk_view.xml",
"views/res_config_settings.xml",
],
"installable": True,
"pre_init_hook": "pre_init_hook",
}
32 changes: 32 additions & 0 deletions sale_financial_risk/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging

from odoo.tools import sql

logger = logging.getLogger(__name__)


def pre_init_hook(env):
"""
The objective of this hook is to speed up the installation
of the module on an existing Odoo instance.
"""
create_risk_partner_id_column(env)


def create_risk_partner_id_column(env):
if not sql.column_exists(env.cr, "sale_order_line", "risk_partner_id"):
sql.create_column(env.cr, "sale_order_line", "risk_partner_id", "int4")
logger.info("Computing field risk_partner_id on sale.order.line")
env.cr.execute(
"""
UPDATE sale_order_line sol
SET risk_partner_id = p.commercial_partner_id
FROM sale_order so LEFT JOIN
res_partner p ON p.id = so.partner_invoice_id
WHERE so.id = sol.order_id and
sol.risk_partner_id IS DISTINCT FROM p.commercial_partner_id;
"""
)
140 changes: 140 additions & 0 deletions sale_financial_risk/i18n/am.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_financial_risk
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-02 00:47+0000\n"
"PO-Revision-Date: 2017-06-02 00:47+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Amharic (https://www.transifex.com/oca/teams/23907/am/)\n"
"Language: am\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_sale_order_line__risk_partner_id
msgid "Commercial Entity"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_sale_order_line__company_currency_id
msgid "Company Currency"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model,name:sale_financial_risk.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model,name:sale_financial_risk.model_res_partner
msgid "Contact"
msgstr ""

#. module: sale_financial_risk
#. odoo-python
#: code:addons/sale_financial_risk/models/sale.py:0
#, python-format
msgid "Financial risk exceeded.\n"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,help:sale_financial_risk.field_res_partner__risk_sale_order_include
#: model:ir.model.fields,help:sale_financial_risk.field_res_users__risk_sale_order_include
msgid "Full risk computation"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_res_partner__risk_sale_order_include
#: model:ir.model.fields,field_description:sale_financial_risk.field_res_users__risk_sale_order_include
msgid "Include Sales Orders"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_res_config_settings__include_risk_sale_order_done
#: model_terms:ir.ui.view,arch_db:sale_financial_risk.res_config_settings_view_form
msgid "Include locked sale orders into risk calculation"
msgstr ""

#. module: sale_financial_risk
#: model_terms:ir.ui.view,arch_db:sale_financial_risk.res_config_settings_view_form
msgid "Include orders in done state"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_sale_order__partner_invoice_id
msgid "Invoice Address"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_res_partner__risk_sale_order_limit
#: model:ir.model.fields,field_description:sale_financial_risk.field_res_users__risk_sale_order_limit
msgid "Limit Sales Orders"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model,name:sale_financial_risk.model_payment_transaction
msgid "Payment Transaction"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_sale_order_line__risk_amount
msgid "Risk Amount"
msgstr ""

#. module: sale_financial_risk
#: model_terms:ir.ui.view,arch_db:sale_financial_risk.financial_risk_sale_order_line_pivot_view
msgid "Sale lines"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model,name:sale_financial_risk.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model,name:sale_financial_risk.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,help:sale_financial_risk.field_res_partner__risk_sale_order_limit
#: model:ir.model.fields,help:sale_financial_risk.field_res_users__risk_sale_order_limit
msgid "Set 0 if it is not locked"
msgstr ""

#. module: sale_financial_risk
#. odoo-python
#: code:addons/sale_financial_risk/models/sale.py:0
#, python-format
msgid "This sale order exceeds the financial risk.\n"
msgstr ""

#. module: sale_financial_risk
#. odoo-python
#: code:addons/sale_financial_risk/models/sale.py:0
#, python-format
msgid "This sale order exceeds the sales orders risk.\n"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,field_description:sale_financial_risk.field_res_partner__risk_sale_order
#: model:ir.model.fields,field_description:sale_financial_risk.field_res_users__risk_sale_order
msgid "Total Sales Orders Not Invoiced"
msgstr ""

#. module: sale_financial_risk
#: model:ir.model.fields,help:sale_financial_risk.field_res_partner__risk_sale_order
#: model:ir.model.fields,help:sale_financial_risk.field_res_users__risk_sale_order
msgid "Total not invoiced of sales orders in Sale Order state"
msgstr ""

#~ msgid "Partner"
#~ msgstr "ተባባሪ"
Loading

0 comments on commit 954f57c

Please sign in to comment.