diff --git a/yuthon_stock/wizard/__init__.py b/yuthon_stock/wizard/__init__.py new file mode 100644 index 000000000..1143aed35 --- /dev/null +++ b/yuthon_stock/wizard/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import stock_picking_transfer_wizard diff --git a/yuthon_stock/wizard/stock_picking_transfer_wizard.py b/yuthon_stock/wizard/stock_picking_transfer_wizard.py new file mode 100644 index 000000000..1cdb42b23 --- /dev/null +++ b/yuthon_stock/wizard/stock_picking_transfer_wizard.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models +from odoo.exceptions import UserError + + +class StockPickingTransferWizard(models.TransientModel): + _name = 'stock.picking.transfer.wizard' + _description = '入库单转交向导' + + picking_id = fields.Many2one('stock.picking', string='入库单', required=True) + transfer_type = fields.Selection([ + ('acceptance', '转交验收'), + ('certifier', '转交证明'), + ], string='转交类型', required=True) + user_id = fields.Many2one('res.users', string='转交给', required=True, + domain=[('active', '=', True)]) + + def action_confirm(self): + self.ensure_one() + picking = self.picking_id + if self.transfer_type == 'acceptance': + if picking.receipt_status != 'acceptance': + raise UserError('当前入库单状态不是验收状态,无法转交验收!') + picking.write({'acceptance_user_id': self.user_id.id}) + elif self.transfer_type == 'certifier': + if picking.receipt_status != 'certification': + raise UserError('当前入库单状态不是证明状态,无法转交证明!') + picking.write({'certifier_user_id': self.user_id.id}) + return {'type': 'ir.actions.act_window_close'} diff --git a/yuthon_stock/wizard/stock_picking_transfer_wizard_views.xml b/yuthon_stock/wizard/stock_picking_transfer_wizard_views.xml new file mode 100644 index 000000000..9894b5e52 --- /dev/null +++ b/yuthon_stock/wizard/stock_picking_transfer_wizard_views.xml @@ -0,0 +1,20 @@ + + + + stock.picking.transfer.wizard.form + stock.picking.transfer.wizard + +
+ + + + + + +
+
+
+