Skip to content

Commit 42e6dd7

Browse files
committed
[ADD] l10n_es_facturae_literal_legal: New module l10n_es_facturae_literal_legal
1 parent 05f2dd4 commit 42e6dd7

File tree

15 files changed

+739
-0
lines changed

15 files changed

+739
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
==============================
2+
Facturae - Literal Legal Texts
3+
==============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:d7ff761dfc822c98b06537694940e56052695d946ef74a1c33996c46940c91af
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github
20+
:target: https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_facturae_literal_legal
21+
:alt: OCA/l10n-spain
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_facturae_literal_legal
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Agrega los Literales Legales para ser usados en Facturae.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Bug Tracker
39+
===========
40+
41+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-spain/issues>`_.
42+
In case of trouble, please check there if your issue has already been reported.
43+
If you spotted it first, help us to smash it by providing a detailed and welcomed
44+
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_facturae_literal_legal%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
45+
46+
Do not contact contributors directly about support or help with technical issues.
47+
48+
Credits
49+
=======
50+
51+
Authors
52+
-------
53+
54+
* APSL - Nagarro
55+
56+
Contributors
57+
------------
58+
59+
- `APSL-Nagarro <https://apsl.tech>`__:
60+
61+
- Bernat Obrador <[email protected]>
62+
63+
Maintainers
64+
-----------
65+
66+
This module is maintained by the OCA.
67+
68+
.. image:: https://odoo-community.org/logo.png
69+
:alt: Odoo Community Association
70+
:target: https://odoo-community.org
71+
72+
OCA, or the Odoo Community Association, is a nonprofit organization whose
73+
mission is to support the collaborative development of Odoo features and
74+
promote its widespread use.
75+
76+
.. |maintainer-BernatObrador| image:: https://github.com/BernatObrador.png?size=40px
77+
:target: https://github.com/BernatObrador
78+
:alt: BernatObrador
79+
80+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
81+
82+
|maintainer-BernatObrador|
83+
84+
This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_facturae_literal_legal>`_ project on GitHub.
85+
86+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2025 (APSL - Nagarro) Bernat Obrador
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from . import models
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2025 (APSL - Nagarro) Bernat Obrador
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Facturae - Literal Legal Texts",
5+
"version": "17.0.1.0.0",
6+
"author": "APSL - Nagarro, " "Odoo Community Association (OCA)",
7+
"category": "Accounting & Finance",
8+
"website": "https://github.com/OCA/l10n-spain",
9+
"license": "AGPL-3",
10+
"depends": ["l10n_es_facturae"],
11+
"data": [
12+
"security/ir.model.access.csv",
13+
"views/report_facturae.xml",
14+
"views/account_move_view.xml",
15+
],
16+
"installable": True,
17+
"maintainers": ["BernatObrador"],
18+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2025 (APSL - Nagarro) Bernat Obrador
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from . import account_move
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright 2025 (APSL - Nagarro) Bernat Obrador
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from odoo import _, api, fields, models
4+
from odoo.exceptions import ValidationError
5+
6+
7+
class AccountMove(models.Model):
8+
_inherit = "account.move"
9+
10+
literal_legal_ids = fields.One2many(
11+
"l10n.es.facturae.literal.legal",
12+
"move_id",
13+
string="Literal Legal",
14+
copy=True,
15+
)
16+
17+
18+
class LiteralLegal(models.Model):
19+
_name = "l10n.es.facturae.literal.legal"
20+
_description = "Facturae Literal Legal"
21+
22+
description = fields.Text(required=True)
23+
description_length = fields.Integer(
24+
compute="_compute_description_length",
25+
store=True,
26+
)
27+
move_id = fields.Many2one(comodel_name="account.move", string="Move", readonly=True)
28+
sequence = fields.Integer()
29+
30+
@api.depends("description")
31+
def _compute_description_length(self):
32+
for record in self:
33+
record.description_length = len(record.description or "")
34+
35+
@api.model_create_multi
36+
def create(self, vals_list):
37+
new_records = self.env[self._name]
38+
for vals in vals_list:
39+
description = vals.get("description", "")
40+
move_id = vals.get("move_id")
41+
# Divide the description into chunks of 250 characters
42+
# if it exceeds that length
43+
if description and len(description) > 250:
44+
chunks = [
45+
description[i : i + 250] for i in range(0, len(description), 250)
46+
]
47+
for chunk in chunks:
48+
new_records |= super().create(
49+
{
50+
"description": chunk,
51+
"move_id": move_id,
52+
}
53+
)
54+
else:
55+
new_records |= super().create(vals)
56+
57+
return new_records
58+
59+
def write(self, vals):
60+
res = super().write(vals)
61+
for record in self:
62+
if record.description and len(record.description) > 250:
63+
raise ValidationError(
64+
_("Literal legal description cannot be longer than 250 characters")
65+
)
66+
return res
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [APSL-Nagarro](<https://apsl.tech>):
2+
- Bernat Obrador \<<[email protected]>\>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Agrega los Literales Legales para ser usados en Facturae.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
access_l10n_es_facturae_literal_legal_manager,l10n_es_facturae_literal_legal_manager,model_l10n_es_facturae_literal_legal,account.group_account_invoice,1,1,1,1
3+
access_l10n_es_facturae_literal_legal_user,l10n_es_facturae_literal_legal_user,model_l10n_es_facturae_literal_legal,base.group_user,1,0,0,0
9.23 KB
Loading

0 commit comments

Comments
 (0)