alsh-odoo 4c54dde9e0 [FIX] sale_timesheet: handle error of giving default value if no sale order line
This traceback raises when user changes the product type to 'consumable' in a
sale order and clicks the 'recorded' stat button.

To reproduce this issue:

1) Install 'sale_timesheet'
2) Create a new 'sale order'
3) Select any customer > Select a product with the 'service' type.
4) Click Confirm, then proceed to click the Create Project button.
5) Give any name to the project > Return to that sale order.
6) Now a 'recorded' stat button is visible > Click on that and create a record.
7) Return to that sale order > Go to the order lines, and for the previously
   selected product, change the product type to 'consumable'
8) Once again, go to that 'sale order' and click on the 'recorded' stat button.

Error: "StopIteration: null"

[1] On the 'action_view_timesheet' method 'default_sale_line' variable is
getting a record with a condition of 'sale.order.line' is_service must be true
and 'service_policy' in 'order_prepaid' or 'delivered_timesheet' .

[2] But 'is_service' is getting value through a compute method in which
product type is equal to 'service'.

Because the user changed the type to 'consumable', the iteration ends with no
records and there is no default value. So it leads to the above traceback.

[1]
https://github.com/odoo/odoo/blob/69fca30bb4fb66e6d979ce5ddc1bff4db963ca71/addons/sale_timesheet/models/sale_order.py#L105-L111

[2]
https://github.com/odoo/odoo/blob/69fca30bb4fb66e6d979ce5ddc1bff4db963ca71/addons/sale_service/models/sale_order_line.py#L18-L20

sentry-4396433586

closes odoo/odoo#133903

X-original-commit: 062cec2175e5b22126b5c3be5acef5039ca1e804
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-09-04 08:03:39 +00:00
2023-09-01 15:09:51 +00:00
2023-09-01 13:21:00 +00: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%