[ADD] product_main_seller: Restore OCA addon from original version
- Restored product_main_seller addon to fix dependency chain - Addon required by product_origin_char and website_sale_aplicoop [IMP] website_sale_aplicoop: Add demo data configuration to manifest - Updated __manifest__.py to include demo data files - Demo data includes partners, suppliers, products, group orders, and sale orders - Demo data successfully loads during module installation
This commit is contained in:
parent
a483925005
commit
6f593c6240
22 changed files with 997 additions and 1 deletions
1
product_main_seller/models/__init__.py
Normal file
1
product_main_seller/models/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import product_template
|
||||
31
product_main_seller/models/product_template.py
Normal file
31
product_main_seller/models/product_template.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop)
|
||||
# @author: Quentin DUPONT (quentin.dupont@grap.coop)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api
|
||||
from odoo import fields
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
main_seller_id = fields.Many2one(
|
||||
comodel_name="res.partner",
|
||||
string="Main Vendor",
|
||||
help="Put your supplier info in first position to set as main vendor",
|
||||
compute="_compute_main_seller_id",
|
||||
store=True,
|
||||
)
|
||||
|
||||
@api.depends("variant_seller_ids.sequence", "variant_seller_ids.partner_id.active")
|
||||
def _compute_main_seller_id(self):
|
||||
for template in self:
|
||||
if template.variant_seller_ids:
|
||||
template.main_seller_id = fields.first(
|
||||
template.variant_seller_ids.filtered(
|
||||
lambda seller: seller.partner_id.active
|
||||
)
|
||||
).partner_id
|
||||
else:
|
||||
template.main_seller_id = False
|
||||
Loading…
Add table
Add a link
Reference in a new issue