From e3875c149ba913582a3fe28a31003e8332a7893e Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 3 Apr 2024 09:52:05 +0700 Subject: add filter user_id and fix responsible on automatic purchase --- indoteknik_custom/models/automatic_purchase.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indoteknik_custom/models/automatic_purchase.py') diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 2e080bcf..9b5cd01d 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -30,6 +30,13 @@ 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') + def onchange_apo_type(self): + if self.apo_type == 'reordering': + self.responsible_id = 19 + else: + self.responsible_id = self.env.user.id + def _compute_total_qty(self): for data in self: qty_line = qty_so = 0 -- cgit v1.2.3