From c4a4653e4065789a9c1baa97e91709ea52a6131e Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 14 Jan 2026 10:31:46 +0700 Subject: Done pahri --- fixco_custom/models/account_move.py | 7 +------ fixco_custom/models/purchase_order_line.py | 7 +++++++ fixco_custom/security/ir.model.access.csv | 2 +- fixco_custom/views/account_move.xml | 11 +++++++---- fixco_custom/views/purchase_order.xml | 1 + fixco_custom/views/purchase_order_line_wizard.xml | 13 ++++++++++--- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index e605f15..a0de6bb 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -285,8 +285,6 @@ class AccountMove(models.Model): if entry.move_type == 'out_invoice': if entry.picking_id: entry.invoice_date = entry.picking_id.date_done - - return res @api.onchange('purchase_vendor_bill_ids', 'purchase_id') @@ -359,11 +357,8 @@ class PurchaseOrderLineWizard(models.TransientModel): if move.state != 'draft': raise UserError('Invoice harus draft') - existing = move.invoice_line_ids.mapped('purchase_line_id') for po_line in self.line_ids: - if po_line in existing: - continue line = self.env['account.move.line'].with_context( check_move_validity=False @@ -372,10 +367,10 @@ class PurchaseOrderLineWizard(models.TransientModel): 'product_id': po_line.product_id.id, }) - # 🔑 trigger onchange resmi Odoo 14 line._onchange_product_id() line.name = po_line.name + # 🔹 Hanya qty yang belum di-invoice line.quantity = po_line.product_qty - po_line.qty_invoiced line.price_unit = po_line.price_unit line.tax_ids = po_line.taxes_id diff --git a/fixco_custom/models/purchase_order_line.py b/fixco_custom/models/purchase_order_line.py index 53a5eba..bdd729c 100644 --- a/fixco_custom/models/purchase_order_line.py +++ b/fixco_custom/models/purchase_order_line.py @@ -38,6 +38,13 @@ class PurchaseOrderLine(models.Model): original_price_subtotal = fields.Float(string='Original Subtotal', readonly=True) description = fields.Text(string='Description', readonly=True, copy=False) docstatus_altama = fields.Text(string='Status Altama', readonly=True, copy=False) + bill_remain = fields.Float(string='Bill Remain', readonly=True, copy=False, tracking=True, compute='_compute_bill_remain') + + @api.depends('qty_invoiced', 'product_qty') + def _compute_bill_remain(self): + for line in self: + line.bill_remain = line.product_qty - line.qty_invoiced + @api.constrains('product_id', 'price_unit', 'product_qty') def _store_original_price(self): diff --git a/fixco_custom/security/ir.model.access.csv b/fixco_custom/security/ir.model.access.csv index 4d13b37..2117f29 100755 --- a/fixco_custom/security/ir.model.access.csv +++ b/fixco_custom/security/ir.model.access.csv @@ -47,4 +47,4 @@ access_upload_cancel_picking,access.upload.cancel.picking,model_upload_cancel_pi access_upload_cancel_picking_line,access.upload.cancel.picking.line,model_upload_cancel_picking_line,,1,1,1,1 access_queue_job,access.queue.job,model_queue_job,,1,1,1,1 access_purchase_order_multi_bills,access.purchase.order.multi_bills,model_purchase_order_multi_bills,,1,1,1,1 -access_purchase_order_line_wizard,access.purchase.order.line.wizard,model_purchase_order_line_wizard,,1,1,1,1 +access_purchase_order_line_wizard,access.purchase.order.line.wizard,model_purchase_order_line_wizard,,1,1,1,1 \ No newline at end of file diff --git a/fixco_custom/views/account_move.xml b/fixco_custom/views/account_move.xml index 41ad966..69c9b47 100644 --- a/fixco_custom/views/account_move.xml +++ b/fixco_custom/views/account_move.xml @@ -35,10 +35,13 @@