fix(post-migration 2.8.0): se corrige la busqueda de facturas

los estados de las facturas que nos interesan son: `paid` y `open`
parent a691fd11
......@@ -10,16 +10,14 @@ _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', ['open', 'paid'])
]
)
_logger.info("invoices to upgrade: " +str(len(invoices)))
_logger.info("invoices to set cfdi_id: " +str(len(invoices)))
for invoice in invoices:
related_attachment = ir_attachment_mx_obj.search(
[
......@@ -31,13 +29,9 @@ 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")
compute_cfdi_id(env)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment