[REM] stock: Task ID 350: Removed Make Picking and Return Picking wizards.

bzr revid: uco@tinyerp.co.in-20100421102202-35zd7a7hvx5o3kd4
This commit is contained in:
uco (OpenERP) 2010-04-21 15:52:02 +05:30
parent cc9d1b2e12
commit fc40ca40cf
8 changed files with 0 additions and 403 deletions

View File

@ -52,10 +52,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
"wizard/stock_location_product_view.xml",
"wizard/stock_inventory_line_split_view.xml",
"wizard/stock_change_standard_price_view.xml",
"wizard/stock_picking_make_view.xml",
"wizard/stock_traceability_view.xml",
"wizard/stock_picking_make_view.xml",
"wizard/stock_return_picking_view.xml",
"stock_workflow.xml",
"stock_incoterms.xml",
"stock_wizard.xml",

View File

@ -42,6 +42,5 @@
"access_stock_traceability_lot_downstream","stock.traceability.lot.downstream","model_stock_traceability_lot_downstream","stock.group_stock_user",1,0,0,0
"access_stock_partial_picking",stock.partial.picking","model_stock_partial_picking","stock.group_stock_user",1,0,0,0
"access_stock_partial_move","stock.partial.move","model_stock_partial_move","stock.group_stock_user",1,0,0,0
"access_stock_picking_make","stock.picking.make","model_stock_picking_make","stock.group_stock_user",1,0,0,0
"access_stock_inventory_merge","stock.inventory.merge","model_stock_inventory_merge","stock.group_stock_user",1,0,0,0
"access_stock_change_standard_price","stock.change.standard.price","model_stock_change_standard_price","stock.group_stock_user",1,0,0,0

Can't render this file because it contains an unexpected character in line 43 and column 53.

View File

@ -601,18 +601,6 @@
<field name="min_date" select="1"/>
<field name="type"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<button name="%(act_stock_make_picking_wizard)d"
states="confirmed,assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(act_stock_return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -763,18 +751,6 @@
<field name="date" />
<field name="min_date" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<button name="%(act_stock_make_picking_wizard)d"
states="assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(act_stock_return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -953,18 +929,6 @@
<field name="backorder_id" readonly="1"/>
<field name="origin" readonly="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<button name="%(act_stock_make_picking_wizard)d"
states="assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(act_stock_return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -1140,18 +1104,6 @@
<field name="min_date" readonly="1"/>
<field name="invoice_state" string="Invoice Control"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<button name="%(act_stock_make_picking_wizard)d"
states="confirmed,assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(act_stock_return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">

View File

@ -23,9 +23,7 @@ import stock_traceability
import stock_move
import stock_partial_picking
import stock_partial_move
import stock_picking_make
import wizard_replacement
import stock_return_picking
import wizard_ups
import stock_inventory_merge
import stock_inventory_set_stock_zero

View File

@ -1,80 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
import netsvc
class stock_picking_make(osv.osv_memory):
_name = 'stock.picking.make'
_description = "Make Picking"
_columns = {
'picking_ids': fields.many2many('stock.picking', 'stock_picking_ids', 'parent_id', 'child_id', 'Pickings'),
}
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:

View File

@ -1,31 +0,0 @@
<?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>

View File

