diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-22 20:35:07 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-22 20:35:07 +0700 |
| commit | bf1171579f04b102b289e26c426034b2b4458839 (patch) | |
| tree | 672de3eaed3736b934a6c4b7ac0286bb9064326e | |
| parent | 158c89a5048669f46d561aef3505042cc8c68a37 (diff) | |
<miqdad> sequence so
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 2aaadecf..63c8c27e 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -302,12 +302,7 @@ class TukarGuling(models.Model): def create(self, vals): # Generate sequence number if not vals.get('name') or vals['name'] == 'New': - sequence = self.env['ir.sequence'].search([('code', '=', 'tukar.guling')], limit=1) - if sequence: - vals['name'] = sequence.next_by_id() - else: - # Fallback jika sequence belum dibuat - vals['name'] = self.env['ir.sequence'].next_by_code('tukar.guling') or 'PTG-00001' + vals['name'] = self.env['ir.sequence'].next_by_code('tukar.guling') # Auto-fill origin from operations if not vals.get('origin') and vals.get('operations'): @@ -318,7 +313,7 @@ class TukarGuling(models.Model): vals['partner_id'] = picking.partner_id.id res = super(TukarGuling, self).create(vals) - res.message_post(body=_("CCM Created By %s" ) % self.env.user.name) + res.message_post(body=_("CCM Created By %s") % self.env.user.name) return res def copy(self, default=None): |
