# Copyright 2025 Criptomart # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) from odoo import _, fields, models class SaleOrder(models.Model): _inherit = 'sale.order' @staticmethod def _get_pickup_day_selection(records): """Return pickup day selection options with translations.""" return [ ('0', _('Monday')), ('1', _('Tuesday')), ('2', _('Wednesday')), ('3', _('Thursday')), ('4', _('Friday')), ('5', _('Saturday')), ('6', _('Sunday')), ] pickup_day = fields.Selection( selection=_get_pickup_day_selection, string='Pickup Day', help='Day of week when this order will be picked up (inherited from group order)', ) group_order_id = fields.Many2one( 'group.order', string='Consumer Group Order', help='Reference to the consumer group order that originated this sale order', ) pickup_date = fields.Date( string='Pickup Date', help='Calculated pickup/delivery date (inherited from consumer group order)', ) home_delivery = fields.Boolean( string='Home Delivery', default=False, help='Whether this order includes home delivery (inherited from consumer group order)', ) def _get_name_portal_content_view(self): """Override to return custom portal content template with group order info. This method is called by the portal template to determine which content template to render. We return our custom template that includes the group order information (Consumer Group, Delivery/Pickup info, etc.) """ self.ensure_one() if self.group_order_id: return 'website_sale_aplicoop.sale_order_portal_content_aplicoop' return super()._get_name_portal_content_view()