From 367c39cd19fe61b623e03b2ce58b15e30949cd53 Mon Sep 17 00:00:00 2001 From: git_admin Date: Fri, 1 May 2026 14:25:16 +0000 Subject: [PATCH] Tower: upload base_accounting_kit 19.0.2.3.1 (via marketplace) --- .../base_accounting_kit/models/sale_order.py | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 addons/base_accounting_kit/models/sale_order.py diff --git a/addons/base_accounting_kit/models/sale_order.py b/addons/base_accounting_kit/models/sale_order.py new file mode 100644 index 0000000..0cfb8b8 --- /dev/null +++ b/addons/base_accounting_kit/models/sale_order.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models +from odoo.exceptions import UserError +from odoo.tools.translate import _ + + +class SaleOrder(models.Model): + """The Class inherits the sale.order model for adding the new + fields and functions""" + _inherit = 'sale.order' + + has_due = fields.Boolean(string='Has due') + is_warning = fields.Boolean(string='Is warning') + due_amount = fields.Float(string='Due Amount', + related='partner_id.due_amount') + + def _action_confirm(self): + """To check the selected customers due amount is exceed than + blocking stage""" + if self.partner_id.active_limit \ + and self.partner_id.enable_credit_limit: + if self.due_amount >= self.partner_id.blocking_stage: + if self.partner_id.blocking_stage != 0: + raise UserError(_( + "%s is in Blocking Stage and " + "has a due amount of %s %s to pay") % ( + self.partner_id.name, self.due_amount, + self.currency_id.symbol)) + return super(SaleOrder, self)._action_confirm() + + @api.onchange('partner_id') + def check_due(self): + """To show the due amount and warning stage""" + if self.partner_id and self.partner_id.due_amount > 0 \ + and self.partner_id.active_limit \ + and self.partner_id.enable_credit_limit: + self.has_due = True + else: + self.has_due = False + if self.partner_id and self.partner_id.active_limit\ + and self.partner_id.enable_credit_limit: + if self.due_amount >= self.partner_id.warning_stage: + if self.partner_id.warning_stage != 0: + self.is_warning = True + else: + self.is_warning = False