commit
99610b9573
|
|
@ -857,3 +857,14 @@ msgstr "بيانات بنود الطلب المتأخر"
|
|||
#: model:ir.model.fields,field_description:odex25_purchase_coc.field_purchase_coc_partial_wizard__create_backorder
|
||||
msgid "Create Backorder?"
|
||||
msgstr "إنشاء طلب متأخر؟"
|
||||
|
||||
#. module: odex25_purchase_coc
|
||||
#: code:addons/odex25_purchase_coc/models/new_models.py:0
|
||||
#: code:addons/odex25_purchase_coc/models/new_models.py:0
|
||||
#: code:addons/odex25_purchase_coc/models/new_models.py:0
|
||||
#: code:addons/odex25_purchase_coc/models/new_models.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Sorry, you are not allowed to Confirm this CoC.\n"
|
||||
"Allowed user: %s"
|
||||
msgstr "عذرًا، غير مسموح لك بتأكيد شهادة المطابقة (CoC).\nالمستخدم المسموح له: %s"
|
||||
|
|
|
|||
|
|
@ -353,10 +353,17 @@ class PurchaseCoC(models.Model):
|
|||
for rec in self:
|
||||
request = rec.po_id.request_id
|
||||
if request:
|
||||
if request.employee_id.parent_id.user_id.id != user.id:
|
||||
raise ValidationError(_('Sorry You are not allowed to Confirm this CoC.'))
|
||||
if request.employee_id.user_id.id != user.id:
|
||||
allowed_name = request.employee_id.name
|
||||
raise ValidationError(
|
||||
_('Sorry, you are not allowed to Confirm this CoC.\nAllowed user: %s') % allowed_name
|
||||
)
|
||||
else:
|
||||
pass
|
||||
if rec.po_id.department_id.manager_id.user_id.id != user.id:
|
||||
allowed_name = rec.po_id.department_id.manager_id.name
|
||||
raise ValidationError(
|
||||
_('Sorry, you are not allowed to Confirm this CoC.\nAllowed user: %s') % allowed_name
|
||||
)
|
||||
|
||||
if not any(line.qty_to_receive > 0 for line in rec.coc_line_ids):
|
||||
raise ValidationError(_('You must receive at least one product before confirmation.'))
|
||||
|
|
@ -397,6 +404,21 @@ class PurchaseCoC(models.Model):
|
|||
po = self.po_id.sudo()
|
||||
request = po.request_id
|
||||
|
||||
if request:
|
||||
coach_user = request.employee_id.sudo().coach_id.user_id
|
||||
allowed_name = coach_user.name
|
||||
if coach_user.id != user.id:
|
||||
raise ValidationError(
|
||||
_('Sorry, you are not allowed to Confirm this CoC.\nAllowed user: %s') % allowed_name
|
||||
)
|
||||
else:
|
||||
dept_manager = self.po_id.department_id.manager_id.sudo()
|
||||
coach_user = dept_manager.coach_id.user_id
|
||||
allowed_name = coach_user.name
|
||||
if coach_user.id != user.id:
|
||||
raise ValidationError(
|
||||
_('Sorry, you are not allowed to Confirm this CoC.\nAllowed user: %s') % allowed_name
|
||||
)
|
||||
|
||||
if not any(line.qty_to_receive > 0 for line in self.coc_line_ids):
|
||||
raise ValidationError(_('You must receive at least one product before approval.'))
|
||||
|
|
|
|||
Loading…
Reference in New Issue