From e8941d7291165b0f57fa0acd1a811070a45f74ae Mon Sep 17 00:00:00 2001 From: Franco Leyes Date: Fri, 30 Aug 2024 13:40:13 +0000 Subject: [PATCH] [REF] sale_order_type_automation: error due to non-existent fields in v17 closes ingadhoc/sale#916 Signed-off-by: matiasperalta1 --- sale_order_type_automation/models/sale_order.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sale_order_type_automation/models/sale_order.py b/sale_order_type_automation/models/sale_order.py index 156b4b9fb..438d75890 100644 --- a/sale_order_type_automation/models/sale_order.py +++ b/sale_order_type_automation/models/sale_order.py @@ -14,15 +14,11 @@ class SaleOrder(models.Model): def run_invoicing_atomation(self): for rec in self.filtered( - lambda x: x.type_id.invoicing_atomation and - x.type_id.invoicing_atomation != 'none'): - # we add this check just because if we call - # _create_invoices and nothing to invoice, it raise - # an error - if not any( - line.qty_to_invoice for line in rec.order_line): - _logger.info('Nothing to invoice') - continue + lambda x: ( + x.type_id.invoicing_atomation != 'none' and + any(line.qty_to_invoice for line in x.order_line) + ) + ): # we take into account if there are any transaction finish from the e-commerce # and not continue with the automation in this case if self.transaction_ids and self.env['ir.config_parameter'].sudo().get_param('sale.automatic_invoice')\ @@ -96,7 +92,7 @@ def run_picking_atomation(self): ' force availability.\nProducts:\n* %s\n ' ) % ('\n *'.join(x.name for x in products))) for op in pick.mapped('move_line_ids'): - op.qty_done = op.reserved_uom_qty + op.quantity = op.quantity_product_uom pick.button_validate() # append action records to print the reports of the pickings # involves