diff --git a/sale_gathering/models/sale_order.py b/sale_gathering/models/sale_order.py index 1703739ca..2696b10fa 100644 --- a/sale_gathering/models/sale_order.py +++ b/sale_gathering/models/sale_order.py @@ -55,13 +55,12 @@ def _compute_gathering_balance(self): def _get_invoiceable_lines(self, final=False): """Return the invoiceable lines for order `self`.""" invoiceable_lines = super()._get_invoiceable_lines(final=final) - for rec in self.filtered(lambda x: x.is_gathering and x.gathering_balance > 0.0): + product_precision_digits = self.env['decimal.precision'].precision_get('Product Price') + for rec in self.filtered(lambda x: x.is_gathering and float_compare(x.gathering_balance, 0.0, precision_digits=product_precision_digits) >= 0): for line in rec.order_line.filtered('is_downpayment'): if final: invoiceable_lines |= line - invoiceable_lines = invoiceable_lines.filtered( - lambda line: line.display_type not in ['line_section', 'line_note'] - ) + invoiceable_lines = invoiceable_lines.filtered(lambda line: line.display_type not in ['line_section', 'line_note']) return invoiceable_lines @api.constrains('is_gathering', 'amount_total')