Skip to content

Commit

Permalink
Merge pull request #1133 from indexa-git/16.0-fwp-001-jl
Browse files Browse the repository at this point in the history
[16.0][FWP] *: merge 15.0 into 16.0
  • Loading branch information
jose-pcg authored Feb 8, 2024
2 parents bcd301a + 33b0398 commit eb3527d
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 20 deletions.
2 changes: 1 addition & 1 deletion l10n_do_accounting/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"category": "Localization",
"license": "LGPL-3",
"website": "https://github.com/odoo-dominicana",
"version": "16.0.1.3.2",
"version": "16.0.1.4.0",
# any module necessary for this one to work correctly
"depends": ["l10n_latam_invoice_document", "l10n_do"],
# always loaded
Expand Down
54 changes: 43 additions & 11 deletions l10n_do_accounting/i18n/es_DO.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-18 15:55+0000\n"
"PO-Revision-Date: 2023-09-18 11:56-0400\n"
"POT-Creation-Date: 2024-02-06 14:49+0000\n"
"PO-Revision-Date: 2024-02-06 10:53-0400\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"Language: es_DO\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: Poedit 3.3.2\n"
"X-Generator: Poedit 3.4.2\n"

#. module: l10n_do_accounting
#. odoo-python
Expand Down Expand Up @@ -1015,6 +1015,15 @@ msgstr ""
"Note que la manera más fácil de crear una Nota de Débito es haciéndolo directamente "
"desde una factura."

#. module: l10n_do_accounting
#: model_terms:ir.ui.view,arch_db:l10n_do_accounting.view_move_form
msgid ""
"Notice. Document Number field enabled because a new Fiscal Number Expiration date was "
"set on journal"
msgstr ""
"Aviso. Se ha activado el campo Número de Comprobante porque se ha establecido una nueva "
"fecha de expiración del NCF en el diario"

#. module: l10n_do_accounting
#: model_terms:ir.ui.view,arch_db:l10n_do_accounting.view_move_form
msgid ""
Expand Down Expand Up @@ -1109,6 +1118,13 @@ msgid "Selected invoice(s) cannot be cancelled as they are already in 'Paid' sta
msgstr ""
"Las facturas seleccionadas no pueden cancelarse ya que se encuentran en estado Pagadas."

#. module: l10n_do_accounting
#: model:ir.model.fields,field_description:l10n_do_accounting.field_account_bank_statement_line__l10n_do_show_expiration_date_msg
#: model:ir.model.fields,field_description:l10n_do_accounting.field_account_move__l10n_do_show_expiration_date_msg
#: model:ir.model.fields,field_description:l10n_do_accounting.field_account_payment__l10n_do_show_expiration_date_msg
msgid "Show Expiration Date Message"
msgstr "Mostrar Mensaje Fecha Expiración"

#. module: l10n_do_accounting
#: model:ir.model.fields,help:l10n_do_accounting.field_account_bank_statement_line__l10n_do_fiscal_number
#: model:ir.model.fields,help:l10n_do_accounting.field_account_move__l10n_do_fiscal_number
Expand Down Expand Up @@ -1155,6 +1171,18 @@ msgstr ""
"Campo técnico que computa si la secuencia de generación interna está habilitada para "
"colocar manualmente."

#. module: l10n_do_accounting
#: model:ir.model.fields,help:l10n_do_accounting.field_account_bank_statement_line__l10n_do_show_expiration_date_msg
#: model:ir.model.fields,help:l10n_do_accounting.field_account_move__l10n_do_show_expiration_date_msg
#: model:ir.model.fields,help:l10n_do_accounting.field_account_payment__l10n_do_show_expiration_date_msg
msgid ""
"Technical field to hide/show message on invoice header that indicate fiscal number must "
"be input manually because a new expiration date was set on journal"
msgstr ""
"Campo técnico para ocultar/mostrar un mensaje en el encabezado de las facturas para "
"indicar que el NCF debe ser digital manualmente porque se colocó una nueva fecha de "
"expiración en el diario"

#. module: l10n_do_accounting
#: model:ir.model.fields,help:l10n_do_accounting.field_account_debit_note__l10n_latam_country_code
#: model:ir.model.fields,help:l10n_do_accounting.field_account_move_reversal__country_code
Expand All @@ -1173,12 +1201,6 @@ msgstr "Ya existe una factura de ventas con el NCF %s"
msgid "Use Documents"
msgstr "Es fiscal"

#. module: l10n_do_accounting
#: code:addons/l10n_do_accounting/models/account_move.py:0
#, python-format
msgid "There is already a sale invoice with fiscal number %s"
msgstr "Ya existe una factura de ventas con el NCF %s"

#. module: l10n_do_accounting
#: model_terms:ir.ui.view,arch_db:l10n_do_accounting.view_account_move_reversal_inherited
msgid ""
Expand Down Expand Up @@ -1268,7 +1290,17 @@ msgstr ""
"de este contacto"

#. module: l10n_do_accounting
#. odoo-python
#: code:addons/l10n_do_accounting/wizard/account_move_reversal.py:0
#, python-format
msgid ""
"You can only reverse documents with legal invoicing documents from Latin America one at "
"a time.\n"
"Problematic documents: %s"
msgstr ""
"Solo puede aplicar Notas de Crédito a una factura a la vez.\n"
"Documentos señalados: %s"

