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,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import sale_order
from . import sale_order_line
from . import account_move_line

View File

@@ -0,0 +1,24 @@
# Copyright 2023 Forgeflow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
related_so_sequence = fields.Char(
string="SO Line Number",
compute="_compute_related_so_sequence",
)
@api.depends("move_id.invoice_line_ids")
def _compute_related_so_sequence(self):
for rec in self:
if len(rec.move_id.line_ids.sale_line_ids.order_id) > 1:
rec.related_so_sequence = (
f"{rec.sale_line_ids.order_id.name}/"
f"{rec.sale_line_ids.visible_sequence}"
)
else:
rec.related_so_sequence = str(rec.sale_line_ids.visible_sequence)

View File

@@ -0,0 +1,24 @@
# Copyright 2017 ForgeFlow S.L.
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.depends("order_line")
def _compute_max_line_sequence(self):
"""Allow to know the highest sequence entered in sale order lines.
Then we add 1 to this value for the next sequence.
This value is given to the context of the o2m field in the view.
So when we create new sale order lines, the sequence is automatically
added as : max_sequence + 1
"""
for sale in self:
sale.max_line_sequence = max(sale.mapped("order_line.sequence") or [0]) + 1
max_line_sequence = fields.Integer(
string="Max sequence in lines", compute="_compute_max_line_sequence", store=True
)

View File

@@ -0,0 +1,33 @@
# Copyright 2017 ForgeFlow S.L.
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
# re-defines the field to change the default
sequence = fields.Integer(
help="Gives the sequence of this line when displaying the sale order.",
default=9999,
)
visible_sequence = fields.Integer(
"Line Number",
help="Displays the sequence of the line in the sale order.",
compute="_compute_visible_sequence",
store=True,
)
@api.depends("sequence", "order_id.order_line")
def _compute_visible_sequence(self):
for so in self.mapped("order_id"):
sequence = 1
order_lines = so.order_line.filtered(
lambda order_line: not order_line.display_type
)
for line in sorted(order_lines, key=lambda order_line: order_line.sequence):
line.visible_sequence = sequence
sequence += 1