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 sale_order
from . import sale_order_line

View File

@@ -0,0 +1,24 @@
# © 2016 OdooMRP team
# © 2016 AvanzOSC
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 ForgeFlow S.L. (https://forgeflow.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, models
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.onchange("commitment_date")
def _onchange_commitment_date(self):
"""Update empty commitment date order lines
with commitment date from sale order"""
result = super()._onchange_commitment_date() or {}
if "warning" not in result:
for line in self.order_line:
if not line.commitment_date:
line.commitment_date = self.commitment_date
return result

View File

@@ -0,0 +1,48 @@
# © 2016 OdooMRP team
# © 2016 AvanzOSC
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 ForgeFlow S.L. (https://forgeflow.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from datetime import timedelta
from odoo import fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
commitment_date = fields.Datetime("Delivery Date", copy=False)
def _prepare_procurement_values(self, group_id=False):
vals = super()._prepare_procurement_values(group_id)
# has ensure_one already
if self.commitment_date:
vals.update(
{
"date_planned": self.commitment_date
- timedelta(days=self.order_id.company_id.security_lead),
"date_deadline": self.commitment_date,
}
)
return vals
def write(self, vals):
# Propagate a new commitment date to pending stock moves
res = super().write(vals)
if "commitment_date" in vals:
if vals.get("commitment_date"):
self.move_ids.filtered(
lambda sm: sm.state not in ["cancel", "done"]
).write({"date_deadline": vals.get("commitment_date")})
else:
for line in self:
date_deadline = (
line.order_id.commitment_date or line._expected_date()
)
line.move_ids.filtered(
lambda sm: sm.state not in ["cancel", "done"]
).write({"date_deadline": date_deadline})
return res