Skip to content

Commit

Permalink
[ADD] sale_tier_validation_block_print
Browse files Browse the repository at this point in the history
  • Loading branch information
AungKoKoLin1997 committed Aug 5, 2024
1 parent b54c424 commit 7108a0a
Show file tree
Hide file tree
Showing 11 changed files with 576 additions and 0 deletions.
71 changes: 71 additions & 0 deletions sale_tier_validation_block_print/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
================================
Sale Tier Validation Block Print
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:93f994da8ba477fc42f77d47b5bf5137fd41397954b1bfba2dc760dbcbb4c664
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_tier_validation_block_print
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_tier_validation_block_print
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module blocks the printing of the sale order report if the order is not yet approved.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_tier_validation_block_print%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Quartile

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_tier_validation_block_print>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_tier_validation_block_print/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import reports
12 changes: 12 additions & 0 deletions sale_tier_validation_block_print/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2024 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Tier Validation Block Print",
"version": "16.0.1.0.0",
"category": "Sale",
"website": "https://github.com/OCA/sale-workflow",
"author": "Quartile, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["sale_tier_validation"],
}
1 change: 1 addition & 0 deletions sale_tier_validation_block_print/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module blocks the printing of the sale order report if the order is not yet approved.
1 change: 1 addition & 0 deletions sale_tier_validation_block_print/reports/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_report
25 changes: 25 additions & 0 deletions sale_tier_validation_block_print/reports/sale_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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 ValidationError


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 order.need_validation or (order.review_ids and not order.validated):
raise ValidationError(
_("Quotation printing is blocked until the order is approved.")
)
return {
"doc_ids": docids,
"doc_model": "sale.order",
"docs": docs,
"data": data,
}
Loading

0 comments on commit 7108a0a

Please sign in to comment.