@ -1,221 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import netsvc
import time
from osv import osv,fields
from tools.translate import _
class stock_return_picking(osv.osv_memory):
_name = 'stock.return.picking'
_description = 'Return Picking'
def default_get(self, cr, uid, 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_return_picking, self).default_get(cr, uid, fields, context=context)
record_id = context and context.get('active_id', False) or False
pick_obj = self.pool.get('stock.picking')
pick = pick_obj.browse(cr, uid, record_id)
for m in [line for line in pick.move_lines]:
res['return%s'%(m.id)] = m.product_qty
if pick.invoice_state=='invoiced':
res['invoice_state'] = '2binvoiced'
else:
res['invoice_state'] = 'none'
return res
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False) or False
if record_id:
pick_obj = self.pool.get('stock.picking')
try:
pick = pick_obj.browse(cr, uid, record_id)
for m in [line for line in pick.move_lines]:
if 'return%s'%(m.id) not in self._columns:
self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True)
if 'invoice_state' not in self._columns:
self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be Invoiced'), ('none', 'None')], string='Invoice State', required=True)
except Exception, e:
return res
return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
res = super(stock_return_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
record_id = context and context.get('active_id', False) or False
assert record_id,'Active ID not found'
if record_id:
pick_obj = self.pool.get('stock.picking')
pick = pick_obj.browse(cr, uid, record_id)
try:
if pick.state != 'done':
raise osv.except_osv(_('Warning !'), _("The Picking is not completed yet!\nYou cannot return picking which is not in 'Done' state!"))
return_history = {}
for m_line in pick.move_lines:
return_history[m_line.id] = 0
for rec in m_line.move_stock_return_history:
return_history[m_line.id] += rec.product_qty
res['fields'].clear()
arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')]
for m in [line for line in pick.move_lines]:
quantity = m.product_qty
if quantity > return_history[m.id] and (quantity - return_history[m.id])>0:
arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,))
res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True}
res.setdefault('returns', []).append(m.id)
if not res.get('returns',False):
raise osv.except_osv(_('Warning!'),_('There is no product to return!'))
arch_lst.append('<field name="invoice_state"/>\n<newline/>')
if pick.invoice_state=='invoiced':
new_invoice_state='2binvoiced'
else:
new_invoice_state=pick.invoice_state
res['fields']['invoice_state']={'string':_('Invoice state'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To Be Invoiced')), ('none', _('None'))]}
arch_lst.append('<group col="2" colspan="4">')
arch_lst.append('<button icon="gtk-cancel" special="cancel" string="Cancel" />')
arch_lst.append('<button name="action_open_window" string="Return" colspan="1" type="object" icon="gtk-apply" />')
arch_lst.append('</group>')
arch_lst.append('</form>')
res['arch'] = '\n'.join(arch_lst)
except Exception,e:
return res
return res
def _create_returns(self, cr, uid, ids, context):
"""
Creates return picking.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of ids selected
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
record_id = context and context.get('active_id', False) or False
move_obj = self.pool.get('stock.move')
pick_obj = self.pool.get('stock.picking')
uom_obj = self.pool.get('product.uom')
wf_service = netsvc.LocalService("workflow")
pick = pick_obj.browse(cr, uid, record_id)
data = self.read(cr, uid, ids[0])
new_picking = None
date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
move_ids = [m.id for m in [line for line in pick.move_lines]]
set_invoice_state_to_none = True
for move in move_obj.browse(cr, uid, move_ids):
if not new_picking:
if pick.type=='out':
new_type = 'in'
elif pick.type=='in':
new_type = 'out'
else:
new_type = 'internal'
new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name,
'move_lines':[], 'state':'draft', 'type':new_type,
'date':date_cur, 'invoice_state':data['invoice_state'],})
new_location=move.location_dest_id.id
new_qty = data['return%s' % move.id]
returned_qty = move.product_qty
for rec in move.move_stock_return_history:
returned_qty -= rec.product_qty
if returned_qty != new_qty:
set_invoice_state_to_none = False
new_move=move_obj.copy(cr, uid, move.id, {
'product_qty': new_qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id,
new_qty, move.product_uos.id),
'picking_id':new_picking, 'state':'draft',
'location_id':new_location, 'location_dest_id':move.location_id.id,
'date':date_cur, 'date_planned':date_cur,})
move_obj.write(cr, uid, [move.id], {'move_stock_return_history':[(4,new_move)]})
if set_invoice_state_to_none:
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'})
if new_picking:
if new_picking:
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
pick_obj.force_assign(cr, uid, [new_picking], context)
return new_picking
def action_open_window(self, cr, uid, ids, context):
"""
Opens return picking list.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of ids selected
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = self._create_returns(cr, uid, ids, context)
if not res:
return {}
return {
'domain': "[('id', 'in', ["+str(res)+"])]",
'name': 'Picking List',
'view_type':'form',
'view_mode':'tree,form',
'res_model':'stock.picking',
'view_id':False,
'type':'ir.actions.act_window',
}
stock_return_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Return Picking -->
<record id="act_stock_return_picking" model="ir.actions.act_window">
<field name="name">Return Picking</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.return.picking</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>