diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-22 13:51:02 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-22 13:51:02 +0700 |
| commit | 4f73c6225571608e0fed6ee94ae0d2c91eaefd1a (patch) | |
| tree | f14b163f4793f1aee74d315557abc0cf27b83073 /indoteknik_custom/models | |
| parent | 7e52c025439a8614a1ec6ae77dfdda934989a09b (diff) | |
| parent | 230027f0bfedfedc27e5067d0b25d167f751688b (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into gudang-service
merge
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/price_group.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 5 | ||||
| -rw-r--r-- | indoteknik_custom/models/purchasing_job.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/purchasing_job_multi_update.py | 17 | ||||
| -rw-r--r-- | indoteknik_custom/models/purchasing_job_state.py | 3 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 2 |
6 files changed, 26 insertions, 9 deletions
diff --git a/indoteknik_custom/models/price_group.py b/indoteknik_custom/models/price_group.py index 1b1c817f..fce78fff 100644 --- a/indoteknik_custom/models/price_group.py +++ b/indoteknik_custom/models/price_group.py @@ -18,6 +18,8 @@ class PriceGroup(models.Model): group6 = fields.Float(string='Kelompok 6 (%)') group7 = fields.Float(string='Kelompok 7 (%)') group8 = fields.Float(string='Kelompok 8 (%)') + group9 = fields.Float(string='Kelompok 9 (%)') + group10 = fields.Float(string='Kelompok 10 (%)') def collect_price_group(self): PRICE_GROUP_ID = { @@ -47,4 +49,6 @@ class Manufacture(models.Model): ('group6', 'Kelompok 6'), ('group7', 'Kelompok 7'), ('group8', 'Kelompok 8'), + ('group9', 'Kelompok 9'), + ('group10', 'Kelompok 10'), ], string='Pricing Group', copy=False) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a114743f..35fa79a8 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1083,8 +1083,9 @@ class PurchaseOrder(models.Model): if '/PJ/' in self.name: price_change_detected = any(line.price_unit_before for line in self.order_line) if price_change_detected: - if self.total_percent_margin <= 15.0: - raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + if self.order_sales_match_line: + if self.total_percent_margin <= 15.0: + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") else: low_margin_match_so = self.order_sales_match_line.filtered( lambda match: match.so_header_margin <= 15.0 diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 7a7e70b4..e457b86c 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -24,7 +24,8 @@ class PurchasingJob(models.Model): ('apo', 'APO') ], string='APO?') purchase_representative_id = fields.Many2one('res.users', string="Purchase Representative", readonly=True) - note = fields.Char(string="Note Detail") + note = fields.Char(string="Note") + note_detail = fields.Text(string="Note Detail") date_po = fields.Datetime(string='Date PO', copy=False) so_number = fields.Text(string='SO Number', copy=False) check_pj = fields.Boolean(compute='_get_check_pj', string='Linked') @@ -126,6 +127,7 @@ class PurchasingJob(models.Model): pmp.action, max(pjs.status_apo::text) AS status_apo, max(pjs.note::text) AS note, + max(pjs.note_detail::text) AS note_detail, max(pjs.date_po::text) AS date_po, pmp.so_number, CASE diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py index 80a43e45..0eca499f 100644 --- a/indoteknik_custom/models/purchasing_job_multi_update.py +++ b/indoteknik_custom/models/purchasing_job_multi_update.py @@ -20,10 +20,19 @@ class PurchasingJobMultiUpdate(models.TransientModel): # purchasing_job_state.unlink() - purchasing_job_state.create({ - 'purchasing_job_id': product.id, - 'status_apo': 'apo', - }) + vals = { + 'purchasing_job_id': product.id, # Pastikan ID ini benar mapping ke ID produk + 'status_apo': 'apo', + } + + if purchasing_job_state: + purchasing_job_state.write(vals) + else: + purchasing_job_state.create(vals) + # purchasing_job_state.create({ + # 'purchasing_job_id': product.id, + # 'status_apo': 'apo', + # }) apo = self.env['automatic.purchase'].generate_regular_purchase(products) return { diff --git a/indoteknik_custom/models/purchasing_job_state.py b/indoteknik_custom/models/purchasing_job_state.py index d014edfe..ca557de1 100644 --- a/indoteknik_custom/models/purchasing_job_state.py +++ b/indoteknik_custom/models/purchasing_job_state.py @@ -14,5 +14,6 @@ class PurchasingJobState(models.Model): ('not_apo', 'Belum APO'), ('apo', 'APO') ], string='APO?', copy=False) - note = fields.Char(string="Note Detail", copy=False) + note = fields.Char(string="Note", copy=False) + note_detail = fields.Text(string="Note Detail", copy=False) date_po = fields.Datetime(string='Date PO', copy=False) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 17691798..9eed236f 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2305,7 +2305,7 @@ class SaleOrder(models.Model): search_bom = self.env['mrp.production'].search([('product_id', '=', line.product_id.id), ('sale_order', '=', order.id), ('state', '!=', 'cancel')], order='name desc') if search_bom: - confirmed_bom = search_bom.filtered(lambda x: x.state == 'confirmed' or x.state == 'done') + confirmed_bom = search_bom.filtered(lambda x: x.state in ['confirmed', 'to_close', 'progress', 'done']) if not confirmed_bom: raise UserError( "Product BOM belum dikonfirmasi di Manufacturing Orders. Silakan hubungi Purchasing.") |
