odoo-addon-l10n-es-verifactu-oca 15.0.1.0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of odoo-addon-l10n-es-verifactu-oca might be problematic. Click here for more details.

Files changed (74) hide show
  1. odoo/addons/l10n_es_verifactu_oca/README.rst +154 -0
  2. odoo/addons/l10n_es_verifactu_oca/__init__.py +3 -0
  3. odoo/addons/l10n_es_verifactu_oca/__manifest__.py +48 -0
  4. odoo/addons/l10n_es_verifactu_oca/data/account_fiscal_position_template_data.xml +129 -0
  5. odoo/addons/l10n_es_verifactu_oca/data/ir_config_parameter.xml +9 -0
  6. odoo/addons/l10n_es_verifactu_oca/data/ir_cron.xml +14 -0
  7. odoo/addons/l10n_es_verifactu_oca/data/mail_activity_data.xml +11 -0
  8. odoo/addons/l10n_es_verifactu_oca/data/verifactu_map_data.xml +120 -0
  9. odoo/addons/l10n_es_verifactu_oca/data/verifactu_registration_key_data.xml +207 -0
  10. odoo/addons/l10n_es_verifactu_oca/data/verifactu_tax_agency_data.xml +19 -0
  11. odoo/addons/l10n_es_verifactu_oca/hooks.py +43 -0
  12. odoo/addons/l10n_es_verifactu_oca/i18n/ca.po +1630 -0
  13. odoo/addons/l10n_es_verifactu_oca/i18n/ca_ES.po +1599 -0
  14. odoo/addons/l10n_es_verifactu_oca/i18n/es.po +1640 -0
  15. odoo/addons/l10n_es_verifactu_oca/i18n/l10n_es_verifactu_oca.pot +1673 -0
  16. odoo/addons/l10n_es_verifactu_oca/models/__init__.py +16 -0
  17. odoo/addons/l10n_es_verifactu_oca/models/account_fiscal_position.py +40 -0
  18. odoo/addons/l10n_es_verifactu_oca/models/account_fiscal_position_template.py +18 -0
  19. odoo/addons/l10n_es_verifactu_oca/models/account_journal.py +64 -0
  20. odoo/addons/l10n_es_verifactu_oca/models/account_move.py +556 -0
  21. odoo/addons/l10n_es_verifactu_oca/models/aeat_mixin.py +163 -0
  22. odoo/addons/l10n_es_verifactu_oca/models/aeat_tax_agency.py +30 -0
  23. odoo/addons/l10n_es_verifactu_oca/models/res_company.py +48 -0
  24. odoo/addons/l10n_es_verifactu_oca/models/res_partner.py +33 -0
  25. odoo/addons/l10n_es_verifactu_oca/models/verifactu_chaining.py +30 -0
  26. odoo/addons/l10n_es_verifactu_oca/models/verifactu_developer.py +16 -0
  27. odoo/addons/l10n_es_verifactu_oca/models/verifactu_invoice_entry.py +401 -0
  28. odoo/addons/l10n_es_verifactu_oca/models/verifactu_invoice_entry_response.py +121 -0
  29. odoo/addons/l10n_es_verifactu_oca/models/verifactu_invoice_entry_response_line.py +35 -0
  30. odoo/addons/l10n_es_verifactu_oca/models/verifactu_map.py +66 -0
  31. odoo/addons/l10n_es_verifactu_oca/models/verifactu_mixin.py +449 -0
  32. odoo/addons/l10n_es_verifactu_oca/models/verifactu_registration_key.py +24 -0
  33. odoo/addons/l10n_es_verifactu_oca/readme/CONFIGURE.rst +18 -0
  34. odoo/addons/l10n_es_verifactu_oca/readme/CONTRIBUTORS.rst +19 -0
  35. odoo/addons/l10n_es_verifactu_oca/readme/DESCRIPTION.rst +1 -0
  36. odoo/addons/l10n_es_verifactu_oca/readme/INSTALL.rst +4 -0
  37. odoo/addons/l10n_es_verifactu_oca/readme/ROADMAP.rst +15 -0
  38. odoo/addons/l10n_es_verifactu_oca/readme/USAGE.rst +1 -0
  39. odoo/addons/l10n_es_verifactu_oca/security/ir.model.access.csv +22 -0
  40. odoo/addons/l10n_es_verifactu_oca/security/verifactu_security.xml +6 -0
  41. odoo/addons/l10n_es_verifactu_oca/static/description/icon.png +0 -0
  42. odoo/addons/l10n_es_verifactu_oca/static/description/index.html +508 -0
  43. odoo/addons/l10n_es_verifactu_oca/tests/__init__.py +5 -0
  44. odoo/addons/l10n_es_verifactu_oca/tests/common.py +304 -0
  45. odoo/addons/l10n_es_verifactu_oca/tests/json/verifactu_mocked_response_1.json +35 -0
  46. odoo/addons/l10n_es_verifactu_oca/tests/json/verifactu_mocked_response_2.json +35 -0
  47. odoo/addons/l10n_es_verifactu_oca/tests/json/verifactu_out_invoice_s_iva10b_s_iva21s_dict.json +59 -0
  48. odoo/addons/l10n_es_verifactu_oca/tests/json/verifactu_out_invoice_s_iva21s_s_req52_dict.json +58 -0
  49. odoo/addons/l10n_es_verifactu_oca/tests/json/verifactu_out_refund_s_iva10b_s_iva10b_s_iva21s_dict.json +66 -0
  50. odoo/addons/l10n_es_verifactu_oca/tests/test_10n_es_verifactu.py +451 -0
  51. odoo/addons/l10n_es_verifactu_oca/tests/test_account_journal.py +78 -0
  52. odoo/addons/l10n_es_verifactu_oca/tests/test_account_move_reversal.py +93 -0
  53. odoo/addons/l10n_es_verifactu_oca/tests/test_res_partner.py +48 -0
  54. odoo/addons/l10n_es_verifactu_oca/tests/test_verifactu_invoice.py +350 -0
  55. odoo/addons/l10n_es_verifactu_oca/views/account_fiscal_position_view.xml +30 -0
  56. odoo/addons/l10n_es_verifactu_oca/views/account_journal_view.xml +28 -0
  57. odoo/addons/l10n_es_verifactu_oca/views/account_move_view.xml +219 -0
  58. odoo/addons/l10n_es_verifactu_oca/views/aeat_tax_agency_view.xml +31 -0
  59. odoo/addons/l10n_es_verifactu_oca/views/report_invoice.xml +55 -0
  60. odoo/addons/l10n_es_verifactu_oca/views/res_company_view.xml +50 -0
  61. odoo/addons/l10n_es_verifactu_oca/views/res_partner_view.xml +27 -0
  62. odoo/addons/l10n_es_verifactu_oca/views/verifactu_chaining_view.xml +47 -0
  63. odoo/addons/l10n_es_verifactu_oca/views/verifactu_developer_view.xml +48 -0
  64. odoo/addons/l10n_es_verifactu_oca/views/verifactu_invoice_entry_response_view.xml +149 -0
  65. odoo/addons/l10n_es_verifactu_oca/views/verifactu_invoice_entry_view.xml +124 -0
  66. odoo/addons/l10n_es_verifactu_oca/views/verifactu_map_lines_view.xml +20 -0
  67. odoo/addons/l10n_es_verifactu_oca/views/verifactu_map_view.xml +53 -0
  68. odoo/addons/l10n_es_verifactu_oca/views/verifactu_registration_keys_view.xml +42 -0
  69. odoo/addons/l10n_es_verifactu_oca/wizards/__init__.py +1 -0
  70. odoo/addons/l10n_es_verifactu_oca/wizards/account_move_reversal.py +16 -0
  71. odoo_addon_l10n_es_verifactu_oca-15.0.1.0.0.2.dist-info/METADATA +171 -0
  72. odoo_addon_l10n_es_verifactu_oca-15.0.1.0.0.2.dist-info/RECORD +74 -0
  73. odoo_addon_l10n_es_verifactu_oca-15.0.1.0.0.2.dist-info/WHEEL +5 -0
  74. odoo_addon_l10n_es_verifactu_oca-15.0.1.0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,350 @@
1
+ # Copyright 2024 Aures TIC - Almudena de La Puente <almudena@aurestic.es>
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
3
+
4
+ from datetime import date, timedelta
5
+
6
+ from .common import TestVerifactuCommon
7
+
8
+
9
+ class TestVerifactuInvoice(TestVerifactuCommon):
10
+ """Test class for VeriFactu Invoice functionality."""
11
+
12
+ def _generate_invoice_entry(self, invoice):
13
+ """
14
+ Helper method to generate VERI*FACTU invoice entry for an invoice.
15
+ This assumes the invoice is already prepared for VERI*FACTU.
16
+
17
+ Args:
18
+ invoice: Prepared invoice
19
+
20
+ Returns:
21
+ verifactu.invoice: Created invoice entry
22
+ """
23
+ invoice._generate_verifactu_chaining()
24
+ return invoice.last_verifactu_invoice_entry_id
25
+
26
+ def _create_invoice_sequence(
27
+ self, count=3, start_date="2024-01-01", company=None, amounts=None
28
+ ):
29
+ """
30
+ Helper method to create a sequence of invoices for invoice entry testing.
31
+
32
+ Args:
33
+ count: Number of invoices to create
34
+ start_date: Starting date (format: "YYYY-MM-DD")
35
+ company: Company for invoices (defaults to self.company)
36
+ amounts: List of amounts for each invoice (defaults to 100, 110, 120, ...)
37
+
38
+ Returns:
39
+ list: List of created and prepared invoices
40
+ """
41
+ if amounts is None:
42
+ amounts = [100 + i * 10 for i in range(count)]
43
+ invoices = []
44
+ for i in range(count):
45
+ # Calculate date by adding days to start_date
46
+ year, month, day = map(int, start_date.split("-"))
47
+ invoice_date = (date(year, month, day) + timedelta(days=i)).strftime(
48
+ "%Y-%m-%d"
49
+ )
50
+ invoice = self._create_and_prepare_invoice(
51
+ company=company,
52
+ date=invoice_date,
53
+ amount=amounts[i] if i < len(amounts) else amounts[-1],
54
+ name=f"Chain test line {i + 1}",
55
+ )
56
+ invoices.append(invoice)
57
+
58
+ return invoices
59
+
60
+ def _verify_chain_integrity(self, chain_entries):
61
+ """
62
+ Helper method to verify the integrity of a chain sequence.
63
+
64
+ Args:
65
+ chain_entries: List of chain entries to verify
66
+ """
67
+ for i, entry in enumerate(chain_entries):
68
+ if i == 0:
69
+ self.assertFalse(
70
+ entry.previous_invoice_entry_id,
71
+ "First entry should have no previous",
72
+ )
73
+ else:
74
+ self.assertEqual(
75
+ entry.previous_invoice_entry_id,
76
+ chain_entries[i - 1],
77
+ f"Entry {i} should link to entry {i - 1}",
78
+ )
79
+
80
+ def _clean_chain_entries(self, company=None):
81
+ """
82
+ Helper method to clean all chain entries for a company.
83
+ Useful for test isolation.
84
+
85
+ Args:
86
+ company: Company to clean entries for (defaults to self.company)
87
+ """
88
+ if company is None:
89
+ company = self.company
90
+
91
+ self.env["verifactu.invoice.entry"].search(
92
+ [("company_id", "=", company.id)]
93
+ ).unlink()
94
+
95
+ def _assert_chain_entry_properties(
96
+ self,
97
+ chain_entry,
98
+ expected_previous=None,
99
+ expected_document=None,
100
+ expected_company=None,
101
+ ):
102
+ """
103
+ Helper method to assert chain entry properties.
104
+
105
+ Args:
106
+ chain_entry: Chain entry to verify
107
+ expected_previous: Expected previous chain entry (None for first entry)
108
+ expected_document: Expected document reference
109
+ expected_company: Expected company (defaults to self.company)
110
+ """
111
+ if expected_company is None:
112
+ expected_company = self.company
113
+ if expected_previous is None:
114
+ self.assertFalse(
115
+ chain_entry.previous_invoice_entry_id,
116
+ "Chain entry should have no previous entry",
117
+ )
118
+ else:
119
+ self.assertEqual(
120
+ chain_entry.previous_invoice_entry_id,
121
+ expected_previous,
122
+ "Chain entry should link to expected previous entry",
123
+ )
124
+ if expected_document:
125
+ self.assertEqual(
126
+ chain_entry.document,
127
+ expected_document,
128
+ "Chain entry should reference expected document",
129
+ )
130
+ self.assertEqual(
131
+ chain_entry.company_id,
132
+ expected_company,
133
+ "Chain entry should belong to expected company",
134
+ )
135
+
136
+ def test_verifactu_chain_first_invoice(self):
137
+ """Test that the first invoice creates a chain entry."""
138
+ self._activate_certificate(self.certificate_password)
139
+
140
+ self._clean_chain_entries()
141
+
142
+ invoice = self._create_and_prepare_invoice()
143
+ chain_entry = self._generate_invoice_entry(invoice)
144
+
145
+ self.assertTrue(chain_entry, "Chain entry should be created")
146
+
147
+ self._assert_chain_entry_properties(
148
+ chain_entry, expected_previous=None, expected_document=invoice
149
+ )
150
+
151
+ self.assertEqual(
152
+ chain_entry.document_hash,
153
+ invoice.verifactu_hash,
154
+ "Hash should match invoice hash",
155
+ )
156
+
157
+ def test_verifactu_chain_second_invoice(self):
158
+ """Test that the second invoice creates a chain entry and links to previous."""
159
+ self._activate_certificate(self.certificate_password)
160
+
161
+ invoices = self._create_invoice_sequence(count=2, amounts=[100, 150])
162
+
163
+ first_chain_entry = self._generate_invoice_entry(invoices[0])
164
+ second_chain_entry = self._generate_invoice_entry(invoices[1])
165
+
166
+ self._assert_chain_entry_properties(
167
+ second_chain_entry,
168
+ expected_previous=first_chain_entry,
169
+ expected_document=invoices[1],
170
+ )
171
+
172
+ self.assertEqual(
173
+ second_chain_entry.previous_invoice_entry_id.document,
174
+ invoices[0],
175
+ "Previous document should be computed",
176
+ )
177
+
178
+ def test_verifactu_chain_multiple_companies_isolation(self):
179
+ """Test that chains are isolated by company."""
180
+ self._activate_certificate(self.certificate_password)
181
+
182
+ second_company = self._create_test_company(
183
+ name="Test Company 2", vat="B29805314"
184
+ )
185
+ second_company.verifactu_chaining_id = self.env["verifactu.chaining"].create(
186
+ {
187
+ "name": "VERI*FACTU Chaining 2",
188
+ "sif_id": "12",
189
+ "installation_number": 2,
190
+ }
191
+ )
192
+ first_company_invoice = self._create_and_prepare_invoice()
193
+ first_company_entry = self._generate_invoice_entry(first_company_invoice)
194
+ second_company_invoice = self._create_and_prepare_invoice(
195
+ company=second_company, amount=200
196
+ )
197
+ second_company_entry = self._generate_invoice_entry(second_company_invoice)
198
+ self._assert_chain_entry_properties(first_company_entry, expected_previous=None)
199
+ self._assert_chain_entry_properties(
200
+ second_company_entry,
201
+ expected_previous=None,
202
+ expected_company=second_company,
203
+ )
204
+ # Clean up: disable VERI*FACTU on second company to avoid affecting other tests
205
+ second_company.verifactu_enabled = False
206
+
207
+ def test_verifactu_chain_hash_includes_previous(self):
208
+ """Test that hash calculation includes previous document hash."""
209
+ self._activate_certificate(self.certificate_password)
210
+
211
+ invoices = self._create_invoice_sequence(count=2)
212
+
213
+ self._generate_invoice_entry(invoices[0])
214
+ first_hash = invoices[0].verifactu_hash
215
+
216
+ self._generate_invoice_entry(invoices[1])
217
+
218
+ second_hash_string = invoices[1].verifactu_hash_string
219
+ self.assertIn(
220
+ first_hash,
221
+ second_hash_string,
222
+ "Second invoice hash should include first invoice hash",
223
+ )
224
+
225
+ def test_verifactu_chain_compute_document_name(self):
226
+ """Test the document name computation."""
227
+ self._activate_certificate(self.certificate_password)
228
+
229
+ invoice = self._create_and_prepare_invoice()
230
+ chain_entry = self._generate_invoice_entry(invoice)
231
+
232
+ self.assertEqual(chain_entry.document, invoice)
233
+
234
+ empty_entry = self.env["verifactu.invoice.entry"].create(
235
+ {
236
+ "document_id": invoice.id,
237
+ "model": invoice._name,
238
+ "company_id": self.company.id,
239
+ "verifactu_chaining_id": self.company.verifactu_chaining_id.id,
240
+ "document_hash": "test_hash",
241
+ }
242
+ )
243
+ self.assertTrue(
244
+ empty_entry,
245
+ "Chain entry should be created even with non-existent document reference",
246
+ )
247
+
248
+ def test_verifactu_chain_next_document_linking(self):
249
+ """Test that next document references are properly set."""
250
+ self._activate_certificate(self.certificate_password)
251
+
252
+ invoices = self._create_invoice_sequence(count=2, amounts=[100, 150])
253
+
254
+ entry_1 = self._generate_invoice_entry(invoices[0])
255
+ entry_2 = self._generate_invoice_entry(invoices[1])
256
+
257
+ self.assertEqual(
258
+ entry_1.document_id,
259
+ entry_2.previous_invoice_entry_id.document_id,
260
+ "First invoice should be the same as second entry in previous document",
261
+ )
262
+
263
+ def test_verifactu_chain_context_id_set(self):
264
+ """Test that chain_context_id is properly set for invoices."""
265
+ self._activate_certificate(self.certificate_password)
266
+
267
+ invoice = self._create_and_prepare_invoice()
268
+ chain_entry = self._generate_invoice_entry(invoice)
269
+
270
+ self.assertEqual(
271
+ chain_entry.company_id, self.company, "Should be linked to company"
272
+ )
273
+ # Company relationship is already verified above
274
+
275
+ def test_verifactu_company_chaining(self):
276
+ """Test that verifactu always uses company for chaining."""
277
+ self._activate_certificate(self.certificate_password)
278
+
279
+ invoice = self._create_and_prepare_invoice()
280
+
281
+ # Verify company has the required field for chaining
282
+ self.assertTrue(
283
+ hasattr(
284
+ self.company.verifactu_chaining_id, "last_verifactu_invoice_entry_id"
285
+ ),
286
+ "VERI*FACTU chaining should have last_verifactu_invoice_entry_id field",
287
+ )
288
+
289
+ # Verify invoice uses company for chaining
290
+ self.assertEqual(
291
+ invoice.company_id,
292
+ self.company,
293
+ "Invoice should use the correct company for chaining",
294
+ )
295
+
296
+ def test_company_last_chain_entry_updated(self):
297
+ """Test that company's last_verifactu_invoice_entry_id is updated."""
298
+ self._activate_certificate(self.certificate_password)
299
+
300
+ self.assertFalse(
301
+ self.company.verifactu_chaining_id.last_verifactu_invoice_entry_id,
302
+ "Company should initially have no last chain entry",
303
+ )
304
+
305
+ invoice1 = self._create_and_prepare_invoice(amount=100)
306
+ chain_entry1 = self._generate_invoice_entry(invoice1)
307
+
308
+ self.assertEqual(
309
+ self.company.verifactu_chaining_id.last_verifactu_invoice_entry_id,
310
+ chain_entry1,
311
+ "Company's last chain entry should be updated to first entry",
312
+ )
313
+
314
+ invoice2 = self._create_and_prepare_invoice(amount=200)
315
+ chain_entry2 = self._generate_invoice_entry(invoice2)
316
+
317
+ self.assertEqual(
318
+ self.company.verifactu_chaining_id.last_verifactu_invoice_entry_id,
319
+ chain_entry2,
320
+ "Company's last chain entry should be updated to second entry",
321
+ )
322
+
323
+ self.assertEqual(
324
+ chain_entry2.previous_invoice_entry_id,
325
+ chain_entry1,
326
+ "Second entry should reference first entry as previous",
327
+ )
328
+
329
+ def test_invoice_entry_creation(self):
330
+ """Test the VERI*FACTU invoice entry creation."""
331
+ invoice_model = self.env["verifactu.invoice.entry"]
332
+
333
+ # Test creating a simple invoice entry
334
+ test_entry = invoice_model.create(
335
+ {
336
+ "document_id": "999999",
337
+ "model": "account.move", # Use a high ID that likely doesn't exist
338
+ "document_name": "Test Invoice Entry",
339
+ "company_id": self.company.id,
340
+ "verifactu_chaining_id": self.company.verifactu_chaining_id.id,
341
+ "document_hash": "test_hash_simple",
342
+ "aeat_json_data": '{"test": "data"}',
343
+ }
344
+ )
345
+
346
+ self.assertEqual(
347
+ test_entry.company_id,
348
+ self.company,
349
+ "Should be able to create chain entry with company context",
350
+ )
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- Copyright 2024 Aures TIC - Jose Zambudio <jose@aurestic.es>
3
+ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
4
+ <odoo>
5
+ <record id="view_account_position_form" model="ir.ui.view">
6
+ <field name="name">account.fiscal.position.form</field>
7
+ <field name="model">account.fiscal.position</field>
8
+ <field name="inherit_id" ref="account.view_account_position_form" />
9
+ <field name="arch" type="xml">
10
+ <xpath expr="//page[@name='account_mapping']" position="after">
11
+ <page
12
+ name="verifactu"
13
+ string="VERI*FACTU"
14
+ attrs="{'invisible': [('verifactu_enabled', '=', False)]}"
15
+ >
16
+ <field name="verifactu_enabled" invisible="1" />
17
+ <group>
18
+ <field name="aeat_active" string="Active?" />
19
+ <field name="verifactu_tax_key" string="Tax key" />
20
+ <field
21
+ name="verifactu_registration_key"
22
+ string="Registration key"
23
+ domain="[('verifactu_tax_key', '=', verifactu_tax_key)]"
24
+ />
25
+ </group>
26
+ </page>
27
+ </xpath>
28
+ </field>
29
+ </record>
30
+ </odoo>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <odoo>
3
+ <record id="view_account_journal_form_inherit" model="ir.ui.view">
4
+ <field name="name">account.journal.form - l10n_es_verifactu</field>
5
+ <field name="model">account.journal</field>
6
+ <field name="inherit_id" ref="account.view_account_journal_form" />
7
+ <field name="arch" type="xml">
8
+ <xpath expr="//field[@name='restrict_mode_hash_table']" position="before">
9
+ <field name="restrict_mode_hash_table_readonly" invisible="1" />
10
+ </xpath>
11
+ <xpath
12
+ expr="//field[@name='restrict_mode_hash_table']"
13
+ position="attributes"
14
+ >
15
+ <attribute
16
+ name="attrs"
17
+ >{'readonly': [('restrict_mode_hash_table_readonly', '=', True)]}</attribute>
18
+ </xpath>
19
+ <xpath expr="//field[@name='restrict_mode_hash_table']" position="before">
20
+ <field name="company_verifactu_enabled" invisible="1" />
21
+ <field
22
+ name="verifactu_enabled"
23
+ attrs="{'invisible': ['|', ('company_verifactu_enabled', '=', False), ('type', '!=', 'sale')]}"
24
+ />
25
+ </xpath>
26
+ </field>
27
+ </record>
28
+ </odoo>
@@ -0,0 +1,219 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- Copyright 2024 Aures TIC - Jose Zambudio
3
+ Copyright 2024 Aures TIC - Almudena de La Puente
4
+ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
5
+ <odoo>
6
+ <record id="invoice_verifactu_form" model="ir.ui.view">
7
+ <field name="name">account.invoice.verifactu.form</field>
8
+ <field name="model">account.move</field>
9
+ <field name="inherit_id" ref="l10n_es_aeat.view_move_form" />
10
+ <field name="arch" type="xml">
11
+ <button name="button_draft" position="after">
12
+ <button
13
+ type="object"
14
+ string="Re-send to VERI*FACTU"
15
+ name="resend_verifactu"
16
+ groups="l10n_es_aeat.group_account_aeat"
17
+ attrs="{'invisible': ['|','|',('verifactu_enabled', '=', False), ('state', 'not in', ['posted']), ('aeat_state','!=','sent_w_errors')]}"
18
+ />
19
+ </button>
20
+ <notebook position="inside">
21
+ <field
22
+ name="verifactu_enabled"
23
+ invisible="1"
24
+ /> <!-- To be removed in v18 as not needed -->
25
+ <page
26
+ string="VERI*FACTU"
27
+ name="page_aeat"
28
+ attrs="{'invisible': [('verifactu_enabled', '=', False)]}"
29
+ >
30
+ <group>
31
+ <group
32
+ string="Configuration"
33
+ name="group_verifactu_configuration"
34
+ >
35
+ <field name="aeat_state" invisible="1" />
36
+ <field
37
+ name="verifactu_refund_type"
38
+ string="Refund type"
39
+ attrs="{'required': [('verifactu_enabled', '=', True),('move_type', '=', 'out_refund')], 'invisible': ['|', ('verifactu_enabled', '=', False), ('move_type', '!=', 'out_refund')]}"
40
+ />
41
+ <field
42
+ name="verifactu_refund_specific_type"
43
+ string="Refund specific type"
44
+ attrs="{'invisible': ['|', ('verifactu_enabled', '=', False), ('move_type', '!=', 'out_refund')]}"
45
+ />
46
+ <field
47
+ name="verifactu_tax_key"
48
+ string="Tax key"
49
+ attrs="{'required': [('verifactu_enabled', '=', True)], 'readonly': [('aeat_state', '=', 'sent')]}"
50
+ />
51
+ <field
52
+ name="verifactu_registration_key"
53
+ string="Registration key"
54
+ attrs="{'required': [('verifactu_enabled', '=', True)], 'readonly': [('aeat_state', '=', 'sent')]}"
55
+ />
56
+ <field name="verifactu_description" string="Description" />
57
+ </group>
58
+ <group string="Information" name="group_verifactu_information">
59
+ <field
60
+ name="verifactu_hash_string"
61
+ string="Hash string"
62
+ readonly="1"
63
+ groups="base.group_no_one"
64
+ />
65
+ <field
66
+ name="verifactu_hash"
67
+ string="Hash"
68
+ readonly="1"
69
+ groups="base.group_no_one"
70
+ />
71
+ <field
72
+ name="verifactu_registration_date"
73
+ string="Registration date"
74
+ readonly="1"
75
+ />
76
+ </group>
77
+ </group>
78
+ <group
79
+ string="Result"
80
+ name="group_verifactu_result"
81
+ groups="l10n_es_aeat.group_account_aeat"
82
+ >
83
+ <notebook colspan="2">
84
+ <page name="page_aeat_result_general" string="General">
85
+ <group>
86
+ <field name="aeat_state" string="Send State" />
87
+ <field name="verifactu_csv" string="CSV" />
88
+ <field
89
+ name="aeat_send_failed"
90
+ string="Failed?"
91
+ attrs="{'invisible': [('aeat_send_failed', '=', False)]}"
92
+ />
93
+ <field
94
+ name="aeat_send_error"
95
+ string="Send error"
96
+ attrs="{'invisible': [('aeat_send_failed', '=', False)]}"
97
+ />
98
+ </group>
99
+ </page>
100
+ <page
101
+ name="page_aeat_result_technical"
102
+ string="Technical"
103
+ groups="base.group_no_one"
104
+ >
105
+ <group>
106
+ <field
107
+ name="aeat_header_sent"
108
+ string="Sent header"
109
+ />
110
+ <field
111
+ name="aeat_content_sent"
112
+ string="Sent content"
113
+ />
114
+ </group>
115
+ <group string="Invoice entries">
116
+ <field
117
+ name="verifactu_invoice_entry_ids"
118
+ nolabel="1"
119
+ colspan="2"
120
+ />
121
+ </group>
122
+ <group string="Responses">
123
+ <field
124
+ name="verifactu_response_line_ids"
125
+ nolabel="1"
126
+ colspan="2"
127
+ >
128
+ <tree>
129
+ <field name="create_date" />
130
+ <field name="entry_id" />
131
+ <field
132
+ name="send_state"
133
+ widget="badge"
134
+ decoration-warning="send_state == 'accepted_with_errors'"
135
+ decoration-success="send_state == 'correct'"
136
+ decoration-danger="send_state not in ('correct', 'accepted_with_errors')"
137
+ />
138
+ </tree>
139
+ </field>
140
+ </group>
141
+ </page>
142
+ </notebook>
143
+ </group>
144
+ </page>
145
+ </notebook>
146
+ </field>
147
+ </record>
148
+
149
+ <record id="invoice_verifactu_search" model="ir.ui.view">
150
+ <field name="name">account.invoice.verifactu.search</field>
151
+ <field name="model">account.move</field>
152
+ <field name="inherit_id" ref="account.view_account_invoice_filter" />
153
+ <field name="arch" type="xml">
154
+ <filter name="late" position="after">
155
+ <group string="VERI*FACTU filters">
156
+ <separator />
157
+ <filter
158
+ name="verifactu_not_sent"
159
+ string="VERI*FACTU not sent"
160
+ domain="[('aeat_state', '=', 'not_sent'), ('verifactu_enabled', '=', True)]"
161
+ help="Never sent to VERI*FACTU"
162
+ />
163
+ <filter
164
+ name="verifactu_pending"
165
+ string="With modifications not sent to VERI*FACTU"
166
+ domain="[('aeat_state', 'in', ['sent_modified','cancelled_modified'])]"
167
+ help="Already sent but with local changes not sent yet"
168
+ />
169
+ <filter
170
+ name="verifactu_sent"
171
+ string="VERI*FACTU sent"
172
+ domain="[('aeat_state', 'not in', ['not_sent'])]"
173
+ help="Already sent to VERI*FACTU. It includes cancelled invoices"
174
+ />
175
+ <filter
176
+ name="aeat_send_failed"
177
+ string="VERI*FACTU failed"
178
+ domain="[('aeat_send_failed', '=', True)]"
179
+ help="The last attemp to sent to VERI*FACTU has failed"
180
+ />
181
+ <filter
182
+ name="verifactu_cancelled"
183
+ string="VERI*FACTU cancelled"
184
+ domain="[('aeat_state', 'in', ['cancelled','cancelled_modified'])]"
185
+ help="Cancelled invoices at VERI*FACTU"
186
+ />
187
+ <separator />
188
+ </group>
189
+ </filter>
190
+ <xpath expr="//group" position="inside">
191
+ <separator />
192
+ <filter
193
+ string="VERI*FACTU error"
194
+ name="verifactu_error"
195
+ domain="[('aeat_send_failed', '=', True)]"
196
+ context="{'group_by':'aeat_send_error'}"
197
+ />
198
+ </xpath>
199
+ </field>
200
+ </record>
201
+
202
+ <record id="invoice_verifactu_tree" model="ir.ui.view">
203
+ <field name="name">account.invoice.tree</field>
204
+ <field name="model">account.move</field>
205
+ <field name="inherit_id" ref="account.view_invoice_tree" />
206
+ <field name="arch" type="xml">
207
+ <field name="state" position="after">
208
+ <field
209
+ name="aeat_state"
210
+ decoration-success="aeat_state == 'sent'"
211
+ decoration-danger="aeat_state == 'not_sent'"
212
+ decoration-warning="aeat_state == 'sent_w_errors'"
213
+ widget="badge"
214
+ optional="hide"
215
+ />
216
+ </field>
217
+ </field>
218
+ </record>
219
+ </odoo>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
3
+ <odoo>
4
+ <record id="verifactu_tax_agency_form_view" model="ir.ui.view">
5
+ <field name="name">aeat.tax.agency.form - l10n_es_verifactu</field>
6
+ <field name="model">aeat.tax.agency</field>
7
+ <field name="inherit_id" ref="l10n_es_aeat.aeat_tax_agency_form_view" />
8
+ <field name="arch" type="xml">
9
+ <notebook position="inside">
10
+ <page name="verifactu" string="VERI*FACTU">
11
+ <group>
12
+ <group string="Suministro Facturas Emitidas">
13
+ <field name="verifactu_wsdl_out" string="WSDL" />
14
+ <field
15
+ name="verifactu_wsdl_out_test_address"
16
+ string="Test Address"
17
+ />
18
+ </group>
19
+ </group>
20
+ <group string="Validar QR">
21
+ <field name="verifactu_qr_base_url" string="Base URL" />
22
+ <field
23
+ name="verifactu_qr_base_url_test_address"
24
+ string="Test Base URL"
25
+ />
26
+ </group>
27
+ </page>
28
+ </notebook>
29
+ </field>
30
+ </record>
31
+ </odoo>