[FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings
- 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
This commit is contained in:
parent
5c89795e30
commit
6fbc7b9456
73 changed files with 5386 additions and 4354 deletions
|
|
@ -1,56 +1,52 @@
|
|||
# Copyright 2025 Criptomart
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
|
||||
from odoo import _, fields, models
|
||||
from odoo import fields
|
||||
from odoo import models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
_inherit = "sale.order"
|
||||
|
||||
@staticmethod
|
||||
def _get_pickup_day_selection(records):
|
||||
def _get_pickup_day_selection(self):
|
||||
"""Return pickup day selection options with translations."""
|
||||
return [
|
||||
('0', _('Monday')),
|
||||
('1', _('Tuesday')),
|
||||
('2', _('Wednesday')),
|
||||
('3', _('Thursday')),
|
||||
('4', _('Friday')),
|
||||
('5', _('Saturday')),
|
||||
('6', _('Sunday')),
|
||||
("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,
|
||||
string='Pickup Day',
|
||||
help='Day of week when this order will be picked up (inherited from group order)',
|
||||
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',
|
||||
"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)',
|
||||
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)',
|
||||
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 "website_sale_aplicoop.sale_order_portal_content_aplicoop"
|
||||
return super()._get_name_portal_content_view()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue