[REV] sale_timesheet_margin: disables onchanges on service products

Revert
"[FIX] sale_timesheet_margin: prevent cost override on product service"

This reverts commit e260a97392e698c88741be713a6b8cc2dc3c74a1.

After discussing with thcl-odoo, it was determined that it is better to
revert this commit as it is affecting all service products.
Also the desired behavior is that users should change the cost on
the product form not on Sales Orders

OPW-2857506

closes odoo/odoo#96189

X-original-commit: 143f1d4766fb7d718c5262cfcb062e2039549dd3
Related: odoo/enterprise#29577
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
momegahed
2022-07-18 19:55:27 +02:00
parent 119ad2fb7b
commit d4b14f7c56
@@ -8,10 +8,9 @@ class SaleOrderLine(models.Model):
@api.depends('analytic_line_ids.amount', 'qty_delivered_method')
def _compute_purchase_price(self):
timesheet_sols = self.filtered(
lambda sol: sol.qty_delivered_method == 'timesheet' and not sol.product_id.standard_price and not sol.product_id.service_policy == 'ordered_prepaid'
lambda sol: sol.qty_delivered_method == 'timesheet' and not sol.product_id.standard_price
)
already_computed_service = self.filtered(lambda sol: sol.create_date is not False and sol.product_id.service_policy == 'ordered_prepaid')
super(SaleOrderLine, self - timesheet_sols - already_computed_service)._compute_purchase_price()
super(SaleOrderLine, self - timesheet_sols)._compute_purchase_price()
if timesheet_sols:
group_amount = self.env['account.analytic.line'].read_group(
[('so_line', 'in', timesheet_sols.ids), ('project_id', '!=', False)],