From b858358ffbdd14c9b56ac96f035bddccae4d872d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 8 Jul 2025 08:58:46 +0700 Subject: skema bills and requisition --- fixco_custom/models/account_move_line.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 fixco_custom/models/account_move_line.py (limited to 'fixco_custom/models/account_move_line.py') diff --git a/fixco_custom/models/account_move_line.py b/fixco_custom/models/account_move_line.py new file mode 100644 index 0000000..cf4d5d7 --- /dev/null +++ b/fixco_custom/models/account_move_line.py @@ -0,0 +1,19 @@ +from odoo import models, api, fields, _ +from odoo.exceptions import AccessError, UserError, ValidationError + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + qty_outstanding = fields.Float(string='Qty Outstanding', compute='_compute_qty_outstanding') + + def _compute_qty_outstanding(self): + for line in self: + qty_received = line.purchase_line_id.qty_received + qty_billed = line.purchase_line_id.qty_invoiced + line.qty_outstanding = qty_received - qty_billed + + @api.onchange('quantity') + def _onchange_quantity(self): + for line in self: + if line.quantity > line.qty_outstanding: + raise UserError(_("Quantity Tidak Boleh Melebihi Qty Outstanding")) -- cgit v1.2.3