Skip to content

Commit

Permalink
[REF] sale_order_type_automation: error due to non-existent fields in…
Browse files Browse the repository at this point in the history
… v17

closes #916

Signed-off-by: matiasperalta1 <[email protected]>
  • Loading branch information
lef-adhoc committed Sep 2, 2024
1 parent beb4790 commit e8941d7
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions sale_order_type_automation/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')\
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e8941d7

Please sign in to comment.