Files
Odoo-18.0-20251222/sale_tier_validation/reports/sale_report.py
tocmo0nlord adbe430761
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
Initial commit: Odoo 18.0-20251222 extra-addons
2026-03-13 20:43:25 +00:00

28 lines
920 B
Python
Executable File

# Copyright 2024 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, models
from odoo.exceptions import UserError
class ReportSaleOrder(models.AbstractModel):
_name = "report.sale.report_saleorder"
_description = "Sale Order Report"
@api.model
def _get_report_values(self, docids, data=None):
docs = self.env["sale.order"].browse(docids)
for order in docs:
if not order.company_id.sale_report_print_block:
continue
if order.need_validation or (order.review_ids and not order.validated):
raise UserError(
_("Quotation printing is blocked until the order is approved.")
)
return {
"doc_ids": docids,
"doc_model": "sale.order",
"docs": docs,
"data": data,
}