ix direct

This commit is contained in:
eslamabady 2024-07-24 19:04:51 +03:00
parent 74eddde805
commit 1fd032ba8a
6 changed files with 2 additions and 2 deletions

View File

@ -42,8 +42,8 @@ class PurchaseRequest(models.Model):
raise ValidationError(_("Can't Confirm Request With No Item!"))
if not self.department_id:
raise ValidationError(_("Please Select department for employee"))
direct_manager = self.sudo().employee_id.department_id.manager_id
if direct_manager and self.env.user.id != direct_manager.id:
direct_manager = self.sudo().department_id.manager_id
if direct_manager and direct_manager.user_id and self.env.user.id != direct_manager.user_id.id:
raise ValidationError(_("You should be The Direct Manager"))
if any(self.line_ids.filtered(lambda line: line.product_id.type == "product")):
self.write({'state': 'warehouse'})