Mohit Beniwal a2b41824df [FIX] l10n_es_edi_facturae: handle ZeroDivisionError when discount value is 100
This traceback raises when user tries to 'Send & Print' the invoice of sale
order having a discount of 100%.

Steps to reproduce:
1) Install "l10n_es_edi_facturae" & "sale_management" and switch to "ES Company".
2) Open "Sales" >  "Configuration" > "Settings" and click on
   "Discounts" checkbox > "Save" button to activate it.
3) Now click on "Orders" > "Quotations" button and then "New" button .
4) Select any "Customer" and in "Order Lines" select a "product" with
  "Invoicing Policy" as 'Ordered quantities' (ex. 'Chair floor protection').
5) Now, in that 'Sale order line' enter the value of 'Disc.%' as '100' .
6) Click on "Confirm" button and then "Create Invoice" button.
7) In "Create Invoice" Wizard, select "Regular Invoice" if not >
  "Create Draft Invoice" button.
8) In "Customer Invoice", click on "Confirm" button > "Send & Print" button.
9) In "Configure your document layout" wizard, click on "Save" > "Send & Print".

Error: ZeroDivisionError: float division by zero, is generated from
"_l10n_es_edi_facturae_inv_lines_to_items"  method.

See: https://github.com/odoo/odoo/blob/b5c19d368339f9d2b7af6e61e88a918d6ba318ee/addons/l10n_es_edi_facturae/models/account_move.py#L195

It gets the value of "line.discount" as 100, so the overall value of
"(1 - line.discount / 100.0)" becomes Zero and it tries to  divide
"line.price_subtotal" by 'Zero', that's why this error is coming.

sentry-4325625223

closes odoo/odoo#131029

X-original-commit: 363e679601920f1a5a1fd6e1021521dae2a76714
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Mohit Beniwal (mobe) <mobe@odoo.com>
2023-08-16 16:05:06 +02:00
2023-08-14 20:24:57 +02:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%