Skip to content

Commit

Permalink
Merge PR #592 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Feb 27, 2023
2 parents 448d390 + f220a42 commit 640bde8
Show file tree
Hide file tree
Showing 16 changed files with 677 additions and 0 deletions.
91 changes: 91 additions & 0 deletions sale_payment_term_security/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
==========================
Sale Payment Term Security
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Faccount--payment-lightgray.png?logo=github
:target: https://github.com/OCA/account-payment/tree/13.0/sale_payment_term_security
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-payment-13-0/account-payment-13-0-sale_payment_term_security
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/96/13.0
:alt: Try me on Runbot

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

In sale orders, payment terms can only be managed when the user has permission "Enable to manage payment terms".

**Table of contents**

.. contents::
:local:

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

To use this module, you need to:

Go to Settings > Users & Companies > Users (edit your user) > Set "Enable to manage payment terms" option.

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

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

* Pedro M. Baeza
* Víctor Martínez

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-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

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

|maintainer-victoralmau|

This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/13.0/sale_payment_term_security>`_ 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 sale_payment_term_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions sale_payment_term_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Sale Payment Term Security",
"version": "15.0.1.0.0",
"category": "Accounting & Finance",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainer": "OCA",
"website": "https://github.com/OCA/account-payment",
"license": "AGPL-3",
"depends": ["account_payment_term_security", "sale"],
"installable": True,
"maintainers": ["victoralmau"],
}
22 changes: 22 additions & 0 deletions sale_payment_term_security/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_payment_term_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-27 07:49+0000\n"
"PO-Revision-Date: 2023-01-27 07:49+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_payment_term_security
#: model:ir.model,name:sale_payment_term_security.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venta"
19 changes: 19 additions & 0 deletions sale_payment_term_security/i18n/sale_payment_term_security.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_payment_term_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_payment_term_security
#: model:ir.model,name:sale_payment_term_security.model_sale_order
msgid "Sales Order"
msgstr ""
1 change: 1 addition & 0 deletions sale_payment_term_security/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
32 changes: 32 additions & 0 deletions sale_payment_term_security/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2023 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import json

from lxml import etree

from odoo import api, models


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

@api.model
def fields_view_get(
self, view_id=None, view_type="form", toolbar=False, submenu=False
):
res = super().fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
group = "account_payment_term_security.account_payment_term_mgmt"
if view_type == "form":
doc = etree.XML(res["arch"])
for node in doc.xpath("//field[@name='payment_term_id']"):
if not self.env.user.has_group(group):
node.set("readonly", "1")
node.set("force_save", "1")
modifiers = json.loads(node.get("modifiers"))
modifiers["readonly"] = True
modifiers["force_save"] = 1
node.set("modifiers", json.dumps(modifiers))
res["arch"] = etree.tostring(doc, encoding="unicode")
return res
3 changes: 3 additions & 0 deletions sale_payment_term_security/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To use this module, you need to:

Go to Settings > Users & Companies > Users (edit your user) > Set "Enable to manage payment terms" option.
4 changes: 4 additions & 0 deletions sale_payment_term_security/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`:

* Pedro M. Baeza
* Víctor Martínez
1 change: 1 addition & 0 deletions sale_payment_term_security/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In sale orders, payment terms can only be managed when the user has permission "Enable to manage payment terms".
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 640bde8

Please sign in to comment.