Check if the current document can be print
In some circumstance, we must block printing because there is missing information on the document (eg bad price on the quotation)
to made this customize as possible, we define some specification
If the osv.osv model have a function check_print, we execute it on the current document.
If this function return True we launch the report execution
If this function return False, we raise an error with a message define on the report definition
Otherwise we can raise a JasperException
eg
from osv import osv
from jasper_
from tools.translate import _
class SaleOrder(osv.osv):
_inherit = 'sale.order'
def check_print(self, cr, uid, obj, context=None):
if obj.state != 'draft':
raise JasperException
return True
SaleOrder()
Blueprint information
- Status:
- Complete
- Approver:
- Christophe CHAUVET
- Priority:
- Medium
- Drafter:
- Christophe CHAUVET
- Direction:
- Needs approval
- Assignee:
- Christophe CHAUVET
- Definition:
- Approved
- Series goal:
- Accepted for 6.0
- Implementation:
- Implemented
- Milestone target:
- 6.5.9
- Started by
- Christophe CHAUVET
- Completed by
- Christophe CHAUVET
Related branches
Related bugs
Sprints
Whiteboard
See rev 208 and 209