From 7ad7a675b7dc9bfa2296355d9d4e5ea76152268d Mon Sep 17 00:00:00 2001 From: roga134 Date: Thu, 13 Aug 2026 12:12:12 +0000 Subject: [PATCH] Delete publisher_warranty.py --- publisher_warranty.py | 50 ------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 publisher_warranty.py diff --git a/publisher_warranty.py b/publisher_warranty.py deleted file mode 100644 index 7ae1950..0000000 --- a/publisher_warranty.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2024-Today: Odoo Community Iran -# @author: Odoo Community Iran (https://odoo-community.ir/ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from datetime import datetime -import logging - -from odoo.models import AbstractModel -from odoo.tools.translate import _ - -_logger = logging.getLogger(__name__) - -def add_years(today, years): - """Return a date that's `years` years after the date (or datetime) - object `today`. Return the same calendar date (month and day) in the - destination year, if it exists, otherwise use the following day - (thus changing February 29 to March 1). - - """ - try: - return today.replace(year = today.year + years) - except ValueError: - return today + (datetime.date(today.year + years, 1, 1) - datetime.date(today.year, 1, 1)) - -class PublisherWarrantyContract(AbstractModel): - _inherit = "publisher_warranty.contract" - - - def _get_message(self): - res = super(PublisherWarrantyContract, self)._get_message() - return {} - - def update_notification(self, cron_mode=True): - """ - This func was running from expiration_panel.js and change expiration_date & expiration_reason - Now override : expiration_date += 1 & expiration_reason=fawan - """ - res = super(PublisherWarrantyContract, self).update_notification(cron_mode) - expiration_date = add_years(datetime.now(),1) - expiration_reason = 'nothing' - try: - set_param = self.env['ir.config_parameter'].sudo().set_param - set_param('database.expiration_date', expiration_date) - set_param('database.expiration_reason', expiration_reason) - set_param('database.enterprise_code', "ABC") - _logger.info('Disable Enterprise by Date: %s, reason: %s', expiration_date, expiration_reason) - except Exception: - _logger.debug("Exception while change expiration_date", exc_info=1) - - return res \ No newline at end of file