cleaned OCA addon
This commit is contained in:
parent
d58c621ef1
commit
6381a2d985
21 changed files with 0 additions and 997 deletions
|
|
@ -1 +0,0 @@
|
|||
from . import product_template
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# 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