56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
from odoo import models, fields, api
|
|
import json
|
|
|
|
|
|
class StockPicking(models.Model):
|
|
_inherit = 'stock.picking'
|
|
|
|
def action_direct_print_receipt(self):
|
|
"""
|
|
Direct print action for stock picking receipts
|
|
"""
|
|
# Determine the appropriate report based on picking type
|
|
if self.picking_type_id.code == 'incoming':
|
|
report_name = 'stock.action_report_delivery'
|
|
elif self.picking_type_id.code == 'outgoing':
|
|
report_name = 'stock.action_report_delivery'
|
|
elif self.picking_type_id.code == 'internal':
|
|
report_name = 'stock.action_report_picking'
|
|
else:
|
|
report_name = 'stock.action_report_picking'
|
|
|
|
# Return client action for direct printing
|
|
return {
|
|
'type': 'ir.actions.client',
|
|
'tag': 'direct_print',
|
|
'name': 'Direct Print',
|
|
'report_name': report_name,
|
|
'docids': self.ids,
|
|
'context': self.env.context,
|
|
}
|
|
|
|
def action_direct_print_delivery(self):
|
|
"""
|
|
Direct print delivery slip
|
|
"""
|
|
return {
|
|
'type': 'ir.actions.client',
|
|
'tag': 'direct_print',
|
|
'name': 'Direct Print Delivery',
|
|
'report_name': 'stock.action_report_delivery',
|
|
'docids': self.ids,
|
|
'context': self.env.context,
|
|
}
|
|
|
|
def action_direct_print_picking_operations(self):
|
|
"""
|
|
Direct print picking operations
|
|
"""
|
|
return {
|
|
'type': 'ir.actions.client',
|
|
'tag': 'direct_print',
|
|
'name': 'Direct Print Operations',
|
|
'report_name': 'stock.action_report_picking',
|
|
'docids': self.ids,
|
|
'context': self.env.context,
|
|
} |