#. module: l10n_do_accounting
#: code:addons/l10n_do_accounting/models/account_move.py:0
#, python-format
msgid "You cannot cancel multiple fiscal invoices at a time."
Expand Down
59 changes: 51 additions & 8 deletions l10n_do_accounting/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ def _get_l10n_do_income_type(self):
"ECF XML File Name", copy=False, readonly=True
)
l10n_latam_manual_document_number = fields.Boolean(store=True)
l10n_do_show_expiration_date_msg = fields.Boolean(
"Show Expiration Date Message",
compute="_compute_l10n_do_show_expiration_date_msg",
help="Technical field to hide/show message on invoice header that indicate fiscal number must be input "
"manually because a new expiration date was set on journal",
)

def init(self):
super(AccountMove, self).init()
Expand Down Expand Up @@ -167,6 +173,43 @@ def _name_search(
expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid
)

def _l10n_do_is_new_expiration_date(self):
self.ensure_one()
last_invoice = self.search(
[
("company_id", "=", self.company_id.id),
("move_type", "=", self.move_type),
(
"l10n_latam_document_type_id",
"=",
self.l10n_latam_document_type_id.id,
),
("posted_before", "=", True),
("id", "!=", self.id or self._origin.id),
],
order="invoice_date, id desc",
limit=1,
)
if not last_invoice:
return False

return (
last_invoice.l10n_do_ncf_expiration_date < self.l10n_do_ncf_expiration_date
)

@api.depends("l10n_do_ncf_expiration_date", "journal_id")
def _compute_l10n_do_show_expiration_date_msg(self):
l10n_do_internal_invoices = self.filtered(
lambda inv: inv.l10n_latam_use_documents
and inv.l10n_latam_document_type_id
and inv.country_code == "DO"
and not inv.l10n_latam_manual_document_number
)
for invoice in l10n_do_internal_invoices:
invoice.l10n_do_show_expiration_date_msg = invoice._l10n_do_is_new_expiration_date()

(self - l10n_do_internal_invoices).l10n_do_show_expiration_date_msg = False

@api.depends(
"journal_id.l10n_latam_use_documents",
"l10n_latam_manual_document_number",
Expand Down Expand Up @@ -199,7 +242,7 @@ def _compute_l10n_do_enable_first_sequence(self):
("id", "!=", invoice.id or invoice._origin.id),
],
)
)
) or invoice.l10n_do_show_expiration_date_msg

(self - l10n_do_internal_invoices).l10n_do_enable_first_sequence = False

Expand Down Expand Up @@ -570,6 +613,13 @@ def _compute_l10n_latam_manual_document_number(self):
move._is_l10n_do_manual_document_number()
)

move.l10n_do_ncf_expiration_date = (
move.journal_id.l10n_do_document_type_ids.filtered(
lambda doc: doc.l10n_latam_document_type_id
== move.l10n_latam_document_type_id
).l10n_do_ncf_expiration_date
)

super(
AccountMove, self - l10n_do_recs_with_journal_id
)._compute_l10n_latam_manual_document_number()
Expand Down Expand Up @@ -620,13 +670,6 @@ def _post(self, soft=True):
if not invoice.amount_total:
raise UserError(_("Fiscal invoice cannot be posted with amount zero."))

invoice.l10n_do_ncf_expiration_date = (
invoice.journal_id.l10n_do_document_type_ids.filtered(
lambda doc: doc.l10n_latam_document_type_id
== invoice.l10n_latam_document_type_id
).l10n_do_ncf_expiration_date
)

non_payer_type_invoices = l10n_do_invoices.filtered(
lambda inv: not inv.partner_id.l10n_do_dgii_tax_payer_type
)
Expand Down
10 changes: 10 additions & 0 deletions l10n_do_accounting/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<field name="is_ecf_invoice" invisible="1"/>
<field name="l10n_do_company_in_contingency" invisible="1"/>
<field name="l10n_do_enable_first_sequence" invisible="1" force_save="1"/>
<field name="l10n_do_show_expiration_date_msg" invisible="1"/>
</field>
<xpath expr="//field[@name='tax_lock_date_message']/.." position="after">
<div class="alert alert-warning"
Expand All @@ -20,6 +21,15 @@
('state', '!=', 'draft')]}">
Notice. This company is in a transient state of contingency for Electronic Invoice issuing. NCF issuing has been enabled.
</div>
<div class="alert alert-warning"
role="alert" style="margin-bottom:0px;"
attrs="{'invisible': ['|', '|', '|',
('move_type', '=', 'entry'),
('country_code', '!=', 'DO'),
('l10n_do_show_expiration_date_msg', '=', False),
('state', '!=', 'draft')]}">
Notice. Document Number field enabled because a new Fiscal Number Expiration date was set on journal
</div>
</xpath>
<xpath expr="//button[@name='button_cancel']" position="after">
<button name="button_cancel" type="object" string="Cancel"
Expand Down
3 changes: 3 additions & 0 deletions l10n_do_accounting/wizard/account_move_reversal_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
('is_ecf_invoice', '=', True),
]}"/>
</xpath>
<xpath expr="//form/group/group" position="attributes">
<attribute name="attrs">{'invisible': [('move_type', 'not in', ('out_invoice', 'in_invoice'))]}</attribute>
</xpath>
<xpath expr="//form/group/*[2]" position="attributes">
<attribute name="attrs">{'invisible': [('l10n_do_refund_type', '!=', 'full_refund')]}</attribute>
</xpath>
Expand Down

0 comments on commit eb3527d

Please sign in to comment.