diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2025-12-31 11:58:23 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2025-12-31 11:58:23 +0700 |
| commit | 7bd473f65b08d50152cc058385f681a60050e2d5 (patch) | |
| tree | eed961786cea70c827cc20985c69922000c6987c | |
| parent | fae46b2b4514a84a9ff4658b2f2fa68ea7c2c51a (diff) | |
| parent | ab57a15ea33846c97ab67295668c4f6d42c8be33 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into cr_renca_find
merge
| -rw-r--r-- | indoteknik_custom/models/purchasing_job.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 29928bbb..7a7e70b4 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -68,14 +68,24 @@ class PurchasingJob(models.Model): def _set_as_seen(self): - seen_model = self.env['purchasing.job.seen'] + Seen = self.env['purchasing.job.seen'] + for rec in self: - seen_model.create({ - 'user_id': self.env.user.id, - 'product_id': rec.product_id.id, - 'so_snapshot': rec.so_number, - }) + seen = Seen.search([ + ('product_id', '=', rec.product_id.id) + ], limit=1) + if seen: + seen.write({ + 'so_snapshot': rec.so_number, + 'seen_date': fields.Datetime.now(), + 'user_id': rec.env.user.id, }) + else: + Seen.create({ + 'user_id': self.env.user.id, + 'product_id': rec.product_id.id, + 'so_snapshot': rec.so_number, + }) rec.check_pj = True def unlink(self): |
