Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
from . import product_customerinfo
from . import sale_order_line

View File

@@ -0,0 +1,19 @@
# Copyright 2022 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ProductCustomerInfo(models.Model):
_inherit = "product.customerinfo"
elaboration_ids = fields.Many2many(comodel_name="product.elaboration")
elaboration_note = fields.Char(
store=True,
compute="_compute_elaboration_note",
readonly=False,
)
@api.depends("elaboration_ids")
def _compute_elaboration_note(self):
for line in self:
line.elaboration_note = ", ".join(line.elaboration_ids.mapped("name"))

View File

@@ -0,0 +1,50 @@
# Copyright 2022 Tecnativa - Carlos Roca
# Copyright 2023 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
elaboration_ids = fields.Many2many(
comodel_name="product.elaboration",
compute="_compute_elaboration_ids",
store=True,
readonly=False,
string="Elaborations",
)
@api.depends("product_id")
def _compute_elaboration_ids(self):
for line in self:
customer_info = line._get_product_customer_info()
if customer_info:
line.elaboration_ids = customer_info.elaboration_ids
def _get_product_customer_info(self):
customerinfo = self.product_id.customer_ids.filtered(
lambda pc: pc.elaboration_ids and pc.partner_id == self.order_id.partner_id
)[:1]
if not customerinfo:
customerinfo = self.product_id.customer_ids.filtered(
lambda pc: pc.elaboration_ids
and pc.partner_id == self.order_id.partner_id.commercial_partner_id
)[:1]
return customerinfo
@api.onchange("elaboration_ids")
def onchange_elaboration_ids(self):
for line in self:
customer_info = line._get_product_customer_info()
if (
customer_info
and line.elaboration_ids
and (
# Comparing with ids because comparison with newId doesn't work
line.elaboration_ids.ids == customer_info.elaboration_ids.ids
or not line.elaboration_ids
)
):
line.elaboration_note = customer_info.elaboration_note