summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-04-03 10:18:17 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-04-03 10:18:17 +0700
commit357c51e9d3f73831d7b565ac8e1beb83430931ef (patch)
tree43fe552bd323e33c83d6d1b19e491a6b8e589acd
parent125372895285b3638a8ca03b79d5e5413b1d3c11 (diff)
final fix error
-rw-r--r--indoteknik_custom/models/automatic_purchase.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index c35e3997..4a892b05 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -20,7 +20,7 @@ class AutomaticPurchase(models.Model):
is_po = fields.Boolean(string='Is PO')
purchase_match = fields.One2many('automatic.purchase.match', 'automatic_purchase_id', string='PO Matches', auto_join=True)
vendor_id = fields.Many2one('res.partner', string='Vendor', help='boleh kosong, jika diisi, maka hanya keluar data untuk vendor tersebut')
- responsible_id = fields.Many2one('res.users', string='Responsible', readonly=True)
+ responsible_id = fields.Many2one('res.users', string='Responsible')
apo_type = fields.Selection([
('regular', 'Regular Fulfill SO'),
('reordering', 'Reordering Rule'),
@@ -30,11 +30,11 @@ class AutomaticPurchase(models.Model):
total_qty_line = fields.Float(string='Total Qty Line', compute='_compute_total_qty')
total_qty_so = fields.Float(string='Total Qty SO', compute='_compute_total_qty')
- @api.onchange('apo_type')
+ @api.constrains('apo_type')
def onchange_apo_type(self):
if self.apo_type == 'reordering':
self.responsible_id = 19
- else:
+ elif self.apo_type == 'regular':
self.responsible_id = self.env.user.id
def _compute_total_qty(self):