From 3165c0b329732663cec4a5e9e1951a572cab1a11 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Thu, 12 Feb 2026 17:05:19 +0700 Subject: bills SO number filter --- fixco_custom/models/account_move.py | 13 ++++++++++++- fixco_custom/views/account_move.xml | 12 ++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index 09e4e45..c1098d0 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -60,6 +60,7 @@ class AccountMove(models.Model): string='Partner Compute', compute='_compute_partner_compute', ) + soo_number = fields.Char('SOO Number') @api.depends('line_ids.partner_id') def _compute_partner_compute(self): @@ -295,13 +296,23 @@ class AccountMove(models.Model): def action_post(self): if self.env.user.id not in [24, 13, 10, 2, 9, 15, 8, 22]: raise UserError('Hanya Accounting yang bisa Post') - res = super(AccountMove, self).action_post() + for entry in self: + if entry.move_type == 'in_invoice': + po = entry.invoice_line_ids.mapped('purchase_order_id') + soo_list = list(set(filter(None, po.mapped('soo_number')))) + + entry.soo_number = ', '.join(soo_list) + if entry.move_type == 'out_invoice': if entry.picking_id: entry.invoice_date = entry.picking_id.date_done + + res = super(AccountMove, self).action_post() + return res + @api.onchange('purchase_vendor_bill_ids', 'purchase_id') def _onchange_purchase_auto_complete(self): """ Load from either multiple old purchase orders or vendor bills. """ diff --git a/fixco_custom/views/account_move.xml b/fixco_custom/views/account_move.xml index f0ae0bc..3eab56a 100644 --- a/fixco_custom/views/account_move.xml +++ b/fixco_custom/views/account_move.xml @@ -73,6 +73,7 @@ + @@ -88,6 +89,7 @@ + @@ -116,10 +118,6 @@ optional="hide"/> - - - - @@ -155,6 +153,11 @@ filter_domain="[ ('invoice_marketplace', 'ilike', self) ]"/> + @@ -170,6 +173,7 @@ + -- cgit v1.2.3