summaryrefslogtreecommitdiff
path: root/custom_indoteknik/models/sale.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 17:14:58 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 17:14:58 +0700
commit1ca3b3df3421961caec3b747a364071c80f5c7da (patch)
tree6778a1f0f3f9b4c6e26d6d87ccde16e24da6c9d6 /custom_indoteknik/models/sale.py
parentb57188be371d36d96caac4b8d65a40745c0e972c (diff)
initial commit
Diffstat (limited to 'custom_indoteknik/models/sale.py')
-rw-r--r--custom_indoteknik/models/sale.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/custom_indoteknik/models/sale.py b/custom_indoteknik/models/sale.py
new file mode 100644
index 0000000..f020e23
--- /dev/null
+++ b/custom_indoteknik/models/sale.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+
+from odoo import api, fields, models, _
+from odoo.exceptions import UserError, RedirectWarning, ValidationError, except_orm, Warning
+from datetime import datetime
+
+
+# class SaleOrder(models.Model):
+# _inherit = "sale.order"
+
+# @api.multi
+# def action_confirm(self):
+# for order in self:
+# # Check Invoice Limit
+# if order.partner_id.invoice_limit < order.partner_id.total_receivable:
+# raise ValidationError(_("This Customer has reached the Limit of Outstanding Invoices"))
+# elif order.partner_id.invoice_limit < order.amount_total:
+# raise ValidationError(_("This order is more than this Customer Limit"))
+
+# # Check Overdue invoices
+# outstanding_invoice = self.env['account.move'].search([
+# ('partner_id','=',order.partner_id.id),
+# ('state','=','open'),
+# ('date_due','<',fields.Date.today())])
+
+# if outstanding_invoice:
+# raise ValidationError(_("There are Overdue Invoices for this Customer"))
+
+# return super(SaleOrder, self).action_confirm() \ No newline at end of file