28 lines
884 B
Python

# -*- coding: utf-8 -*-
import json
import os
from odoo import models, fields, modules
class Website(models.Model):
_inherit = 'website'
enable_delivery_option = fields.Boolean(
string='Enable Delivery Option',
default=True,
help='If disabled, customers will not see the Delivery option on the checkout page.'
)
def get_recent_blogs(self, limit=3):
"""Reads blog posts from blogs.json and returns a slice."""
addon_path = modules.get_module_path('dine360_theme_chennora')
json_path = os.path.join(addon_path, 'data', 'blogs.json')
if os.path.exists(json_path):
try:
with open(json_path, 'r', encoding='utf-8') as f:
blogs = json.load(f)
return blogs[:limit]
except Exception:
return []
return []