From f24d7fc1c60fb0198dbb62f7ba996912ce9f2b9d Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sun, 15 Feb 2026 17:29:54 +0700 Subject: fix flow adjusment out --- fixco_custom/models/stock_inventory.py | 56 +++++++++++++++++++++------------- fixco_custom/views/stock_inventory.xml | 4 --- 2 files changed, 35 insertions(+), 25 deletions(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/stock_inventory.py b/fixco_custom/models/stock_inventory.py index 1a8f3b0..e507af5 100644 --- a/fixco_custom/models/stock_inventory.py +++ b/fixco_custom/models/stock_inventory.py @@ -20,7 +20,7 @@ class StockInventory(models.Model): ('logistic', 'Logistic'), ('accounting', 'Accounting'), ('approved', 'Approved'), - ], default='logistic', tracking=True) + ], tracking=True) def _generate_number_stock_inventory(self): """Men-generate nomor untuk semua stock inventory yang belum memiliki number.""" @@ -58,46 +58,60 @@ class StockInventory(models.Model): return "00001" # Jika belum ada data, mulai dari 00001 def action_start(self): - if self.approval_state != 'approved' and self.adjusment_type == 'out': - raise UserError('Harus melalui proses approval') - if self.adjusment_type == 'in': - if self.env.user.id not in [10, 14, 20, 21]: - raise UserError("Hanya User tertentu yang dapat melakukan Adjust-In") + if self.env.user.id not in [10, 14, 20, 21, 15]: + raise UserError("Hanya User tertentu yang dapat melakukan Adjust-In/Out") return super(StockInventory, self).action_start() @api.model def create(self, vals): """Pastikan nomor hanya dibuat saat penyimpanan.""" + + if vals.get('adjusment_type') == 'in': + vals['approval_state'] = False + elif vals.get('adjusment_type') == 'out': + vals['approval_state'] = 'logistic' + if 'adjusment_type' in vals and not vals.get('number'): - vals['number'] = False # Jangan buat number otomatis dulu + vals['number'] = False order = super(StockInventory, self).create(vals) if order.adjusment_type: - self._assign_number(order) # Generate number setelah save + self._assign_number(order) return order - - def action_approve(self): + + def action_validate(self): if self.adjusment_type == 'out': - for rec in self: - if rec.approval_state == 'logistic': - if not rec.env.user.id in [10, 14, 20, 21]: - raise UserError("Harus diapprove logistic") - rec.approval_state = 'accounting' - elif rec.approval_state == 'accounting': - if not rec.env.user.id in [13, 24, 2]: - raise UserError("Harus diapprove accounting") - rec.approval_state = 'approved' + + if self.approval_state != 'approved': + + if self.approval_state == 'logistic': + if not self.env.user.id in [10, 14, 20, 21]: + raise UserError("Adjustment Out harus diapprove oleh Logistic") + self.approval_state = 'accounting' + return True + + elif self.approval_state == 'accounting': + if not self.env.user.id in [13, 24, 2]: + raise UserError("Adjustment Out harus diapprove oleh Accounting") + self.approval_state = 'approved' + return super(StockInventory, self).action_validate() + else: - raise UserError("Sudah Approved") + raise UserError("Adjustment Out harus melalui approval terlebih dahulu.") + + return super(StockInventory, self).action_validate() def write(self, vals): """Jika adjusment_type diubah, generate ulang nomor.""" res = super(StockInventory, self).write(vals) if 'adjusment_type' in vals: for record in self: - self._assign_number(record) + if record.adjusment_type == 'in': + record.approval_state = False + elif record.adjusment_type == 'out' and record.approval_state == False: + record.approval_state = 'logistic' return res def copy(self, default=None): diff --git a/fixco_custom/views/stock_inventory.xml b/fixco_custom/views/stock_inventory.xml index 89c058e..a343db3 100644 --- a/fixco_custom/views/stock_inventory.xml +++ b/fixco_custom/views/stock_inventory.xml @@ -6,10 +6,6 @@ stock.inventory -
-
-- cgit v1.2.3 From c5ccdc87a4367367733783dfe71e9237557722c1 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sun, 15 Feb 2026 17:33:28 +0700 Subject: push --- fixco_custom/models/stock_inventory.py | 1 + 1 file changed, 1 insertion(+) (limited to 'fixco_custom') diff --git a/fixco_custom/models/stock_inventory.py b/fixco_custom/models/stock_inventory.py index e507af5..37104ff 100644 --- a/fixco_custom/models/stock_inventory.py +++ b/fixco_custom/models/stock_inventory.py @@ -112,6 +112,7 @@ class StockInventory(models.Model): record.approval_state = False elif record.adjusment_type == 'out' and record.approval_state == False: record.approval_state = 'logistic' + self._assign_number(record) return res def copy(self, default=None): -- cgit v1.2.3 From 603486387b19a00b9831805e049c2207970a9c0b Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 18 Feb 2026 10:09:22 +0700 Subject: fix cannot validate stock picking --- fixco_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py index 0eebe6a..9d25944 100755 --- a/fixco_custom/models/stock_picking.py +++ b/fixco_custom/models/stock_picking.py @@ -126,7 +126,7 @@ class StockPicking(models.Model): ]) if quant: - return quant.quantity + return sum(quant.mapped('quantity')) return 0 -- cgit v1.2.3 From 5e5602ca0892553b386def5d01368012ad99ca59 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 18 Feb 2026 10:29:47 +0700 Subject: add invoice marketplace account move --- fixco_custom/views/account_move.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fixco_custom') diff --git a/fixco_custom/views/account_move.xml b/fixco_custom/views/account_move.xml index 3eab56a..0fb3cad 100644 --- a/fixco_custom/views/account_move.xml +++ b/fixco_custom/views/account_move.xml @@ -90,6 +90,7 @@ + @@ -174,6 +175,7 @@ + -- cgit v1.2.3 From 2f33ecda0f0d51d8e336aad4d7f84777faa4e59c Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 18 Feb 2026 12:09:46 +0700 Subject: push --- fixco_custom/models/account_move.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index c1098d0..6722714 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -15,7 +15,7 @@ _logger = logging.getLogger(__name__) class AccountMove(models.Model): _inherit = 'account.move' - invoice_marketplace = fields.Char('Invoice Marketplace') + invoice_marketplace = fields.Char('Invoice Marketplace', compute='_compute_invoice_marketplace') address = fields.Char('Address') sale_id = fields.Many2one('sale.order', string='Sale Order') picking_id = fields.Many2one('stock.picking', string='Picking') @@ -62,6 +62,14 @@ class AccountMove(models.Model): ) soo_number = fields.Char('SOO Number') + @api.depends('sale_id') + def _compute_invoice_marketplace(self): + for move in self: + if move.sale_id: + move.invoice_marketplace = move.sale_id.invoice_mp if move.sale_id else False + else: + move.invoice_marketplace = False + @api.depends('line_ids.partner_id') def _compute_partner_compute(self): for move in self: @@ -305,6 +313,8 @@ class AccountMove(models.Model): entry.soo_number = ', '.join(soo_list) if entry.move_type == 'out_invoice': + search_inv = entry.search([('move_type', '=', 'out_invoice'), ('id', '=', entry.id), ('invoice_marketplace', '=', entry.sale_id.invoice_mp)], limit=1).invoice_marketplace + entry.invoice_marketplace = search_inv if entry.picking_id: entry.invoice_date = entry.picking_id.date_done -- cgit v1.2.3 From 672c09c00d8ca5ba3675c223ca0cb31e007f11ad Mon Sep 17 00:00:00 2001 From: Mqdd Date: Thu, 19 Feb 2026 08:51:24 +0700 Subject: try fix filter invoice marketplace not working --- fixco_custom/models/account_move.py | 10 +--------- fixco_custom/views/account_move.xml | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index 6722714..b1f540e 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -15,7 +15,7 @@ _logger = logging.getLogger(__name__) class AccountMove(models.Model): _inherit = 'account.move' - invoice_marketplace = fields.Char('Invoice Marketplace', compute='_compute_invoice_marketplace') + invoice_marketplace = fields.Char('Invoice Marketplace') address = fields.Char('Address') sale_id = fields.Many2one('sale.order', string='Sale Order') picking_id = fields.Many2one('stock.picking', string='Picking') @@ -62,14 +62,6 @@ class AccountMove(models.Model): ) soo_number = fields.Char('SOO Number') - @api.depends('sale_id') - def _compute_invoice_marketplace(self): - for move in self: - if move.sale_id: - move.invoice_marketplace = move.sale_id.invoice_mp if move.sale_id else False - else: - move.invoice_marketplace = False - @api.depends('line_ids.partner_id') def _compute_partner_compute(self): for move in self: diff --git a/fixco_custom/views/account_move.xml b/fixco_custom/views/account_move.xml index 0fb3cad..ee3cd20 100644 --- a/fixco_custom/views/account_move.xml +++ b/fixco_custom/views/account_move.xml @@ -90,7 +90,6 @@ - @@ -154,6 +153,7 @@ filter_domain="[ ('invoice_marketplace', 'ilike', self) ]"/> + + + + Reset to Draft + + + code + action = records.action_multi_reset_to_draft() + -- cgit v1.2.3 From c9ae57ed037af108542ad8a6cab41f416829435c Mon Sep 17 00:00:00 2001 From: Mqdd Date: Thu, 19 Feb 2026 10:39:18 +0700 Subject: add fp to GL --- fixco_custom/models/account_move_line.py | 1 + fixco_custom/views/account_move_line.xml | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/account_move_line.py b/fixco_custom/models/account_move_line.py index 1f4ed9d..a2a6e02 100644 --- a/fixco_custom/models/account_move_line.py +++ b/fixco_custom/models/account_move_line.py @@ -6,6 +6,7 @@ class AccountMoveLine(models.Model): qty_outstanding = fields.Float(string='Qty Outstanding', compute='_compute_qty_outstanding') invoice_marketplace = fields.Text("Invoice Mearketplace", compute='_compute_invoice_marketplace') + faktur_pajak = fields.Char(string='Faktur Pajak', related='move_id.faktur_pajak') def action_gl_reconcile(self): lines = self diff --git a/fixco_custom/views/account_move_line.xml b/fixco_custom/views/account_move_line.xml index 245bdfe..5b55729 100644 --- a/fixco_custom/views/account_move_line.xml +++ b/fixco_custom/views/account_move_line.xml @@ -1,16 +1,17 @@ - - account.move.line.tree.gl.invoice.marketplace - account.move.line - - - - - - - + + account.move.line.tree.gl.invoice.marketplace + account.move.line + + + + + + + + -- cgit v1.2.3 From 001feff973b4b7f55266ed8d05c1343e5fc6b2fb Mon Sep 17 00:00:00 2001 From: Mqdd Date: Thu, 19 Feb 2026 13:23:08 +0700 Subject: fix singleton error cancel SO --- fixco_custom/models/stock_picking.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py index 9d25944..0cfa065 100755 --- a/fixco_custom/models/stock_picking.py +++ b/fixco_custom/models/stock_picking.py @@ -295,8 +295,9 @@ class StockPicking(models.Model): ) res = super(StockPicking, self).action_cancel() - if self.picking_type_code == 'incoming' and self.name.startswith('BU/IN'): - self.set_po_bill_status() + for picking in self: + if picking.picking_type_code == 'incoming' and picking.name.startswith('BU/IN'): + picking.set_po_bill_status() return res -- cgit v1.2.3 From 4cbd08353e76cd2fd8f6c7c0ad50db1bab7e0f87 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Thu, 19 Feb 2026 13:24:17 +0700 Subject: fix singleton error cancel SO --- fixco_custom/models/stock_picking.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py index 0cfa065..a91274c 100755 --- a/fixco_custom/models/stock_picking.py +++ b/fixco_custom/models/stock_picking.py @@ -293,12 +293,13 @@ class StockPicking(models.Model): raise UserError( 'Hanya Accounting yang bisa melakukan cancel karena di po nya sudah ada uang muka' ) - res = super(StockPicking, self).action_cancel() - for picking in self: if picking.picking_type_code == 'incoming' and picking.name.startswith('BU/IN'): picking.set_po_bill_status() + + res = super(StockPicking, self).action_cancel() + return res def action_create_invoice_from_mr(self): -- cgit v1.2.3 From 233662316ed9b108271f5f4aacb1fcc0b05be63a Mon Sep 17 00:00:00 2001 From: Mqdd Date: Fri, 20 Feb 2026 10:45:48 +0700 Subject: fix faktur pajak GL --- fixco_custom/models/account_move_line.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'fixco_custom') diff --git a/fixco_custom/models/account_move_line.py b/fixco_custom/models/account_move_line.py index a2a6e02..0c64fe1 100644 --- a/fixco_custom/models/account_move_line.py +++ b/fixco_custom/models/account_move_line.py @@ -6,7 +6,17 @@ class AccountMoveLine(models.Model): qty_outstanding = fields.Float(string='Qty Outstanding', compute='_compute_qty_outstanding') invoice_marketplace = fields.Text("Invoice Mearketplace", compute='_compute_invoice_marketplace') - faktur_pajak = fields.Char(string='Faktur Pajak', related='move_id.faktur_pajak') + faktur_pajak = fields.Char(string='Faktur Pajak', compute='_compute_faktur_pajak') + + def _compute_faktur_pajak(self): + for line in self: + line.faktur_pajak = False + move = line.move_id + + if not move: + continue + + line.faktur_pajak = move.efaktur_id.name if move.efaktur_id else False def action_gl_reconcile(self): lines = self -- cgit v1.2.3