diff --git a/l10n_pt_stock_invoicexpress/models/stock_picking.py b/l10n_pt_stock_invoicexpress/models/stock_picking.py index 21698ba2..5b08e3d2 100644 --- a/l10n_pt_stock_invoicexpress/models/stock_picking.py +++ b/l10n_pt_stock_invoicexpress/models/stock_picking.py @@ -103,8 +103,10 @@ def _compute_invoicexpress_doc_type(self): def _send_confirmation_email(self): # Only send Delivery emails if the InvoiceXpress checkbox is selected - to_send = self.filtered("invoicexpress_send_email") - super(StockPicking, to_send)._send_confirmation_email() + dont_send = self.filtered( + lambda x: x.can_invoicexpress and not x.invoicexpress_send_email + ) + super(StockPicking, self - dont_send)._send_confirmation_email() @api.model def _get_invoicexpress_prefix(self, doctype):