diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-16 07:56:51 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-16 07:56:51 +0700 |
| commit | 402085ff18942c21d1a61eb02f16497c845694b5 (patch) | |
| tree | c127f24e30b66569782f220ce9b631b5e9d871ce | |
| parent | 2f5e84a3f735fd80aa7dad4365db372e872127d7 (diff) | |
<miqdad> validation
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 4f27afde..27d4d954 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -55,6 +55,13 @@ class TukarGuling(models.Model): } } + @api.constrains('return_type', 'in_num', 'out_num') + def _check_bu_required_for_tukar_guling(self): + for record in self: + if record.return_type == 'tukar_guling': + if not record.in_num and not record.out_num: + raise ValidationError("Untuk Tukar Guling, isi salah satu: BU/In atau BU/Out.") + @api.constrains('line_ids', 'state') def _check_product_lines(self): """Constraint: Product lines harus ada jika state bukan draft""" |
