- Remove redundant string= from 17 field definitions where name matches string value (W8113) - Convert @staticmethod to instance methods in selection methods for proper self.env._() access - Fix W8161 (prefer-env-translation) by using self.env._() instead of standalone _() - Fix W8301/W8115 (translation-not-lazy) by proper placement of % interpolation outside self.env._() - Remove unused imports of odoo._ from group_order.py and sale_order_extension.py - All OCA linting warnings in website_sale_aplicoop main models are now resolved Changes: - website_sale_aplicoop/models/group_order.py: 21 field definitions cleaned - website_sale_aplicoop/models/sale_order_extension.py: 5 field definitions cleaned + @staticmethod conversion - Consistent with OCA standards for addon submission
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
# Copyright 2025 Criptomart
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
|
|
|
from odoo import fields
|
|
from odoo import models
|
|
|
|
|
|
class SaleOrder(models.Model):
|
|
_inherit = "sale.order"
|
|
|
|
def _get_pickup_day_selection(self):
|
|
"""Return pickup day selection options with translations."""
|
|
return [
|
|
("0", self.env._("Monday")),
|
|
("1", self.env._("Tuesday")),
|
|
("2", self.env._("Wednesday")),
|
|
("3", self.env._("Thursday")),
|
|
("4", self.env._("Friday")),
|
|
("5", self.env._("Saturday")),
|
|
("6", self.env._("Sunday")),
|
|
]
|
|
|
|
pickup_day = fields.Selection(
|
|
selection=_get_pickup_day_selection,
|
|
help="Day of week when this order will be picked up (inherited from group order)",
|
|
)
|
|
|
|
group_order_id = fields.Many2one(
|
|
"group.order",
|
|
help="Reference to the consumer group order that originated this sale order",
|
|
)
|
|
|
|
pickup_date = fields.Date(
|
|
help="Calculated pickup/delivery date (inherited from consumer group order)",
|
|
)
|
|
|
|
home_delivery = fields.Boolean(
|
|
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()
|