[FIX] improvements in stock management
bzr revid: fp@tinyerp.com-20100613223525-qmtypsjrhio58rcy
This commit is contained in:
parent
cd511aa7a0
commit
f5b4319b04
|
@ -1296,6 +1296,7 @@ class stock_move(osv.osv):
|
|||
return (res and res[0]) or False
|
||||
_name = "stock.move"
|
||||
_description = "Stock Move"
|
||||
_order = 'date_planned desc'
|
||||
_log_create = False
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
|
@ -1368,7 +1369,7 @@ class stock_move(osv.osv):
|
|||
digits_compute= dp.get_precision('Account')),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True,select=1),
|
||||
'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner"),
|
||||
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Orders"),
|
||||
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order"),
|
||||
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"),
|
||||
'scraped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scraped'),
|
||||
}
|
||||
|
|
|
@ -713,7 +713,7 @@
|
|||
<filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Available Pickings"/>
|
||||
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Pickings"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="Back Order" domain="[('backorder_id', '!=', False)]" help="Has Back Order" />
|
||||
<filter icon="terp-accessories-archiver-minus" string="Back Order" domain="[('backorder_id', '<>', False)]" help="Has Back Order" />
|
||||
<separator orientation="vertical"/>
|
||||
<field name="location_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
|
@ -915,10 +915,10 @@
|
|||
<tree colors="blue:state in ('draft');grey:state in ('cancel');red:state not in ('cancel', 'done') and date < current_date" string="Picking list">
|
||||
<field name="name"/>
|
||||
<field name="address_id"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
<field name="origin"/>
|
||||
<field name="date"/>
|
||||
<field name="min_date"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-go-forward" help="Validate Picking"/>
|
||||
|
@ -1035,14 +1035,15 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Picking list">
|
||||
<group col="8" colspan="4">
|
||||
<filter icon="terp-check" string="Available" domain="[('state','=','assigned')]" help="Assigned Outgoing Orders"/>
|
||||
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Outgoing Orders"/>
|
||||
<filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Assigned Outgoing Orders"/>
|
||||
<filter icon="terp-camera_test" name="confirmed" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Outgoing Orders"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '<>', False)]" help="Has Back Order" />
|
||||
<separator orientation="vertical"/>
|
||||
|
||||
<field name="name"/>
|
||||
<field name="address_id" />
|
||||
<!-- <field name="company_id" widget="selection"/>-->
|
||||
|
||||
<field name="origin"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="8">
|
||||
|
@ -1308,7 +1309,15 @@
|
|||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
<field name="product_uom" string="Unit Of Measure"/>
|
||||
<button name="%(stock.move_scrap)d"
|
||||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="prodlot_id" groups="base.group_extended"/>
|
||||
<button name="%(track_line)d" string="Split" type="action"
|
||||
icon="gtk-justify-fill" attrs="{'invisible': [('prodlot_id','<>',False)]}"
|
||||
states="assigned,confirmed"
|
||||
groups="base.group_extended"/>
|
||||
<field name="location_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
<field name="date_planned"/>
|
||||
|
@ -1335,7 +1344,8 @@
|
|||
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.address_id)"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
<field name="product_uom" string="Unit Of Measure" widget="selection"/>
|
||||
<field name="product_uos" groups="base.group_extended" />
|
||||
<field name="product_uos_qty" groups="product.product_uos" />
|
||||
<field name="product_uos" groups="product.product_uos" />
|
||||
</group>
|
||||
|
||||
<group colspan="2" col="2">
|
||||
|
@ -1440,13 +1450,20 @@
|
|||
<field name="product_id"/>
|
||||
<field name="product_qty" />
|
||||
<field name="product_uom" string="UoM"/>
|
||||
<button name="%(stock.move_scrap)d"
|
||||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="prodlot_id" groups="base.group_extended"/>
|
||||
<button name="%(track_line)d" string="Split" type="action"
|
||||
icon="gtk-justify-fill" attrs="{'invisible': [('prodlot_id','<>',False)]}"
|
||||
states="assigned,confirmed,done"
|
||||
groups="base.group_extended"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_move)d" string="Partial" type="action" states="assigned" icon="gtk-justify-fill"/>
|
||||
<button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
|
||||
<button name="action_cancel" states="assigned,confirmed" string="Cancel" type="object" icon="gtk-cancel"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -1466,7 +1483,8 @@
|
|||
<field colspan="4" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
<field name="product_uom" widget="selection"/>
|
||||
<field name="product_uos" widget="selection" groups="base.group_extended"/>
|
||||
<field name="product_uos_qty" groups="product.product_uos"/>
|
||||
<field name="product_uos" widget="selection" groups="product.product_uos"/>
|
||||
<field colspan="4" name="name"/>
|
||||
<field name="date"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
|
@ -1512,13 +1530,13 @@
|
|||
<group col="8" colspan="4">
|
||||
<filter icon="terp-go-today" string="Today" domain="[('date_planned','<=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date_planned','>=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for today"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gtk-go-back-rtl" name="receive" string="To Receive" domain="[('state','in',('confirmed','assigned'))]" help="Stock to be received"/>
|
||||
<filter icon="terp-check" name="received" string="Received" domain="[('state','=','done'))]"/>
|
||||
<filter icon="terp-gtk-go-back-rtl" name="receive" string="To Do" domain="[('state','in',('confirmed','assigned'))]" help="Stock to be received"/>
|
||||
<filter icon="terp-check" name="received" string="Done" domain="[('state','=','done'))]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id','!=',False)]" help="Back Orders"/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="Back Order" domain="[('backorder_id','!=',False)]" help="Back Order"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="origin"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
<field name="partner_id" string="Partner"/>
|
||||
<field name="product_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
|
@ -1720,7 +1738,7 @@
|
|||
</record>
|
||||
|
||||
<record id="action_picking_tree_out" model="ir.actions.act_window">
|
||||
<field name="name">Outgoing Products</field>
|
||||
<field name="name">Customers Packings</field>
|
||||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -1748,7 +1766,7 @@
|
|||
</record>
|
||||
|
||||
<record id="action_out_picking_move" model="ir.actions.act_window">
|
||||
<field name="name">Outcoming Packings</field>
|
||||
<field name="name">Outgoing Products</field>
|
||||
<field name="res_model">stock.move</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
|
|
|
@ -240,10 +240,15 @@ class split_in_production_lot(osv.osv_memory):
|
|||
default_val = {
|
||||
'product_qty': quantity,
|
||||
'product_uos_qty': uos_qty,
|
||||
'state': move.state
|
||||
'state': 'draft'
|
||||
}
|
||||
if quantity_rest > 0:
|
||||
current_move = move_obj.copy(cr, uid, move.id, default_val)
|
||||
move_obj.action_confirm(cr, uid, [current_move])
|
||||
if move.state=='assigned':
|
||||
move_obj.force_assign(cr, uid, [current_move])
|
||||
elif move.state<>'confirmed':
|
||||
move_obj.write(cr, uid, [current_move], {'state': move.state})
|
||||
new_move.append(current_move)
|
||||
if quantity_rest == 0:
|
||||
current_move = move.id
|
||||
|
@ -297,10 +302,8 @@ class stock_move_split_lines(osv.osv_memory):
|
|||
'lot_id': fields.many2one('stock.move.split', 'Lot'),
|
||||
'action': fields.selection([('split','Split'),('keepinone','Keep in one lot')],'Action'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'quantity': lambda *x: 1,
|
||||
'action' : lambda *x: 'split',
|
||||
}
|
||||
|
||||
stock_move_split_lines()
|
||||
|
|
|
@ -31,8 +31,6 @@ class stock_partial_move(osv.osv_memory):
|
|||
_description = "Partial Move"
|
||||
_columns = {
|
||||
'date': fields.datetime('Date', required=True),
|
||||
'partner_id': fields.many2one('res.partner',string="Partner", required=True),
|
||||
'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered", required=True),
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
|
@ -66,8 +64,6 @@ class stock_partial_move(osv.osv_memory):
|
|||
_moves_arch_lst = """<form string="Deliver Products">
|
||||
<separator colspan="4" string="Delivery Information"/>
|
||||
<field name="date" colspan="4" />
|
||||
<field name="partner_id"/>
|
||||
<field name="address_id"/>
|
||||
<newline/>
|
||||
<separator colspan="4" string="Move Detail"/>
|
||||
"""
|
||||
|
@ -160,14 +156,6 @@ class stock_partial_move(osv.osv_memory):
|
|||
for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
if m.state in ('done', 'cancel'):
|
||||
continue
|
||||
address_ids = list(set([(pick.address_id and pick.address_id.id, pick.address_id and pick.address_id.partner_id and pick.address_id.partner_id.id) for pick in move_obj.browse(cr, uid, move_ids)]))
|
||||
if len(address_ids) == 1:
|
||||
address_id = address_ids[0][0]
|
||||
partner_id = address_ids[0][1]
|
||||
res['address_id'] = address_ids[0][0]
|
||||
res['partner_id'] = address_ids[0][1]
|
||||
else:
|
||||
address_id = partner_id = False
|
||||
if 'move%s_product_id'%(m.id) in fields:
|
||||
res['move%s_product_id'%(m.id)] = m.product_id.id
|
||||
if 'move%s_product_qty'%(m.id) in fields:
|
||||
|
@ -202,6 +190,7 @@ class stock_partial_move(osv.osv_memory):
|
|||
res['move%s_product_price'%(m.id)] = price
|
||||
if 'move%s_product_currency'%(m.id) in fields:
|
||||
res['move%s_product_currency'%(m.id)] = currency
|
||||
print res
|
||||
return res
|
||||
|
||||
def do_partial(self, cr, uid, ids, context):
|
||||
|
@ -224,8 +213,6 @@ class stock_partial_move(osv.osv_memory):
|
|||
move_ids = context.get('active_ids', False)
|
||||
partial = self.browse(cr, uid, ids[0], context)
|
||||
partial_datas = {
|
||||
'partner_id' : partial.partner_id and partial.partner_id.id or False,
|
||||
'address_id' : partial.address_id and partial.address_id.id or False,
|
||||
'delivery_date' : partial.date
|
||||
}
|
||||
for m in move_obj.browse(cr, uid, move_ids):
|
||||
|
|
|
@ -2,17 +2,6 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_stock_partial_move" model="ir.ui.view">
|
||||
<field name="name">Delivery Product</field>
|
||||
<field name="model">stock.partial.move</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Delivery Product">
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Delivery Product"
|
||||
res_model="stock.partial.move"
|
||||
src_model="stock.move"
|
||||
|
|
|
@ -30,8 +30,6 @@ class stock_partial_picking(osv.osv_memory):
|
|||
_description = "Partial Picking"
|
||||
_columns = {
|
||||
'date': fields.datetime('Date', required=True),
|
||||
'partner_id': fields.many2one('res.partner',string="Partner", required=True),
|
||||
'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered", required=True),
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
|
@ -62,11 +60,9 @@ class stock_partial_picking(osv.osv_memory):
|
|||
result = super(stock_partial_picking, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = context.get('active_ids', False)
|
||||
_moves_arch_lst = """<form string="Deliver Products">
|
||||
<separator colspan="4" string="Delivery Information"/>
|
||||
_moves_arch_lst = """<form string="Process Packing">
|
||||
<separator colspan="4" string="Product Information"/>
|
||||
<field name="date" colspan="4" />
|
||||
<field name="partner_id"/>
|
||||
<field name="address_id"/>
|
||||
<newline/>
|
||||
<separator colspan="4" string="Move Detail"/>
|
||||
"""
|
||||
|
@ -130,7 +126,7 @@ class stock_partial_picking(osv.osv_memory):
|
|||
<group col="2" colspan="2">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="_Cancel" />
|
||||
<button name="do_partial" string="_Deliver"
|
||||
<button name="do_partial" string="_Process"
|
||||
colspan="1" type="object" icon="gtk-apply" />
|
||||
</group>
|
||||
</form>"""
|
||||
|
@ -156,10 +152,6 @@ class stock_partial_picking(osv.osv_memory):
|
|||
if 'date' in fields:
|
||||
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
if 'partner_id' in fields:
|
||||
res.update({'partner_id': pick.address_id.partner_id and pick.address_id.partner_id.id or False })
|
||||
if 'address_id' in fields:
|
||||
res.update({'address_id': pick.address_id.id})
|
||||
for m in pick.move_lines:
|
||||
if m.state in ('done', 'cancel'):
|
||||
continue
|
||||
|
@ -202,8 +194,6 @@ class stock_partial_picking(osv.osv_memory):
|
|||
picking_ids = context.get('active_ids', False)
|
||||
partial = self.browse(cr, uid, ids[0], context)
|
||||
partial_datas = {
|
||||
'partner_id' : partial.partner_id and partial.partner_id.id or False,
|
||||
'address_id' : partial.address_id and partial.address_id.id or False,
|
||||
'delivery_date' : partial.date
|
||||
}
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids):
|
||||
|
@ -226,16 +216,3 @@ class stock_partial_picking(osv.osv_memory):
|
|||
|
||||
stock_partial_picking()
|
||||
|
||||
|
||||
|
||||
#_moves_arch_end = '''<?xml version="1.0"?>
|
||||
#<form string="Picking result">
|
||||
# <label string="The picking has been successfully made !" colspan="4"/>
|
||||
# <field name="back_order_notification" colspan="4" nolabel="1"/>
|
||||
#</form>'''
|
||||
|
||||
#_moves_fields_end = {
|
||||
# 'back_order_notification': {'string':'Back Order' ,'type':'text', 'readonly':True}
|
||||
# }
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
Loading…
Reference in New Issue