[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:
snt 2026-02-18 17:54:43 +01:00
parent 5c89795e30
commit 6fbc7b9456
73 changed files with 5386 additions and 4354 deletions

View file

@ -1,20 +1,23 @@
# Copyright 2025 Criptomart
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import _, api, fields, models
from odoo import _
from odoo import api
from odoo import fields
from odoo import models
class ProductProduct(models.Model):
_inherit = 'product.product'
_inherit = "product.product"
group_order_ids = fields.Many2many(
'group.order',
'group_order_product_rel',
'product_id',
'order_id',
string='Group Orders',
"group.order",
"group_order_product_rel",
"product_id",
"order_id",
string="Group Orders",
readonly=True,
help='Group orders where this product is available',
help="Group orders where this product is available",
)
@api.model
@ -25,26 +28,25 @@ class ProductProduct(models.Model):
responsibilities together. Keep this wrapper so existing callers
on `product.product` keep working.
"""
order = self.env['group.order'].browse(order_id)
order = self.env["group.order"].browse(order_id)
if not order.exists():
return self.browse()
return order._get_products_for_group_order(order.id)
class ProductTemplate(models.Model):
_inherit = 'product.template'
_inherit = "product.template"
group_order_ids = fields.Many2many(
'group.order',
compute='_compute_group_order_ids',
string='Consumer Group Orders',
"group.order",
compute="_compute_group_order_ids",
string="Consumer Group Orders",
readonly=True,
help='Consumer group orders where variants of this product are available',
help="Consumer group orders where variants of this product are available",
)
@api.depends('product_variant_ids.group_order_ids')
@api.depends("product_variant_ids.group_order_ids")
def _compute_group_order_ids(self):
for template in self:
variants = template.product_variant_ids
template.group_order_ids = variants.mapped('group_order_ids')
template.group_order_ids = variants.mapped("group_order_ids")