From 43273783e261d621fa27148b8e9ecb28f39c2277 Mon Sep 17 00:00:00 2001 From: Stana Natanaela Date: Fri, 27 Sep 2024 13:57:00 +0300 Subject: [PATCH] [16.0]IMP: modificare xml pt facturile storno sa fie corecte --- .../security/ir.model.access.csv | 3 ++ l10n_ro_account_edi_ubl/__manifest__.py | 2 +- .../models/account_edi_format.py | 2 -- .../models/account_edi_xml_cius_ro.py | 22 ++++++++---- .../static/description/index.html | 11 +++--- l10n_ro_account_edi_ubl/tests/credit_note.xml | 20 +++++------ .../tests/credit_note_in.xml | 20 +++++------ .../tests/credit_note_in_option.xml | 20 +++++------ .../tests/credit_note_option.xml | 20 +++++------ l10n_ro_account_edi_ubl/tests/invoice_in.xml | 2 +- .../views/cius_template.xml | 34 ++++++------------- .../security/ir.model.access.csv | 1 + .../models/stock_move.py | 19 ++++++++--- 13 files changed, 94 insertions(+), 82 deletions(-) diff --git a/l10n_ro_account_anaf_sync/security/ir.model.access.csv b/l10n_ro_account_anaf_sync/security/ir.model.access.csv index 49c9e809c..21ba7b176 100644 --- a/l10n_ro_account_anaf_sync/security/ir.model.access.csv +++ b/l10n_ro_account_anaf_sync/security/ir.model.access.csv @@ -4,3 +4,6 @@ access_l10n_ro_account_anaf_sync_invoice,l10n.ro.account.anaf.sync.invoice,model access_l10n_ro_account_anaf_sync_manager,l10n.ro.account.anaf.sync.manager,model_l10n_ro_account_anaf_sync,account.group_account_manager,1,1,1,1 access_l10n_ro_account_anaf_sync_scope_user,l10n.ro.account.anaf.sync.scope.invoice,model_l10n_ro_account_anaf_sync_scope,account.group_account_invoice,1,0,0,0 access_l10n_ro_account_anaf_sync_scope_manager,l10n.ro.account.anaf.sync.scope.manager,model_l10n_ro_account_anaf_sync_scope,account.group_account_manager,1,1,1,1 +access_l10n_ro_account_anaf_sync_scope_users,l10n.ro.account.anaf.sync.scope.invoice,model_l10n_ro_account_anaf_sync_scope,account.group_account_user,1,0,0,0 +access_l10n_ro_account_anaf_sync_scope_readonly,l10n.ro.account.anaf.sync.scope.invoice,model_l10n_ro_account_anaf_sync_scope,account.group_account_readonly,1,0,0,0 +access_l10n_ro_account_anaf_sync_readonly,l10n.ro.account.anaf.sync,model_l10n_ro_account_anaf_sync,account.group_account_readonly,1,0,0,0 diff --git a/l10n_ro_account_edi_ubl/__manifest__.py b/l10n_ro_account_edi_ubl/__manifest__.py index c5c232f40..e39c9b9c3 100644 --- a/l10n_ro_account_edi_ubl/__manifest__.py +++ b/l10n_ro_account_edi_ubl/__manifest__.py @@ -21,7 +21,7 @@ "views/cius_template.xml", ], "license": "AGPL-3", - "version": "16.0.1.66.0", + "version": "16.0.1.67.0", "author": "Terrabit," "NextERP Romania," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-romania", "installable": True, diff --git a/l10n_ro_account_edi_ubl/models/account_edi_format.py b/l10n_ro_account_edi_ubl/models/account_edi_format.py index 790deb85e..dbf442dc9 100644 --- a/l10n_ro_account_edi_ubl/models/account_edi_format.py +++ b/l10n_ro_account_edi_ubl/models/account_edi_format.py @@ -255,8 +255,6 @@ def _get_invoice_edi_content(self, move): def _l10n_ro_post_invoice_step_1(self, invoice, attachment): anaf_config = invoice.company_id._l10n_ro_get_anaf_sync(scope="e-factura") standard = "UBL" - if invoice.move_type in ("out_refund", "in_refund"): - standard = "CN" params = { "standard": standard, "cif": invoice.company_id.partner_id.vat.replace("RO", ""), diff --git a/l10n_ro_account_edi_ubl/models/account_edi_xml_cius_ro.py b/l10n_ro_account_edi_ubl/models/account_edi_xml_cius_ro.py index c8123263d..845f3b88c 100644 --- a/l10n_ro_account_edi_ubl/models/account_edi_xml_cius_ro.py +++ b/l10n_ro_account_edi_ubl/models/account_edi_xml_cius_ro.py @@ -209,12 +209,22 @@ def _export_invoice_vals(self, invoice): "accounting_supplier_party_vals" ] vals_list["vals"]["accounting_supplier_party_vals"] = customer_vals - if invoice.move_type in ("out_invoice", "in_invoice"): - vals_list["main_template"] = "account_edi_ubl_cii.ubl_20_Invoice" - vals_list["vals"]["invoice_type_code"] = 380 - else: - vals_list["main_template"] = "account_edi_ubl_cii.ubl_20_CreditNote" - vals_list["vals"]["credit_note_type_code"] = 381 + + vals_list["main_template"] = "account_edi_ubl_cii.ubl_20_Invoice" + vals_list["vals"]["invoice_type_code"] = 380 + if vals_list["vals"].get("credit_note_type_code"): + vals_list["vals"].pop("credit_note_type_code") + if ( + invoice.move_type in ("in_invoice", "in_refund") + and invoice.journal_id.l10n_ro_sequence_type == "autoinv2" + ): + vals_list["vals"]["invoice_type_code"] = 389 + point_of_sale = self.env["ir.module.module"].search( + [("name", "=", "point_of_sale"), ("state", "=", "installed")], limit=1 + ) + if point_of_sale: + if invoice.pos_order_ids: + vals_list["vals"]["invoice_type_code"] = 751 return vals_list def _export_invoice_constraints(self, invoice, vals): diff --git a/l10n_ro_account_edi_ubl/static/description/index.html b/l10n_ro_account_edi_ubl/static/description/index.html index 64cfe210b..6d72dce7e 100644 --- a/l10n_ro_account_edi_ubl/static/description/index.html +++ b/l10n_ro_account_edi_ubl/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -429,7 +430,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

diff --git a/l10n_ro_account_edi_ubl/tests/credit_note.xml b/l10n_ro_account_edi_ubl/tests/credit_note.xml index 7f21a4c3c..617447b15 100644 --- a/l10n_ro_account_edi_ubl/tests/credit_note.xml +++ b/l10n_ro_account_edi_ubl/tests/credit_note.xml @@ -1,6 +1,6 @@ - @@ -9,7 +9,7 @@ urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 FBRAO2093 2022-09-01 - 381 + 380 RON SCOALA GIMNAZIALA COMUNA FOENI @@ -111,9 +111,9 @@ 0.00 11900.00 - + 1 - 5.0 + 5.0 5000.00 [00000623] Bec P21/5W @@ -133,10 +133,10 @@ 1000.0 1.0 - - + + 2 - 5.0 + 5.0 5000.00 [00000624] Bec P21/10W @@ -156,5 +156,5 @@ 1000.0 1.0 - - + + diff --git a/l10n_ro_account_edi_ubl/tests/credit_note_in.xml b/l10n_ro_account_edi_ubl/tests/credit_note_in.xml index 4ad4352f2..572e4f840 100644 --- a/l10n_ro_account_edi_ubl/tests/credit_note_in.xml +++ b/l10n_ro_account_edi_ubl/tests/credit_note_in.xml @@ -1,6 +1,6 @@ - @@ -9,7 +9,7 @@ urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 FBRAO2095 2022-09-01 - 381 + 389 RON SCOALA GIMNAZIALA COMUNA FOENI @@ -111,9 +111,9 @@ 0.00 11900.00 - + 1 - 5.0 + 5.0 5000.00 [00000623] Bec P21/5W @@ -133,10 +133,10 @@ 1000.0 1.0 - - + + 2 - 5.0 + 5.0 5000.00 [00000624] Bec P21/10W @@ -156,5 +156,5 @@ 1000.0 1.0 - - + + diff --git a/l10n_ro_account_edi_ubl/tests/credit_note_in_option.xml b/l10n_ro_account_edi_ubl/tests/credit_note_in_option.xml index b21b0d92d..3671b7d3c 100644 --- a/l10n_ro_account_edi_ubl/tests/credit_note_in_option.xml +++ b/l10n_ro_account_edi_ubl/tests/credit_note_in_option.xml @@ -1,6 +1,6 @@ - @@ -9,7 +9,7 @@ urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 FBRAO2095 2022-09-01 - 381 + 389 RON SCOALA GIMNAZIALA COMUNA FOENI @@ -111,9 +111,9 @@ 0.00 -11900.00 - + 1 - -5.0 + -5.0 -5000.00 [00000623] Bec P21/5W @@ -133,10 +133,10 @@ 1000.0 1.0 - - + + 2 - -5.0 + -5.0 -5000.00 [00000624] Bec P21/10W @@ -156,5 +156,5 @@ 1000.0 1.0 - - + + diff --git a/l10n_ro_account_edi_ubl/tests/credit_note_option.xml b/l10n_ro_account_edi_ubl/tests/credit_note_option.xml index 9d99f4dbf..3a491c6eb 100644 --- a/l10n_ro_account_edi_ubl/tests/credit_note_option.xml +++ b/l10n_ro_account_edi_ubl/tests/credit_note_option.xml @@ -1,6 +1,6 @@ - @@ -9,7 +9,7 @@ urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 FBRAO2093 2022-09-01 - 381 + 380 RON SCOALA GIMNAZIALA COMUNA FOENI @@ -111,9 +111,9 @@ 0.00 -11900.00 - + 1 - -5.0 + -5.0 -5000.00 [00000623] Bec P21/5W @@ -133,10 +133,10 @@ 1000.0 1.0 - - + + 2 - -5.0 + -5.0 -5000.00 [00000624] Bec P21/10W @@ -156,5 +156,5 @@ 1000.0 1.0 - - + + diff --git a/l10n_ro_account_edi_ubl/tests/invoice_in.xml b/l10n_ro_account_edi_ubl/tests/invoice_in.xml index e7392fcd0..72928e34b 100644 --- a/l10n_ro_account_edi_ubl/tests/invoice_in.xml +++ b/l10n_ro_account_edi_ubl/tests/invoice_in.xml @@ -10,7 +10,7 @@ FBRAO2094 2022-09-01 2022-09-01 - 380 + 389 RON SCOALA GIMNAZIALA COMUNA FOENI diff --git a/l10n_ro_account_edi_ubl/views/cius_template.xml b/l10n_ro_account_edi_ubl/views/cius_template.xml index 242a93682..e870c4781 100644 --- a/l10n_ro_account_edi_ubl/views/cius_template.xml +++ b/l10n_ro_account_edi_ubl/views/cius_template.xml @@ -8,18 +8,10 @@ xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" - t-if="invoice.move_type in ('out_refund', 'in_invoice')" + t-if="invoice.move_type in ('out_refund', 'in_invoice', 'in_refund')" t-att="vals.get('invoice_type_code_attrs', {})" t-out="vals.get('invoice_type_code')" /> - - + - - - - - + + + False + - - + + False diff --git a/l10n_ro_message_spv/security/ir.model.access.csv b/l10n_ro_message_spv/security/ir.model.access.csv index 51fb70e42..8995dab43 100644 --- a/l10n_ro_message_spv/security/ir.model.access.csv +++ b/l10n_ro_message_spv/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_l10n_ro_message_spv,access_l10n_ro_message_spv,model_l10n_ro_message_spv,account.group_account_user,1,1,1,1 +access_l10n_ro_message_spv_user,access_l10n_ro_message_spv,model_l10n_ro_message_spv,account.group_account_readonly,1,0,0,0 diff --git a/l10n_ro_stock_account_date/models/stock_move.py b/l10n_ro_stock_account_date/models/stock_move.py index 929464f66..c045c5b9f 100644 --- a/l10n_ro_stock_account_date/models/stock_move.py +++ b/l10n_ro_stock_account_date/models/stock_move.py @@ -43,20 +43,29 @@ def l10n_ro_get_move_date(self): ) if restrict_date_future: last_posting_date = date.today() - if first_posting_date or last_posting_date: - if not (first_posting_date <= new_date.date() <= last_posting_date): + if new_date.date() > last_posting_date: raise UserError( _( "Cannot validate stock move due to date restriction." - "The date must be between %(first_posting_date)s and " - "%(last_posting_date)s" + "The date must be before %(last_posting_date)s " ) % { - "first_posting_date": first_posting_date, "last_posting_date": last_posting_date, } ) self.check_lock_date(self.date) + if first_posting_date: + if not (first_posting_date <= new_date.date()): + raise UserError( + _( + "Cannot validate stock move due to date restriction." + "The date must be after %(first_posting_date)s" + ) + % { + "first_posting_date": first_posting_date, + } + ) + self.check_lock_date(self.date) return new_date def _action_done(self, cancel_backorder=False):