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
a691fd11
Commit
a691fd11
authored
6 years ago
by
Cuauhtémoc Díaz Minor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(l10n_mx_facturae): se agrega cron job que verifica las facturas en esperea de cancelacion
parent
f7542b47
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
1 deletion
+42
-1
l10n_mx_facturae/__openerp__.py
l10n_mx_facturae/__openerp__.py
+1
-0
l10n_mx_facturae/data/ir_cron.xml
l10n_mx_facturae/data/ir_cron.xml
+15
-0
l10n_mx_facturae/migrations/2.8.0/post-migration.py
l10n_mx_facturae/migrations/2.8.0/post-migration.py
+14
-1
l10n_mx_facturae/models/account_invoice.py
l10n_mx_facturae/models/account_invoice.py
+12
-0
No files found.
l10n_mx_facturae/__openerp__.py
View file @
a691fd11
...
...
@@ -26,6 +26,7 @@
'wizard/account_invoice_refund.xml'
,
'report/account_invoice.xml'
,
'report/account_voucher.xml'
,
'data/ir_cron.xml'
,
'data/email_template.xml'
,
'data/ir_attachment_facturae_config.xml'
,
],
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_facturae/data/ir_cron.xml
0 → 100644
View file @
a691fd11
<?xml version="1.0" encoding='UTF-8'?>
<openerp>
<data
noupdate=
"1"
>
<record
model=
"ir.cron"
id=
"ir_cron_invoices_pending_to_cancel"
>
<field
name=
"name"
>
Invoices pending to cancel
</field>
<field
name=
"interval_number"
>
2
</field>
<field
name=
"interval_type"
>
hours
</field>
<field
name=
"numbercall"
>
-1
</field>
<field
name=
"model"
eval=
"'account.invoice'"
/>
<field
name=
"function"
eval=
"'cron_invoices_pending_to_cancel'"
/>
<field
name=
"args"
eval=
"'(None,)'"
/>
<field
name=
"active"
eval=
"False"
/>
</record>
</data>
</openerp>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
l10n_mx_facturae/migrations/2.8.0/post-migration.py
View file @
a691fd11
# -*- coding: utf-8 -*-
import
logging
from
openupgradelib
import
openupgrade
as
tools
from
openerp
import
SUPERUSER_ID
_logger
=
logging
.
getLogger
(
__name__
)
def
compute_cfdi_id
(
env
):
_logger
.
info
(
"*****************START**********************"
)
_logger
.
info
(
"***********COMPUTE_CFDI_ID**************"
)
_logger
.
info
(
"*********************************************"
)
ir_attachment_mx_obj
=
env
[
'ir.attachment.facturae.mx'
]
invoices
=
env
[
'account.invoice'
].
search
(
[
(
'state'
,
'in'
,
[
'
signed'
,
'done
'
])
(
'state'
,
'in'
,
[
'
open'
,
'paid
'
])
]
)
_logger
.
info
(
"invoices to upgrade: "
+
str
(
len
(
invoices
)))
for
invoice
in
invoices
:
related_attachment
=
ir_attachment_mx_obj
.
search
(
[
...
...
@@ -23,8 +31,13 @@ def compute_cfdi_id(env):
)
if
related_attachment
:
invoice
.
cfdi_id
=
related_attachment
_logger
.
info
(
"******************END**********************"
)
_logger
.
info
(
"***********COMPUTE_CFDI_ID**************"
)
_logger
.
info
(
"*********************************************"
)
@
tools
.
migrate
(
use_env
=
True
,
uid
=
SUPERUSER_ID
)
def
migrate
(
env
,
installed_version
):
_logger
.
info
(
"INICIAMOS MIGRACION L10N_MX_FACTURAE"
)
compute_cfdi_id
(
env
)
_logger
.
info
(
"FINALIZAMOS MIGRACION"
)
This diff is collapsed.
Click to expand it.
l10n_mx_facturae/models/account_invoice.py
View file @
a691fd11
...
...
@@ -197,6 +197,18 @@ class AccountInvoice(models.Model):
state
=
fields
.
Selection
(
selection_add
=
[(
'waiting'
,
_
(
'To cancel'
))])
@
api
.
multi
def
cron_invoices_pending_to_cancel
(
self
):
_logger
.
info
(
'cron job'
)
# actionca_cancel()
invoices
=
self
.
env
[
'account.invoice'
].
search
(
[
(
'state'
,
'in'
,
[
'waiting'
])
]
)
_logger
.
info
(
invoices
)
for
invoice
in
invoices
:
invoice
.
action_cancel
()
@
api
.
one
@
api
.
depends
(
'state'
)
def
_compute_datetime
(
self
):
...
...
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