diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-10-13 15:38:18 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-10-13 15:38:18 +0700 |
| commit | a00faa739bdbd8d7750728bdfdc3926b9bf446e2 (patch) | |
| tree | 7ab393e527a66f5ff87181409236e78c061895c2 /indoteknik_custom/models/sale_monitoring.py | |
| parent | 48e5f880d0587964c15c88827ba21cf932928a44 (diff) | |
sale monitoring upgrade
Diffstat (limited to 'indoteknik_custom/models/sale_monitoring.py')
| -rwxr-xr-x | indoteknik_custom/models/sale_monitoring.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py index ad15e0c2..cac68b7c 100755 --- a/indoteknik_custom/models/sale_monitoring.py +++ b/indoteknik_custom/models/sale_monitoring.py @@ -21,12 +21,44 @@ class SaleMonitoring(models.Model): status = fields.Char(string="Status") po_number = fields.Char(string="PO Number") qty_reserved = fields.Integer(string="Qty Reserved") - note = fields.Char(string="Note", compute='compute_note') + note_so_line = fields.Selection([ + ('eta', 'ETA'), + ('info_sales', 'Info Sales'), + ('info_vendor', 'Info Vendor'), + ('penggabungan', 'Penggabungan'), + ], string="Note", compute='compute_note') + note = fields.Char(string="Note Detail", compute='compute_note_detail') + purchase_representative_id = fields.Many2one('res.users', string="Purchase Representative", readonly=True, compute='compute_purchase_representative') + + def compute_purchase_representative(self): + for sale in self: + po = self.env['purchase.order'].search([ + ('sale_order_id', '=', sale.sale_order_id.id), + ('user_id', '!=', False) + ]) + + user_id = False + + if po: + user_id = po[0].user_id + + sale.purchase_representative_id = user_id def compute_note(self): for sale in self: lines = self.env['sale.order.line'].search([ ('order_id', '=', sale.sale_order_id.id), + ('note', '!=', False) + ]) + + note = ', '.join(lines.mapped('note') or ['']) + + sale.note_so_line = note + + def compute_note_detail(self): + for sale in self: + lines = self.env['sale.order.line'].search([ + ('order_id', '=', sale.sale_order_id.id), ('note_procurement', '!=', False) ]) |
