-
-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
17 changed files
with
759 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
===================== | ||
Payment Term Security | ||
===================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:f4300bd16646870003a5be64e2e4484acee9b46b4e2e2b9d442ad43a06a7f801 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/17.0/account_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-17-0/account-payment-17-0-account_payment_term_security | ||
: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/account-payment&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
In partners and invoices, payment terms can only be changed when the | ||
user has permission "Change payment terms in partners and invoices". | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
To use this module, you need to : | ||
|
||
Go to Settings > Users & Companies > Users (edit your user) > Set | ||
"Change payment terms in partners and invoices" 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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20account_payment_term_security%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>\`: | ||
|
||
- 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/17.0/account_payment_term_security>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2023 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Payment Term Security", | ||
"version": "17.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"], | ||
"data": ["security/security.xml"], | ||
"installable": True, | ||
"maintainers": ["victoralmau"], | ||
} |
29 changes: 29 additions & 0 deletions
29
account_payment_term_security/i18n/account_payment_term_security.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_payment_term_security | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.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: account_payment_term_security | ||
#: model:res.groups,name:account_payment_term_security.account_payment_term_mgmt | ||
msgid "Change payment terms in partners and invoices" | ||
msgstr "" | ||
|
||
#. module: account_payment_term_security | ||
#: model:ir.model,name:account_payment_term_security.model_res_partner | ||
msgid "Contact" | ||
msgstr "" | ||
|
||
#. module: account_payment_term_security | ||
#: model:ir.model,name:account_payment_term_security.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_payment_term_security | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: \n" | ||
"PO-Revision-Date: 2023-09-21 16:38+0000\n" | ||
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n" | ||
"Language-Team: \n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: account_payment_term_security | ||
#: model:res.groups,name:account_payment_term_security.account_payment_term_mgmt | ||
msgid "Change payment terms in partners and invoices" | ||
msgstr "Cambiar plazos de pago en contactos y facturas" | ||
|
||
#. module: account_payment_term_security | ||
#: model:ir.model,name:account_payment_term_security.model_res_partner | ||
msgid "Contact" | ||
msgstr "Contacto" | ||
|
||
#. module: account_payment_term_security | ||
#: model:ir.model,name:account_payment_term_security.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "Entrada Diaria" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import account_move | ||
from . import res_partner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2023-2025 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from lxml import etree | ||
|
||
from odoo import api, models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
@api.model | ||
def get_view(self, view_id=None, view_type="form", **options): | ||
result = super().get_view(view_id=view_id, view_type=view_type, **options) | ||
group = "account_payment_term_security.account_payment_term_mgmt" | ||
if view_type == "form" and not self.env.user.has_group(group): | ||
doc = etree.XML(result["arch"]) | ||
for node in doc.xpath("//field[@name='invoice_payment_term_id']"): | ||
node.set("readonly", "1") | ||
node.set("force_save", "1") | ||
result["arch"] = etree.tostring(doc, encoding="unicode") | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2023.2025 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from lxml import etree | ||
|
||
from odoo import api, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
@api.model | ||
def get_view(self, view_id=None, view_type="form", **options): | ||
result = super().get_view(view_id=view_id, view_type=view_type, **options) | ||
group = "account_payment_term_security.account_payment_term_mgmt" | ||
if view_type == "form" and not self.env.user.has_group(group): | ||
doc = etree.XML(result["arch"]) | ||
for node in doc.xpath("//field[@name='property_payment_term_id']"): | ||
node.set("readonly", "1") | ||
node.set("force_save", "1") | ||
for node in doc.xpath("//field[@name='property_supplier_payment_term_id']"): | ||
node.set("readonly", "1") | ||
node.set("force_save", "1") | ||
result["arch"] = etree.tostring(doc, encoding="unicode") | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
To use this module, you need to : | ||
|
||
Go to Settings \> Users & Companies \> Users (edit your user) \> Set | ||
"Change payment terms in partners and invoices" option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- \`Tecnativa \<<https://www.tecnativa.com>\>\`: | ||
- Pedro M. Baeza | ||
- Víctor Martínez |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
In partners and invoices, payment terms can only be changed when the | ||
user has permission "Change payment terms in partners and invoices". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="account_payment_term_mgmt" model="res.groups"> | ||
<field name="name">Change payment terms in partners and invoices</field> | ||
<field name="category_id" ref="base.module_category_hidden" /> | ||
<field name="implied_ids" eval="[(4, ref('account.group_account_invoice'))]" /> | ||
<field | ||
name="users" | ||
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]" | ||
/> | ||
</record> | ||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.