diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-07 16:20:15 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-07 16:20:15 +0700 |
| commit | 8c8cc93b60dfef60342ccd47b440f702bc18c754 (patch) | |
| tree | 16e384d5ef6bfa08323e6e8366b0ddfac2ddbe85 /indoteknik_custom/models/automatic_purchase.py | |
| parent | 71a780abc391d11c2fe2ea16a953eefd2ff74219 (diff) | |
change trigger unlink note pj and add validation fill sj return date
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index d619e160..ddb4a973 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -67,6 +67,15 @@ class AutomaticPurchase(models.Model): if count > 0: raise UserError('Ada sekitar %s SO Yang sudah create PO, berikut SO nya: %s' % (count, ', '.join(names))) + + def unlink_note_pj(self): + product = self.purchase_lines.mapped('product_id') + pj_state = self.env['purchasing.job.state'].search([ + ('purchasing_job_id', 'in', product.ids) + ]) + + for line in pj_state: + line.unlink() def create_po_from_automatic_purchase(self): if not self.purchase_lines: @@ -75,6 +84,7 @@ class AutomaticPurchase(models.Model): raise UserError('Sudah pernah di create PO') current_time = datetime.now() + self.unlink_note_pj() vendor_ids = self.env['automatic.purchase.line'].read_group( [('automatic_purchase_id', '=', self.id), ('partner_id', '!=', False)], fields=['partner_id'], |
