Skip to content

Commit d8182c0

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

File tree

15 files changed

+738
-0
lines changed

15 files changed

+738
-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: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
)
15+
16+
17+
class LiteralLegal(models.Model):
18+
_name = "l10n.es.facturae.literal.legal"
19+
_description = "Facturae Literal Legal"
20+
21+
description = fields.Text(required=True)
22+
description_length = fields.Integer(
23+
compute="_compute_description_length",
24+
store=True,
25+
)
26+
move_id = fields.Many2one(comodel_name="account.move", string="Move", readonly=True)
27+
sequence = fields.Integer()
28+
29+
@api.depends("description")
30+
def _compute_description_length(self):
31+
for record in self:
32+
record.description_length = len(record.description or "")
33+
34+
@api.model_create_multi
35+
def create(self, vals_list):
36+
new_records = self.env[self._name]
37+
for vals in vals_list:
38+
description = vals.get("description", "")
39+
move_id = vals.get("move_id")
40+
# Divide the description into chunks of 250 characters
41+
# if it exceeds that length
42+
if description and len(description) > 250:
43+
chunks = [
44+
description[i : i + 250] for i in range(0, len(description), 250)
45+
]
46+
for chunk in chunks:
47+
new_records |= super().create(
48+
{
49+
"description": chunk,
50+
"move_id": move_id,
51+
}
52+
)
53+
else:
54+
new_records |= super().create(vals)
55+
56+
return new_records
57+
58+
def write(self, vals):
59+
res = super().write(vals)
60+
for record in self:
61+
if record.description and len(record.description) > 250:
62+
raise ValidationError(
63+
_("Literal legal description cannot be longer than 250 characters")
64+
)
65+
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)