diff options
| -rw-r--r-- | indoteknik_custom/models/account_payment.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/partial_delivery.py | 10 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 30 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/apache_solr_queue.xml | 2 |
7 files changed, 33 insertions, 21 deletions
diff --git a/indoteknik_custom/models/account_payment.py b/indoteknik_custom/models/account_payment.py index 11c664eb..d2d3d175 100644 --- a/indoteknik_custom/models/account_payment.py +++ b/indoteknik_custom/models/account_payment.py @@ -42,7 +42,7 @@ class AccountPayment(models.Model): def allocate_invoices(self): for payment in self: - if self. + # if self. for line in payment.payment_line: invoice = line.account_move_id move_lines = payment.line_ids.filtered(lambda line: line.account_internal_type in ('receivable', 'payable')) diff --git a/indoteknik_custom/models/partial_delivery.py b/indoteknik_custom/models/partial_delivery.py index 4df7da1e..744db325 100644 --- a/indoteknik_custom/models/partial_delivery.py +++ b/indoteknik_custom/models/partial_delivery.py @@ -172,9 +172,11 @@ class PartialDeliveryWizard(models.TransientModel): for line in selected_lines: if line.selected_qty > line.reserved_qty: raise UserError(_("Jumlah produk %s yang dipilih melebihi jumlah reserved.") % line.product_id.display_name) + move = line.move_id move._do_unreserve() + # 🔹 Kalau cuma selected tanpa qty → anggap kirim semua reserved qty if line.selected and not line.selected_qty: line.selected_qty = line.reserved_qty @@ -186,12 +188,20 @@ class PartialDeliveryWizard(models.TransientModel): if line.selected_qty < move.product_uom_qty: qty_to_keep = move.product_uom_qty - line.selected_qty + new_move = move.copy(default={ 'product_uom_qty': line.selected_qty, 'picking_id': new_picking.id, 'partial': True, }) + + if move.move_dest_ids: + for dest_move in move.move_dest_ids: + # dest_move.write({'move_orig_ids': [(4, new_move.id)]}) + new_move.write({'move_dest_ids': [(4, dest_move.id)]}) + move.write({'product_uom_qty': qty_to_keep}) + else: move.write({'picking_id': new_picking.id, 'partial': True}) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index e79417aa..534d8122 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1043,7 +1043,7 @@ class PurchaseOrder(models.Model): # test = line.product_uom_qty # test2 = line.product_id.plafon_qty # test3 = test2 + line.product_uom_qty - if line.product_uom_qty > line.product_id.plafon_qty + line.product_uom_qty and not self.env.user.id == 21: + if line.product_uom_qty > line.product_id.plafon_qty + line.product_uom_qty and self.env.user.id not in [21, 7]: raise UserError('Product '+line.product_id.name+' melebihi plafon, harus Approval Rafly') def check_different_vendor_so_po(self): @@ -1123,6 +1123,8 @@ class PurchaseOrder(models.Model): if not self.not_update_purchasepricelist: self.add_product_to_pricelist() for line in self.order_line: + if not line.product_id.public_categ_ids: + raise UserError("Product %s kategorinya kosong" % line.product_id.name) if not line.product_id.purchase_ok: raise UserError("Terdapat barang yang tidak bisa diproses") # Validasi pajak diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 5c8f34c6..e254ef41 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -399,21 +399,21 @@ class SaleOrder(models.Model): ) def action_open_partial_delivery_wizard(self): - raise UserError("Fitur ini sedang dalam pengembangan") - # self.ensure_one() - # pickings = self.picking_ids.filtered(lambda p: p.state not in ['done', 'cancel'] and p.name and 'BU/PICK/' in p.name) - # return { - # 'type': 'ir.actions.act_window', - # 'name': 'Partial Delivery', - # 'res_model': 'partial.delivery.wizard', - # 'view_mode': 'form', - # 'target': 'new', - # 'context': { - # 'default_sale_id': self.id, - # # kasih langsung list of int biar ga ribet di wizard - # 'default_picking_ids': pickings.ids, - # } - # } + # raise UserError("Fitur ini sedang dalam pengembangan") + self.ensure_one() + pickings = self.picking_ids.filtered(lambda p: p.state not in ['done', 'cancel'] and p.name and 'BU/PICK/' in p.name) + return { + 'type': 'ir.actions.act_window', + 'name': 'Partial Delivery', + 'res_model': 'partial.delivery.wizard', + 'view_mode': 'form', + 'target': 'new', + 'context': { + 'default_sale_id': self.id, + # kasih langsung list of int biar ga ribet di wizard + 'default_picking_ids': pickings.ids, + } + } @api.depends('partner_id.is_cbd_locked') diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index c4aefe19..a7beca12 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -59,9 +59,9 @@ class ProductTemplate(models.Model): solr_model = self.env['apache.solr'] for template in self: + voucher = None if template.x_manufacture: voucher = self.get_voucher_pastihemat(template.x_manufacture.id) - # Lakukan sesuatu dengan voucher variant_names = ', '.join([x.display_name or '' for x in template.product_variant_ids]) variant_codes = ', '.join([x.default_code or '' for x in template.product_variant_ids]) diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index cb630a04..f5b0c745 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -165,7 +165,7 @@ class TukarGuling(models.Model): @api.onchange('operations') def _onchange_operations(self): """Auto-populate lines ketika operations dipilih""" - if self.operations.picking_type_id.id not in [29, 30]: + if self.operations.picking_type_id.id not in [29, 30] and self.env.user.id != 1102: raise UserError("❌ Picking type harus BU/OUT atau BU/PICK") for rec in self: if rec.operations and rec.operations.picking_type_id.id == 30: @@ -412,7 +412,7 @@ class TukarGuling(models.Model): def write(self, vals): self.ensure_one() - if self.operations.picking_type_id.id not in [29, 30]: + if self.operations.picking_type_id.id not in [29, 30] and self.env.user.id != 1102: raise UserError("❌ Picking type harus BU/OUT atau BU/PICK") # self._check_invoice_on_retur_so() operasi = self.operations.picking_type_id.id diff --git a/indoteknik_custom/views/apache_solr_queue.xml b/indoteknik_custom/views/apache_solr_queue.xml index a87d49f6..08972b28 100644 --- a/indoteknik_custom/views/apache_solr_queue.xml +++ b/indoteknik_custom/views/apache_solr_queue.xml @@ -18,7 +18,7 @@ decoration-success="execute_status == 'success'" decoration-primary="execute_status == 'not_found'" /> - <field name = "log" readonly="1"/> + <field name = "log" readonly="1" optional="hide"/> <field name="execute_date" readonly="1" /> <field name="create_date" readonly="1" /> </tree> |
