From b559bcdf167ba24cbbcf978461fb774e8eda2f07 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 2 Apr 2024 15:04:29 +0700 Subject: add note on purchasing job --- indoteknik_custom/models/purchasing_job.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/purchasing_job.py') diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index a4cb3893..1bbf68e3 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -24,6 +24,21 @@ class PurchasingJob(models.Model): ('apo', 'APO') ], string='APO?') purchase_representative_id = fields.Many2one('res.users', string="Purchase Representative", readonly=True, compute='compute_purchase_representative') + note = fields.Char(string="Note Detail") + + def redirect_to_pjs(self): + states = self.env['purchasing.job.state'].search([ + ('purchasing_job_id', '=', self.id), + ],limit=1, order='id desc') + + return { + 'name': _('Purchasing Job State'), + 'view_mode': 'form', + 'res_model': 'purchasing.job.state', + 'target': 'new', + 'type': 'ir.actions.act_window', + 'res_id': states.id, + } def compute_purchase_representative(self): for rec in self: @@ -54,7 +69,8 @@ class PurchasingJob(models.Model): MAX(pmp.incoming) AS incoming, MAX(pmp.outgoing) AS outgoing, pmp.action, - MAX(pjs.status_apo) AS status_apo + MAX(pjs.status_apo) AS status_apo, + MAX(pjs.note) AS note FROM v_procurement_monitoring_by_product pmp LEFT JOIN purchasing_job_state pjs ON pjs.purchasing_job_id = pmp.product_id LEFT JOIN ( -- cgit v1.2.3