Skip to content

Commit

Permalink
Merge branch '16.0' into 17.0-mig-001-jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-pcg committed Feb 16, 2024
2 parents 2c097a6 + c6f2ac2 commit 52d49e6
Showing 1 changed file with 5 additions and 47 deletions.
52 changes: 5 additions & 47 deletions l10n_do_accounting/wizard/account_move_reversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,6 @@ def _compute_l10n_latam_manual_document_number(self):
AccountMoveReversal, self - l10n_do_recs
)._compute_l10n_latam_manual_document_number()

@api.model
def default_get(self, fields):
res = super(AccountMoveReversal, self).default_get(fields)
move_ids = (
self.env["account.move"].browse(self.env.context["active_ids"])
if self.env.context.get("active_model") == "account.move"
else self.env["account.move"]
)
move_ids_use_document = move_ids.filtered(
lambda move: move.l10n_latam_use_documents
and move.company_id.country_code == "DO"
)

if len(move_ids_use_document) > 1:
raise UserError(
_(
"You cannot create Credit Notes from multiple "
"documents at a time."
)
)
if move_ids_use_document:
res["is_ecf_invoice"] = move_ids_use_document[
0
].company_id.l10n_do_ecf_issuer

return res

# @api.onchange("l10n_do_refund_type")
# def onchange_l10n_do_refund_type(self):
# if self.l10n_do_refund_type != "full_refund":
Expand Down Expand Up @@ -186,8 +159,11 @@ def _compute_document_type(self):
% ", ".join(move_ids_use_document.mapped("name"))
)
else:
record.l10n_latam_use_documents = (
record.journal_id.l10n_latam_use_documents
record.write(
{
"l10n_latam_use_documents": record.journal_id.l10n_latam_use_documents,
"is_ecf_invoice": record.company_id.l10n_do_ecf_issuer,
}
)

if record.l10n_latam_use_documents:
Expand All @@ -206,21 +182,3 @@ def _compute_document_type(self):
refund.l10n_latam_available_document_type_ids
)
super(AccountMoveReversal, self - do_wizard)._compute_document_type()

@api.depends("l10n_latam_document_type_id")
def _compute_l10n_latam_manual_document_number(self):
self.l10n_latam_manual_document_number = False
do_wizard = self.filtered(
lambda w: w.journal_id
and w.journal_id.l10n_latam_use_documents
and w.country_code == "DO"
and w.move_ids
)
for rec in do_wizard:
if rec.journal_id and rec.journal_id.l10n_latam_use_documents:
rec.l10n_latam_manual_document_number = (
True if rec.journal_id.type == "purchase" else False
)
super(
AccountMoveReversal, self - do_wizard
)._compute_l10n_latam_manual_document_number()

0 comments on commit 52d49e6

Please sign in to comment.