[FIX] sale_timesheet: prevent certain selection options

Steps:
- Open sales.
- Go to products.
- Create a new product.
- Keep the 'Can be sold' option unchecked.

Issue:
- If a product is not sellable then the user should not be able to create
invoicing policy 'Based on Timesheets' or 'Based on Milestones'.

Fix:
- We are raising the user error 'This option is only for sellable products.'
when a user tries to select any of these two options.

task-3378532

closes odoo/odoo#145631

X-original-commit: 94982163f81175c9d2d670dc28704a716696604f
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Aman Patel
2023-12-11 08:29:22 +00:00
committed by kcv-odoo
parent 74c80cee6c
commit 8495dced7f
+2 -2
View File
@@ -7,10 +7,10 @@
<field name="inherit_id" ref="sale.product_template_form_view"/>
<field name="arch" type="xml">
<field name="invoice_policy" position="attributes">
<attribute name="invisible">type == 'service'</attribute>
<attribute name="invisible">type == 'service' and sale_ok == True</attribute>
</field>
<field name="invoice_policy" position="after">
<field name="service_policy" string="Invoicing Policy" invisible="type != 'service'" required="type == 'service'"/>
<field name="service_policy" string="Invoicing Policy" invisible="type != 'service' or sale_ok == False" required="type == 'service' and sale_ok == True"/>
<field name="service_tracking" required="1" invisible="type != 'service' or not sale_ok"/>
<div class="o_td_label d-inline-flex" invisible="service_tracking != 'task_global_project'">
<label for='project_id'/>