Skip to content

Commit

Permalink
Merge branch '15.0' into 16.0-fwp-002-jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-pcg committed Feb 16, 2024
2 parents eb3527d + 1cfa716 commit e0c4ddb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 49 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.4.0",
"version": "16.0.1.5.0",
# any module necessary for this one to work correctly
"depends": ["l10n_latam_invoice_document", "l10n_do"],
# always loaded
Expand Down
56 changes: 8 additions & 48 deletions l10n_do_accounting/wizard/account_move_reversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,36 +86,9 @@ 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":
@api.onchange("refund_type")
def onchange_refund_type(self):
if self.refund_type != "full_refund":
self.refund_method = "refund"

@api.onchange("l10n_do_refund_action")
Expand Down Expand Up @@ -191,8 +164,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 @@ -211,19 +187,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 e0c4ddb

Please sign in to comment.