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,3 @@
from . import product_set_line
from . import res_partner
from . import res_config

View File

@@ -0,0 +1,22 @@
# Copyright 2015 Anybox S.A.S
# Copyright 2016-2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ProductSetLine(models.Model):
_inherit = "product.set.line"
discount = fields.Float(string="Discount (%)", digits="Discount", default=0.0)
def prepare_sale_order_line_values(self, order, quantity, max_sequence=0):
self.ensure_one()
return {
"order_id": order.id,
"product_id": self.product_id.id,
"product_uom_qty": self.quantity * quantity,
"product_uom": self.product_id.uom_id.id,
"sequence": max_sequence + self.sequence,
"discount": self.discount,
"company_id": self.company_id.id,
}

View File

@@ -0,0 +1,15 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
archive_partner_product_sets = fields.Boolean(
config_parameter="sale_product_set.archive_partner_product_sets",
string="Sync product sets active state with partner",
help="When a partner is archived or un-archived \
its product sets are archived or un-archived as well.",
)

View File

@@ -0,0 +1,33 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
import logging
from odoo import models
from odoo.tools import str2bool
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = "res.partner"
def write(self, vals):
res = super().write(vals)
ir_config_param = self.env["ir.config_parameter"].sudo()
if "active" in vals and str2bool(
ir_config_param.get_param("sale_product_set.archive_partner_product_sets")
):
partner_product_sets = (
self.env["product.set"]
.with_context(active_test=False)
.search([("partner_id", "in", self.ids)])
)
partner_product_sets.sudo().write({"active": vals["active"]})
_logger.debug(
"product.set archive state changed to "
"<active | inactive> for partners %s",
",".join(str(x) for x in self.ids),
)
return res