Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
1
sale_tier_validation/reports/__init__.py
Executable file
1
sale_tier_validation/reports/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import sale_report
|
||||
27
sale_tier_validation/reports/sale_report.py
Executable file
27
sale_tier_validation/reports/sale_report.py
Executable file
@@ -0,0 +1,27 @@
|
||||
# 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,
|
||||
}
|
||||
Reference in New Issue
Block a user