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
f7542b47
Commit
f7542b47
authored
6 years ago
by
Cuauhtémoc Díaz Minor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(migrations): se agrego post-migration en la version 2.8.0
parent
570c8701
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
l10n_mx_facturae/migrations/2.8.0/post-migration.py
l10n_mx_facturae/migrations/2.8.0/post-migration.py
+30
-0
No files found.
l10n_mx_facturae/migrations/2.8.0/post-migration.py
0 → 100644
View file @
f7542b47
# -*- coding: utf-8 -*-
from
openupgradelib
import
openupgrade
as
tools
from
openerp
import
SUPERUSER_ID
def
compute_cfdi_id
(
env
):
ir_attachment_mx_obj
=
env
[
'ir.attachment.facturae.mx'
]
invoices
=
env
[
'account.invoice'
].
search
(
[
(
'state'
,
'in'
,
[
'signed'
,
'done'
])
]
)
for
invoice
in
invoices
:
related_attachment
=
ir_attachment_mx_obj
.
search
(
[
(
'res_id'
,
'='
,
invoice
.
id
),
(
'type_attachment'
,
'='
,
'account.invoice'
),
(
'company_id'
,
'='
,
invoice
.
company_id
.
id
),
(
'state'
,
'in'
,
[
'signed'
,
'done'
]),
],
)
if
related_attachment
:
invoice
.
cfdi_id
=
related_attachment
@
tools
.
migrate
(
use_env
=
True
,
uid
=
SUPERUSER_ID
)
def
migrate
(
env
,
installed_version
):
compute_cfdi_id
(
env
)
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