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/__manifest__.py | 1 + indoteknik_custom/models/purchase_order.py | 4 ++-- indoteknik_custom/models/purchasing_job.py | 18 +++++++++++++++++- indoteknik_custom/models/purchasing_job_state.py | 2 +- indoteknik_custom/views/purchasing_job.xml | 8 ++++++++ indoteknik_custom/views/purchasing_job_state.xml | 17 +++++++++++++++++ 6 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 indoteknik_custom/views/purchasing_job_state.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 95c52fc9..1bfaa722 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -120,6 +120,7 @@ 'views/role_permission/res_groups.xml', 'views/cust_commision.xml', 'views/stock_quant.xml', + 'views/purchasing_job_state.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index e572570e..8f107de1 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -53,8 +53,8 @@ class PurchaseOrder(models.Model): responsible_ids = fields.Many2many('res.users', string='Responsibles', compute='_compute_responsibles') status_paid_cbd = fields.Boolean(string='Paid Status', tracking=3, help='Field ini diisi secara manual oleh Finance AP dan hanya untuk status PO CBD') revisi_po = fields.Boolean(string='Revisi', tracking=3) - from_apo = fields.Boolean(string='From APO') - approval_edit_line = fields.Boolean(string='Approval Edit Line') + from_apo = fields.Boolean(string='From APO', tracking=3) + approval_edit_line = fields.Boolean(string='Approval Edit Line', tracking=3) def approve_edit_line(self): if self.env.user.is_purchasing_manager: 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 ( diff --git a/indoteknik_custom/models/purchasing_job_state.py b/indoteknik_custom/models/purchasing_job_state.py index 57fd3db2..1838a496 100644 --- a/indoteknik_custom/models/purchasing_job_state.py +++ b/indoteknik_custom/models/purchasing_job_state.py @@ -14,4 +14,4 @@ class PurchasingJobState(models.Model): ('not_apo', 'Belum APO'), ('apo', 'APO') ], string='APO?', copy=False) - + note = fields.Char(string="Note Detail") diff --git a/indoteknik_custom/views/purchasing_job.xml b/indoteknik_custom/views/purchasing_job.xml index bad4b938..8f9be1de 100644 --- a/indoteknik_custom/views/purchasing_job.xml +++ b/indoteknik_custom/views/purchasing_job.xml @@ -16,6 +16,7 @@ + @@ -25,6 +26,12 @@ v.purchasing.job
+
+
@@ -39,6 +46,7 @@ + diff --git a/indoteknik_custom/views/purchasing_job_state.xml b/indoteknik_custom/views/purchasing_job_state.xml new file mode 100644 index 00000000..c7c40020 --- /dev/null +++ b/indoteknik_custom/views/purchasing_job_state.xml @@ -0,0 +1,17 @@ + + + + purchasing.job.state.form + purchasing.job.state + + + + + + + + + + + +
\ No newline at end of file -- cgit v1.2.3