[FIX] sale_project: fixed traceback on SO stat button in project update

Step to Reproduce :
-> Create product: Project & task
-> Create SO > Add product > Confirm it
-> Go to Newly created project > Project update > Sales order
-> Click on the project stat button > again go to project status > Sales Order
-> Crash it

Before these commit:
-> Clicking on so stat button in project update caused a traceback error that
null value is not defined.
-> When we are passing the context It was observed that create key
has null value in that context.
-> In sale_project if create_for_project_id has a null value then create key
also have null value.

After these commit:
-> So if we set False in the context, If we get null value of create key
it is set to False.

task- 3586341

closes odoo/odoo#157170

X-original-commit: 26d4c86ca1f8186811275cf6d001ef7105a07776
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
rupa-odoo
2024-03-09 07:04:04 +00:00
parent 37d797f6d6
commit 0db96b6d27
+1 -1
View File
@@ -153,7 +153,7 @@ class Project(models.Model):
"type": "ir.actions.act_window",
"res_model": "sale.order",
'name': _("%(name)s's Sales Orders", name=self.name),
"context": {"create": self.env.context.get('create_for_project_id'), "show_sale": True},
"context": {"create": self.env.context.get('create_for_project_id', False), "show_sale": True},
}
if len(all_sale_orders) <= 1:
action_window.update({