[ADD] stock: Added an osv_memory wizard 'Make Picking'.
bzr revid: uco@tinyerp.co.in-20100330094924-fhhuh7gxemmpu1fd
This commit is contained in:
parent
ae85ae0475
commit
6f65cd47f2
|
@ -52,6 +52,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
|
|||
"wizard/stock_inventory_line_split_view.xml",
|
||||
"wizard/stock_change_standard_price_view.xml",
|
||||
"wizard/stock_traceability_view.xml",
|
||||
"wizard/stock_picking_make_view.xml",
|
||||
"stock_workflow.xml",
|
||||
"stock_incoterms.xml",
|
||||
"stock_wizard.xml",
|
||||
|
|
|
@ -585,7 +585,7 @@
|
|||
<field name="min_date" select="1"/>
|
||||
<field name="type"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(make_picking)d"
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="confirmed,assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
|
@ -752,7 +752,7 @@
|
|||
<field name="min_date" select="1"/>
|
||||
<field name="type"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(make_picking)d"
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
|
@ -946,7 +946,7 @@
|
|||
<field name="backorder_id" select="2" readonly="1"/>
|
||||
<field name="origin" select="2" readonly="1"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(make_picking)d"
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
|
@ -1141,7 +1141,7 @@
|
|||
<field name="invoice_state" select="2" string="Invoice Control"/>
|
||||
<field name="type"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(make_picking)d"
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="confirmed,assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
string="Split move line"/>
|
||||
|
||||
|
||||
<wizard
|
||||
id="make_picking"
|
||||
model="stock.picking"
|
||||
menu="False"
|
||||
keyword="client_action_multi"
|
||||
name="stock.picking.make"
|
||||
string="Make Picking"/>
|
||||
<!-- <wizard -->
|
||||
<!-- id="make_picking" -->
|
||||
<!-- model="stock.picking"-->
|
||||
<!-- menu="False"-->
|
||||
<!-- keyword="client_action_multi"-->
|
||||
<!-- name="stock.picking.make" -->
|
||||
<!-- string="Make Picking"/>-->
|
||||
|
||||
<wizard
|
||||
id="return_picking"
|
||||
|
|
|
@ -23,7 +23,7 @@ import stock_traceability
|
|||
import stock_move
|
||||
import stock_partial_picking
|
||||
import stock_partial_move
|
||||
#import stock_picking_make
|
||||
import stock_picking_make
|
||||
import wizard_replacement
|
||||
import wizard_return
|
||||
import wizard_split_lot_line
|
||||
|
|
|
@ -20,83 +20,60 @@
|
|||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from service import web_services
|
||||
from tools.misc import UpdateableStr, UpdateableDict
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
import pooler
|
||||
import time
|
||||
import wizard
|
||||
|
||||
class stock_picking_make(osv.osv_memory):
|
||||
_name = "stock.picking.make"
|
||||
_description = "Make picking"
|
||||
_name = 'stock.picking.make'
|
||||
_description = "Make Picking"
|
||||
|
||||
_columns = {
|
||||
'pickings': fields.many2many('stock.picking', 'Picking', required=True),
|
||||
}
|
||||
|
||||
ARCH = '''<?xml version="1.0"?>
|
||||
<form string="Make picking">
|
||||
<field name="pickings" nolabel="1" colspan="4"
|
||||
width="600" height="300"/>
|
||||
</form>'''
|
||||
|
||||
FIELDS = {
|
||||
'pickings': {
|
||||
'string': 'Picking',
|
||||
'type': 'many2many',
|
||||
'relation': 'stock.picking',
|
||||
'readonly': True,
|
||||
},
|
||||
}
|
||||
|
||||
def _get_value(obj, cursor, user, data, context):
|
||||
pool = pooler.get_pool(cursor.dbname)
|
||||
picking_obj = pool.get('stock.picking')
|
||||
|
||||
picking_ids = picking_obj.search(cursor, user, [
|
||||
('id', 'in', data['ids']),
|
||||
('state', '<>', 'done'),
|
||||
('state', '<>', 'cancel')], context=context)
|
||||
return {'pickings': picking_ids}
|
||||
|
||||
def _make_packing(obj, cursor, user, data, context):
|
||||
wkf_service = netsvc.LocalService('workflow')
|
||||
pool = pooler.get_pool(cursor.dbname)
|
||||
picking_obj = pool.get('stock.picking')
|
||||
ids = data['form']['pickings'][0][2]
|
||||
print"-------ids--------",ids
|
||||
picking_obj.force_assign(cursor, user, ids)
|
||||
picking_obj.action_move(cursor, user, ids)
|
||||
for picking_id in ids:
|
||||
wkf_service.trg_validate(user, 'stock.picking', picking_id,
|
||||
'button_done', cursor)
|
||||
return {}
|
||||
|
||||
class stock_picking_make(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_value],
|
||||
'result': {
|
||||
'type': 'form',
|
||||
'arch': ARCH,
|
||||
'fields': FIELDS,
|
||||
'state': [
|
||||
('end', 'Cancel', 'gtk-cancel'),
|
||||
('make', 'Ok', 'gtk-apply', True)
|
||||
],
|
||||
},
|
||||
},
|
||||
'make': {
|
||||
'actions': [_make_packing],
|
||||
'result': {
|
||||
'type': 'state',
|
||||
'state':'end',
|
||||
},
|
||||
},
|
||||
'picking_ids': fields.many2many('stock.picking', 'stock_picking_ids', 'parent_id', 'child_id', 'Pickings'),
|
||||
}
|
||||
|
||||
stock_picking_make('stock.picking.make')
|
||||
def default_get(self, cursor, user, fields, context):
|
||||
"""
|
||||
To get default values for the object.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
res = super(stock_picking_make, self).default_get(cursor, user, fields, context=context)
|
||||
record_ids = context and context.get('active_ids',False) or False
|
||||
if record_ids:
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
picking_ids = picking_obj.search(cursor, user, [
|
||||
('id', 'in', record_ids),
|
||||
('state', '<>', 'done'),
|
||||
('state', '<>', 'cancel')], context=context)
|
||||
res['picking_ids'] = picking_ids
|
||||
return res
|
||||
|
||||
def make_packing(self, cursor, user, ids, context):
|
||||
"""
|
||||
Make Picking.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
record_ids = context and context.get('active_ids',False) or False
|
||||
wkf_service = netsvc.LocalService('workflow')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
data = self.read(cursor, user, ids[0])
|
||||
pick_ids = data['picking_ids']
|
||||
picking_obj.force_assign(cursor, user, pick_ids)
|
||||
picking_obj.action_move(cursor, user, pick_ids)
|
||||
for picking_id in ids:
|
||||
wkf_service.trg_validate(user, 'stock.picking', picking_id,
|
||||
'button_done', cursor)
|
||||
return {}
|
||||
|
||||
stock_picking_make()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_stock_make_picking_wizard" model="ir.ui.view">
|
||||
<field name="name">Make Picking</field>
|
||||
<field name="model">stock.picking.make</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Make Picking">
|
||||
<field name="picking_ids" nolabel="1" colspan="4"
|
||||
width="600" height="300"/>
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="make_packing" string="Ok"
|
||||
type="object" icon="gtk-apply" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="act_stock_make_picking_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Make Picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.picking.make</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue