diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-07-08 08:58:46 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-07-08 08:58:46 +0700 |
| commit | b858358ffbdd14c9b56ac96f035bddccae4d872d (patch) | |
| tree | 0058aeea123b8e2c29ab704f98806b227838dbbe /fixco_custom/models/account_move_line.py | |
| parent | 8f07d24c8362cb6a4d5ded8f94b75c5057a5b025 (diff) | |
skema bills and requisition
Diffstat (limited to 'fixco_custom/models/account_move_line.py')
| -rw-r--r-- | fixco_custom/models/account_move_line.py | 19 |
1 files changed, 19 insertions, 0 deletions
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")) |
