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
Facturacion
Commits
be416733
Commit
be416733
authored
5 years ago
by
agb80
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mr-origin-269'
parents
ad04ee27
4f5d4c68
Pipeline
#7109
failed with stage
in 181 minutes and 32 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
67 additions
and
49 deletions
+67
-49
CHANGES.md
CHANGES.md
+11
-1
l10n_mx_account_tax_category/views/account_tax_category.xml
l10n_mx_account_tax_category/views/account_tax_category.xml
+2
-2
l10n_mx_facturae_cer/views/res_company_facturae_certificate.xml
...x_facturae_cer/views/res_company_facturae_certificate.xml
+1
-1
l10n_mx_ir_attachment_facturae/models/ir_attachment_facturae.py
...x_ir_attachment_facturae/models/ir_attachment_facturae.py
+15
-14
l10n_mx_ir_attachment_facturae/views/ir_attachment_facturae.xml
...x_ir_attachment_facturae/views/ir_attachment_facturae.xml
+1
-1
l10n_mx_ir_attachment_facturae/views/ir_attachment_facturae_config.xml
...tachment_facturae/views/ir_attachment_facturae_config.xml
+1
-1
l10n_mx_params_pac/models/params_pac.py
l10n_mx_params_pac/models/params_pac.py
+16
-9
l10n_mx_params_pac/pacs/expide_tu_factura.py
l10n_mx_params_pac/pacs/expide_tu_factura.py
+3
-3
l10n_mx_params_pac/pacs/finfok.py
l10n_mx_params_pac/pacs/finfok.py
+5
-6
l10n_mx_params_pac/pacs/solucion_factible.py
l10n_mx_params_pac/pacs/solucion_factible.py
+11
-10
l10n_mx_params_pac/views/params_pac_view.xml
l10n_mx_params_pac/views/params_pac_view.xml
+1
-1
No files found.
CHANGES.md
View file @
be416733
<a
name=
"2.3.3"
></a>
## 2.3.3 (2019-05-13)
#### Bug Fixes
*
**ir.attachment.facturae.mx:**
corrige el proceso de actualización del estado del CFDI (
[
28cb9a66
](
28cb9a66
)
)
<a
name=
"2.3.2"
></a>
##
4
.3.2 (2019-04-23)
##
2
.3.2 (2019-04-23)
#### Bug Fixes
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_account_tax_category/views/account_tax_category.xml
View file @
be416733
...
...
@@ -27,7 +27,7 @@
<field
name=
"name"
>
account.tax.group.view.tree
</field>
<field
name=
"model"
>
account.tax.group
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
string=
"Groups"
>
<tree>
<field
name=
"name"
/>
<field
name=
"code"
/>
</tree>
...
...
@@ -38,7 +38,7 @@
<field
name=
"name"
>
account.tax.group.view.search
</field>
<field
name=
"model"
>
account.tax.group
</field>
<field
name=
"arch"
type=
"xml"
>
<search
string=
"Groups"
>
<search>
<field
name=
"name"
/>
<field
name=
"code"
/>
</search>
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_facturae_cer/views/res_company_facturae_certificate.xml
View file @
be416733
...
...
@@ -41,7 +41,7 @@
<field
name=
"name"
>
res.company.facturae.certificate.view.tree
</field>
<field
name=
"model"
>
res.company.facturae.certificate
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
string=
"Certificates"
>
<tree>
<field
name=
"serial_number"
/>
<field
name=
"date_start"
/>
<field
name=
"date_end"
/>
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_ir_attachment_facturae/models/ir_attachment_facturae.py
View file @
be416733
...
...
@@ -255,7 +255,7 @@ class IrAttachmentFacturaeMx(models.Model):
domain
=
[(
"model"
,
"="
,
self
.
type_attachment
)]
config
=
ir_attachment_config_obj
.
search
(
domain
,
limit
=
1
)
if
self
.
cfdi_type
==
"incoming"
and
not
len
(
config
)
:
if
self
.
cfdi_type
==
"incoming"
and
not
config
:
raise
UserError
(
_
(
"You do not have any defined template "
"for {model} model"
).
format
(
model
=
self
.
type_attachment
...
...
@@ -387,18 +387,22 @@ class IrAttachmentFacturaeMx(models.Model):
:return fecha: datetime value of tag found
:rtype fecha: Datetime
"""
res
=
""
if
not
self
.
env
.
user
.
partner_id
.
tz
:
raise
UserError
(
_
(
"Set your time zone"
))
user_tz
=
timezone
(
self
.
env
.
user
.
partner_id
.
tz
)
try
:
fecha
=
parse
(
self
.
_parse_xml
(
tag
))
except
AttributeError
as
e
:
_logger
.
debug
(
e
)
fecha
=
None
if
fecha
:
user_tz
=
timezone
(
self
.
env
.
user
.
partner_id
.
tz
)
pass
else
:
fecha
=
user_tz
.
localize
(
fecha
)
fecha
=
fecha
.
astimezone
(
utc
)
return
fields
.
Datetime
.
to_string
(
fecha
)
res
=
fields
.
Datetime
.
to_string
(
fecha
)
return
res
@
property
def
hash_type
(
self
):
...
...
@@ -558,10 +562,13 @@ class IrAttachmentFacturaeMx(models.Model):
@
api
.
multi
def
action_consult_cancellation_status
(
self
):
"""Consult current cfdi cancel status on SAT"""
consult_answer
=
None
self
.
ensure_one
()
consult_answer
=
None
pacs
=
self
.
get_pacs
()
if
self
.
state
in
[
"waiting"
,
"cancel"
]:
consult_answer
=
self
.
consult_cfdi_cancellation_status
_sat
(
)
consult_answer
=
pacs
.
consult_cfdi_cancellation_status
(
uuid
=
self
.
uuid
)
if
consult_answer
:
self
.
cancel_cfdi
()
elif
consult_answer
is
None
:
...
...
@@ -725,7 +732,7 @@ class IrAttachmentFacturaeMx(models.Model):
"""
namespaces
=
namespaces
or
NAMESPACES
if
not
data
:
return
return
""
root
=
parse_xml_string
(
data
)
complete_pattern
=
""
.
join
([
".//"
,
element
,
"[@"
,
attrib
,
"]"
])
result
=
root
.
find
(
complete_pattern
,
namespaces
=
namespaces
)
...
...
@@ -837,12 +844,6 @@ class IrAttachmentFacturaeMx(models.Model):
# Call function which connects with PACs
return
params_pacs
.
cancel_cfdi
(
uuid
=
self
.
uuid
)
@
api
.
multi
def
consult_cfdi_cancellation_status_sat
(
self
):
self
.
ensure_one
()
params_pacs
=
self
.
get_pacs
()
return
params_pacs
.
consult_cfdi_cancellation_status
(
uuid
=
self
.
uuid
)
@
api
.
model
def
get_pacs
(
self
):
"""get all setup PACs in journal"""
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_ir_attachment_facturae/views/ir_attachment_facturae.xml
View file @
be416733
...
...
@@ -50,7 +50,7 @@
<field
name=
"name"
>
ir.attachment.facturae.view.tree
</field>
<field
name=
"model"
>
ir.attachment.facturae.mx
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
string=
"CFDI"
>
<tree>
<field
name=
"name"
/>
<field
name=
"cfdi_type"
/>
<field
name=
"state"
/>
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_ir_attachment_facturae/views/ir_attachment_facturae_config.xml
View file @
be416733
...
...
@@ -6,7 +6,7 @@
<field
name=
"name"
>
ir.attachment.facturae.config.view.tree
</field>
<field
name=
"model"
>
ir.attachment.facturae.mx.config
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
string=
"CFDI Documments"
>
<tree>
<field
name=
"model"
/>
<field
name=
"version"
/>
<field
name=
"template_xml_sign"
/>
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_params_pac/models/params_pac.py
View file @
be416733
...
...
@@ -9,7 +9,7 @@ from openerp.tools.translate import _
from
.
import
exceptions
logger
=
logging
.
getLogger
(
__name__
)
_
logger
=
logging
.
getLogger
(
__name__
)
class
ParamsPac
(
models
.
Model
):
...
...
@@ -26,6 +26,11 @@ class ParamsPac(models.Model):
"""function to inherit from custom PAC module"""
return
{}
@
classmethod
def
get_driver_fc_status
(
cls
):
"""function to inherit from custom PAC module"""
return
{}
@
classmethod
def
_get_pac_type
(
cls
):
# From module of PAC inherit this function and add new available PAC
...
...
@@ -101,12 +106,12 @@ class ParamsPac(models.Model):
# If all PACs would fail this variable will recollect
# all error in order to display them at the end
pacs_errors
=
[]
# Get all possible drivers to perform action
functions
=
getattr
(
self
,
action
)()
message_error
=
""
for
param_pac
in
self
:
# Get all possible drivers to perform action
function
=
getattr
(
param_pac
,
action
)()
try
:
result
=
function
[
param_pac
.
pac_type
](
data
)
result
=
function
s
[
param_pac
.
pac_type
](
data
)
# This kind of exception means that
# nevertheless you try with all PACs in the world
# CFDI would be failed
...
...
@@ -114,7 +119,7 @@ class ParamsPac(models.Model):
exceptions
.
ValidationError
,
exceptions
.
PrimarySectorError
,
exceptions
.
CancelError
)
as
error
:
logger
.
debug
(
_
(
repr
(
error
)))
_
logger
.
debug
(
_
(
repr
(
error
)))
raise
UserError
(
_
(
repr
(
error
)),
)
...
...
@@ -127,7 +132,7 @@ class ParamsPac(models.Model):
[
param_pac
.
name
,
repr
(
error
)],
)
pacs_errors
.
append
(
message_error
.
encode
(
"UTF-8"
)
+
"
\n
"
)
logger
.
info
(
_
logger
.
info
(
message_error
.
encode
(
"UTF-8"
),
)
continue
...
...
@@ -174,7 +179,8 @@ class ParamsPac(models.Model):
"""
self
.
check_pacs
()
cancel_estatus
=
self
.
fire_connection
(
uuid
,
"get_driver_fc_cancel"
)
return
cancel_estatus
.
check_cancel_status
()
result
=
cancel_estatus
.
check_cancel_status
()
return
result
@
api
.
multi
def
consult_cfdi_cancellation_status
(
self
,
uuid
):
...
...
@@ -183,8 +189,9 @@ class ParamsPac(models.Model):
:type uuid: string
"""
self
.
check_pacs
()
consult_estatus
=
self
.
fire_connection
(
uuid
,
"get_driver_fc_consult"
)
return
consult_estatus
.
check_cancel_status
()
_logger
.
info
(
"Consulting status for uuid: %s"
,
uuid
)
result
=
self
.
fire_connection
(
uuid
,
"get_driver_fc_status"
)
return
result
@
api
.
multi
def
check_pacs
(
self
):
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_params_pac/pacs/expide_tu_factura.py
View file @
be416733
...
...
@@ -63,9 +63,9 @@ class ParamsPac(models.Model):
factura_mx_type__fc
.
update
({
"pac_facturalo"
:
self
.
cancel_xpd_cfdi
})
return
factura_mx_type__fc
def
get_driver_fc_
consult
(
self
):
def
get_driver_fc_
status
(
self
):
""" Implement driver for consult cfdi's"""
factura_mx_type__fc
=
super
(
ParamsPac
,
self
).
get_driver_fc_
cancel
()
factura_mx_type__fc
=
super
(
ParamsPac
,
self
).
get_driver_fc_
status
()
if
factura_mx_type__fc
is
None
:
factura_mx_type__fc
=
{}
factura_mx_type__fc
.
update
({
"pac_facturalo"
:
self
.
consult_xpd_cfdi
})
...
...
@@ -230,7 +230,7 @@ class ParamsPac(models.Model):
estatus_cancelacion
=
resultado
[
"a:EstatusCancelacion"
]
estado_cfdi
=
resultado
[
"a:Estado"
]
consult_answer
=
PacConsultAnswer
(
uuid
,
estado_cfdi
,
estatus_cancelacion
)
return
consult_answer
return
consult_answer
.
check_cancel_status
()
@
api
.
model
def
cancel_xpd_cfdi
(
self
,
uuid
):
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_params_pac/pacs/finfok.py
View file @
be416733
...
...
@@ -83,11 +83,11 @@ class ParamsPac(models.Model):
factura_mx_type__fc
.
update
({
"pac_finkok"
:
self
.
cancel_cfdi_finkok
})
return
factura_mx_type__fc
def
get_driver_fc_
consult
(
self
):
def
get_driver_fc_
status
(
self
):
"""
Implement driver for consult CFDIs
"""
factura_mx_type__fc
=
super
(
ParamsPac
,
self
).
get_driver_fc_
cancel
()
factura_mx_type__fc
=
super
(
ParamsPac
,
self
).
get_driver_fc_
status
()
if
factura_mx_type__fc
is
None
:
factura_mx_type__fc
=
{}
factura_mx_type__fc
.
update
({
"pac_finkok"
:
self
.
consult_cfdi_finkok_2
})
...
...
@@ -216,18 +216,17 @@ class ParamsPac(models.Model):
password
=
self
.
password
.
encode
(
"utf-8"
)
emisor
=
cfdi
.
rfc_emisor
.
encode
(
"utf-8"
)
receptor
=
cfdi
.
rfc_receptor
.
encode
(
"utf-8"
)
# uuid = cfdi.uuid.encode("utf-8")
total
=
cfdi
.
total
client
=
Client
(
self
.
url_webservice_cancel
,
cache
=
None
)
res
=
client
.
service
.
get_sat_status
(
username
,
password
,
emisor
,
receptor
,
uuid
,
total
)
_logger
.
info
(
res
)
_logger
.
debug
(
"Finkok answer for cfdi status: %s"
,
res
)
folio
=
res
.
sat
estatus_cancelacion
=
folio
[
"EstatusCancelacion"
]
or
""
estado_cfdi
=
folio
[
"Estado"
]
consult_answer
=
PacConsultAnswer
(
uuid
,
estado_cfdi
,
estatus_cancelacion
)
return
consult_answer
return
consult_answer
.
check_cancel_status
()
def
consult_cfdi_finkok
(
self
,
uuid
):
""" Consul the cfdi status
...
...
@@ -293,4 +292,4 @@ class ParamsPac(models.Model):
estatus_cancelacion
=
resultado
[
"a:EstatusCancelacion"
]
estado_cfdi
=
resultado
[
"a:Estado"
]
consult_answer
=
PacConsultAnswer
(
uuid
,
estado_cfdi
,
estatus_cancelacion
)
return
consult_answer
return
consult_answer
.
check_cancel_status
()
This diff is collapsed.
Click to expand it.
l10n_mx_params_pac/pacs/solucion_factible.py
View file @
be416733
...
...
@@ -64,8 +64,8 @@ class ParamsPac(models.Model):
factura_mx_type__fc
.
update
({
"pac_sf"
:
self
.
sf_cancel
})
return
factura_mx_type__fc
def
get_driver_fc_
consult
(
self
):
factura_mx_type__fc
=
super
(
ParamsPac
,
self
).
get_driver_fc_
cancel
()
def
get_driver_fc_
status
(
self
):
factura_mx_type__fc
=
super
(
ParamsPac
,
self
).
get_driver_fc_
status
()
if
factura_mx_type__fc
is
None
:
factura_mx_type__fc
=
{}
factura_mx_type__fc
.
update
({
"pac_sf"
:
self
.
sf_consult
})
...
...
@@ -174,12 +174,14 @@ class ParamsPac(models.Model):
resultado
=
wsdl_client
.
timbrar
(
*
params
)
mensaje
=
_
(
tools
.
ustr
(
resultado
[
"mensaje"
]))
resultados_mensaje
=
(
resultado
[
"resultados"
]
and
resultado
[
"resultados"
][
"mensaje"
]
or
""
resultado
[
"resultados"
][
"mensaje"
]
if
resultado
[
"resultados"
]
else
""
)
folio_fiscal
=
(
resultado
[
"resultados"
][
"uuid"
]
if
resultado
[
"resultados"
]
else
""
)
folio_fiscal
=
resultado
[
"resultados"
]
and
resultado
[
"resultados"
][
"uuid"
]
or
""
codigo_timbrado
=
resultado
[
"status"
]
or
""
codigo_validacion
=
(
resultado
[
"resultados"
]
and
resultado
[
"resultados"
]
[
"status"
]
or
""
resultado
[
"resultados"
]
[
"status"
]
if
resultado
[
"resultados"
]
else
""
)
if
codigo_timbrado
in
[
"311"
,
"312"
]:
raise
pac_exceptions
.
PrimarySectorError
(
code
=
resultado
[
"codigo"
])
...
...
@@ -187,15 +189,14 @@ class ParamsPac(models.Model):
codigo_timbrado
==
"200"
and
codigo_validacion
==
"200"
or
codigo_validacion
==
"307"
):
# noqa
):
fecha_timbrado
=
resultado
[
"resultados"
][
"fechaTimbrado"
]
or
False
fecha_timbrado
=
(
fecha_timbrado
and
time
.
strftime
(
time
.
strftime
(
"%Y-%m-%d %H:%M:%S"
,
time
.
strptime
(
fecha_timbrado
[:
19
],
"%Y-%m-%dT%H:%M:%S"
),
)
or
False
if
fecha_timbrado
else
False
)
cfdi_data
=
{
"cfdi_xml"
:
base64
.
decodestring
(
...
...
@@ -372,4 +373,4 @@ class ParamsPac(models.Model):
elif
status_cancelacion
in
"702"
:
estado_cfdi
=
"No encontrado"
consult_answer
=
PacConsultAnswer
(
uuid
,
estado_cfdi
,
status_cancelacion
)
return
consult_answer
return
consult_answer
.
check_cancel_status
()
This diff is collapsed.
Click to expand it.
l10n_mx_params_pac/views/params_pac_view.xml
View file @
be416733
...
...
@@ -49,7 +49,7 @@
<field
name=
"name"
>
view.params.pac.tree
</field>
<field
name=
"model"
>
params.pac
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
string=
"Parameters PAC"
>
<tree>
<field
name=
"sequence"
widget=
"handle"
/>
<field
name=
"pac_type"
/>
<field
name=
"user"
/>
...
...
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