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
db12b2ea
Commit
db12b2ea
authored
1 year ago
by
Noe Fernando Izquierdo Hernandez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix_8_0_3_6_3'
parents
106da622
a0ef3106
Pipeline
#21338
failed with stage
in 44 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
43 deletions
+52
-43
CHANGES.md
CHANGES.md
+10
-0
l10n_mx_facturae/migrations/3.5.0/post-migration.py
l10n_mx_facturae/migrations/3.5.0/post-migration.py
+42
-40
l10n_mx_facturae/models/account_invoice.py
l10n_mx_facturae/models/account_invoice.py
+0
-3
No files found.
CHANGES.md
View file @
db12b2ea
<a
name=
"8.0.3.6.3"
></a>
## 8.0.3.6.3 (2023-10-11)
#### Bug Fixes
*
**account.invoice:**
se corrige migración para soporta el cambio del campo cfdi_fiscal_regime_id (
[
78393b60
](
78393b60
)
)
<a
name=
"8.0.3.6.2"
></a>
## 8.0.3.6.2 (2023-09-12)
...
...
This diff is collapsed.
Click to expand it.
l10n_mx_facturae/migrations/3.5.0/post-migration.py
View file @
db12b2ea
...
...
@@ -7,48 +7,50 @@ from openerp import SUPERUSER_ID
@
tools
.
migrate
(
use_env
=
True
,
uid
=
SUPERUSER_ID
)
def
migrate
(
env
,
installed_version
):
tools
.
logged_query
(
env
.
cr
,
"""
WITH account_regimen_code as (
SELECT
ai.id AS invoice_id,
fr.id AS fiscal_regime_id
FROM account_invoice as ai
LEFT JOIN account_fiscal_position as afp ON afp.id = ai.fiscal_position
LEFT JOIN cfdi_fiscal_regime AS fr ON afp.code = fr.code
WHERE afp.code in (
'601','603','605','606','607','608','609','610','611','612','614',
'615','616','620','621','622','623','624','628','629','630'
legacy_name
=
tools
.
get_legacy_name
(
"cfdi_fiscal_regime_id"
)
if
tools
.
column_exists
(
env
.
cr
,
"account_invoice"
,
legacy_name
):
tools
.
logged_query
(
env
.
cr
,
"""
WITH account_regimen_code as (
SELECT
ai.id AS invoice_id,
fr.id AS fiscal_regime_id
FROM account_invoice as ai
LEFT JOIN account_fiscal_position as afp ON afp.id = ai.fiscal_position
LEFT JOIN cfdi_fiscal_regime AS fr ON afp.code = fr.code
WHERE afp.code in (
'601','603','605','606','607','608','609','610','611','612','614',
'615','616','620','621','622','623','624','628','629','630'
)
)
)
UPDATE account_invoice AS ai
SET cfdi_fiscal_regime_id=fr.fiscal_regime_id
FROM account_regimen_code AS fr
WHERE ai.id=fr.invoice_id
"""
,
)
UPDATE account_invoice AS ai
SET cfdi_fiscal_regime_id=fr.fiscal_regime_id
FROM account_regimen_code AS fr
WHERE ai.id=fr.invoice_id
"""
,
)
tools
.
logged_query
(
env
.
cr
,
"""
WITH account_regimen_code as (
SELECT
ai.id AS invoice_id,
fr.id AS fiscal_regime_id
FROM account_invoice as ai
LEFT JOIN account_fiscal_position as afp ON afp.id = ai.fiscal_position
LEFT JOIN cfdi_fiscal_regime AS fr ON afp.code = fr.code
WHERE afp.code in (
'601','603','605','606','607','608','609','610','611','612','614',
'615','616','620','621','622','623','624','628','629','630'
tools
.
logged_query
(
env
.
cr
,
"""
WITH account_regimen_code as (
SELECT
ai.id AS invoice_id,
fr.id AS fiscal_regime_id
FROM account_invoice as ai
LEFT JOIN account_fiscal_position as afp ON afp.id = ai.fiscal_position
LEFT JOIN cfdi_fiscal_regime AS fr ON afp.code = fr.code
WHERE afp.code in (
'601','603','605','606','607','608','609','610','611','612','614',
'615','616','620','621','622','623','624','628','629','630'
)
)
)
UPDATE account_invoice AS ai
SET fiscal_position=Null
FROM account_regimen_code AS fr
WHERE ai.id=fr.invoice_id
"""
,
)
UPDATE account_invoice AS ai
SET fiscal_position=Null
FROM account_regimen_code AS fr
WHERE ai.id=fr.invoice_id
"""
,
)
This diff is collapsed.
Click to expand it.
l10n_mx_facturae/models/account_invoice.py
View file @
db12b2ea
...
...
@@ -274,8 +274,6 @@ class AccountInvoice(models.Model):
for
invoice
in
self
.
filtered
(
lambda
i
:
i
.
type
in
(
"out_invoice"
,
"out_refund"
)):
partner
=
invoice
.
partner_id
if
partner
:
if
partner
.
cfdi_fiscal_regime_id
.
id
:
invoice
.
cfdi_fiscal_regime_id
=
partner
.
cfdi_fiscal_regime_id
.
id
if
partner
.
cfdi_use
.
id
:
invoice
.
cfdi_use
=
partner
.
cfdi_use
.
id
invoice
.
payment_method_id
=
partner
.
payment_method_id
.
id
...
...
@@ -402,7 +400,6 @@ class AccountInvoice(models.Model):
[
"cfdi_use"
,
"partner_id"
,
"cfdi_fiscal_regime_id"
,
"payment_type_ids"
,
"address_issued_id"
,
"journal_id"
,
...
...
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