- Introduced a new product details layout in `product_details_page.xml` with styled elements and hidden original Odoo components for a premium look. - Enhanced the product form view in `product_views.xml` to include a new field for marking popular deals. - Updated the configuration settings view in `res_config_settings_views.xml` to add a delivery option toggle during checkout. - Reorganized the shop page layout in `shop_page.xml` to include dynamic categories and attributes, along with a new arrivals section. - Created a new snippets file `snippets.xml` for potential future custom drag-and-drop blocks. - Added a script in `parse_content.py` for parsing specific content from a markdown file.
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
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 the latest slice."""
|
|
addon_path = modules.get_module_path('dine360_theme_shivasakthi')
|
|
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-sig') as f:
|
|
blogs = json.load(f)
|
|
if isinstance(blogs, list):
|
|
return blogs[::-1][:limit]
|
|
return blogs[:limit] if isinstance(blogs, list) else []
|
|
except Exception:
|
|
return []
|
|
return []
|