diff options
| -rw-r--r-- | indoteknik_custom/models/upah_harian_office.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/indoteknik_custom/models/upah_harian_office.py b/indoteknik_custom/models/upah_harian_office.py index 17db4a92..46b79fef 100644 --- a/indoteknik_custom/models/upah_harian_office.py +++ b/indoteknik_custom/models/upah_harian_office.py @@ -1,5 +1,6 @@ from odoo import models, fields, api from odoo.exceptions import UserError, ValidationError +from odoo.osv import expression class UpahHarian(models.Model): _name = 'upah.harian' @@ -238,6 +239,23 @@ class UpahHarian(models.Model): if rec.attachment_file_image or rec.attachment_file_pdf: raise ValidationError("Only Finance can upload attachment.") + # Restrictions + def _search(self, domain, offset=0, limit=None, order=None, count=False, access_rights_uid=None): + + if self.env.user.harian: + domain = expression.AND([ + domain, + [('pemohon', '=', self.env.user.id)] + ]) + + return super()._search( + domain, + offset=offset, + limit=limit, + order=order, + count=count, + access_rights_uid=access_rights_uid + ) class UpahHarianLine(models.Model): _name = 'upah.harian.line' |
