Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
l10n_mx
l10n_mx_facturae
Commits
98181ff8
Commit
98181ff8
authored
1 year ago
by
Ricardo Adolfo Mendoza Escobedo
Committed by
Carlos Antonio Pérez Felipe
11 months ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problema con la variable cancelación dentro del ciclo for en la funcion l10n_mx_action_cancel
parent
c4db8b68
Pipeline
#22794
failed with stage
in 43 seconds
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
634 additions
and
60 deletions
+634
-60
l10n_mx_facturae/i18n/es_MX.po
l10n_mx_facturae/i18n/es_MX.po
+628
-0
l10n_mx_facturae/models/account_move.py
l10n_mx_facturae/models/account_move.py
+5
-60
l10n_mx_facturae/views/account_move.xml
l10n_mx_facturae/views/account_move.xml
+1
-0
No files found.
l10n_mx_facturae/i18n/es_MX.po
0 → 100644
View file @
98181ff8
This diff is collapsed.
Click to expand it.
l10n_mx_facturae/models/account_move.py
View file @
98181ff8
...
...
@@ -320,42 +320,6 @@ class AccountMove(models.Model):
# Create new CFDI object for this invoice
account_invoice
.
create_cfdi
()
def
action_cancel
(
self
):
"""Extend `AccountMove.action_cancel()`; Cancels the CFDI related to the
invoice
"""
# Get only invoices with related cfdi to cancel cfdi before cancel invoice
cfdis
=
self
.
filtered
(
lambda
i
:
i
.
journal_id
.
sign_sat
and
i
.
cfdi_id
and
i
.
cfdi_id
.
state
not
in
[
"draft"
,
"cancel"
]
)
for
invoice
in
cfdis
:
# Ensure we can cancel this invoice
invoice
.
check_if_can_cancel
()
# If l10n_mx_edi_original_invoice is set save uuid to send info to PAC
# while cancel invoice
invoice
.
cfdi_id
.
substitute_cfdi_uuid
=
(
invoice
.
l10n_mx_edi_original_invoice
.
cfdi_id
.
uuid
)
cancelacion
=
invoice
.
cancel_cfdi
()[
0
]
if
cancelacion
:
# CFDI cancelled (cancelacion == True) must cancel invoice too
super
(
AccountMove
,
invoice
).
action_cancel
()
elif
cancelacion
is
None
:
# CFDI set to approval (cancelacion == None) must set invoice
# to waiting too
invoice
.
write
({
"state"
:
"waiting"
})
elif
cancelacion
is
False
:
# CFDI cancel denied (cancelacion == False) must get back invoice
# to open state
self
.
undo_waiting_state
()
# Call super only with invoices without CFDI
invoices
=
self
-
cfdis
return
super
(
AccountMove
,
invoices
).
action_cancel
()
def
undo_waiting_state
(
self
):
"""When cancel is negate revert invoice to open and post account_move"""
for
record
in
self
:
...
...
@@ -525,12 +489,11 @@ class AccountMove(models.Model):
return
res
def
l10n_mx_action_cancel
(
self
):
"""Cancels the CFDI related to the invoice"""
# Call write() to update the is_cancelable field
self
.
write
({
'is_cancelable'
:
True
})
# Get only invoices with related cfdi to cancel cfdi before cancel invoice
"""Extend `AccountInvoice.action_cancel()`; Cancels the CFDI related to the
invoice
"""
self
.
write
({
"is_cancelable"
:
True
})
# Get only invoices with related cfdi to cancel cfdi before cancel invoice
cfdis
=
self
.
filtered
(
lambda
i
:
...
...
@@ -538,30 +501,12 @@ class AccountMove(models.Model):
and
i
.
cfdi_id
and
i
.
cfdi_id
.
state
not
in
[
"draft"
,
"cancel"
]
)
for
invoice
in
cfdis
:
# Ensure we can cancel this invoice
invoice
.
check_if_can_cancel
()
# If l10n_mx_edi_original_invoice is set save uuid to send info to PAC
# while cancel invoice
invoice
.
cfdi_id
.
substitute_cfdi_uuid
=
(
invoice
.
l10n_mx_edi_original_invoice
.
cfdi_id
.
uuid
)
invoice
.
message_post
(
body
=
_
(
"Cancellation request sent"
)
)
cancelacion
=
invoice
.
cancel_cfdi
()[
0
]
if
cancelacion
:
# CFDI cancelled (cancelacion == True) must cancel invoice too
invoice
.
button_draft
()
invoice
.
button_cancel
()
elif
cancelacion
is
None
:
# CFDI set to approval (cancelacion == None) must set invoice
# to waiting too
invoice
.
write
({
"state"
:
"waiting"
})
elif
cancelacion
is
False
:
# CFDI cancel denied (cancelacion == False) must get back invoice
# to open state
self
.
undo_waiting_state
()
class
AccountMoveLine
(
models
.
Model
):
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_facturae/views/account_move.xml
View file @
98181ff8
...
...
@@ -36,6 +36,7 @@
type=
"object"
class=
"btn-primary"
attrs=
"{'invisible': [
'&',
('state', '!=', 'posted'),
('cfdi_state', '!=', 'done')
]}"
/>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment