[IMP] set menu in warehouse and product,add default value in warehouse incomingshipment and delivary order form

bzr revid: tpa@tinyerp.com-20111111061652-ziay1lda4vs8qfat
This commit is contained in:
Turkesh Patel (Open ERP) 2011-11-11 11:46:52 +05:30
parent 90e75a3920
commit 89f5069a53
3 changed files with 42 additions and 18 deletions

View File

@ -92,10 +92,10 @@
<menuitem id="menu_procurement_management_inventory" name="Receive Products"
parent="base.menu_purchase_root" sequence="4"/>
<menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_inventory"
name="Incoming Shipments" sequence="9"
groups="base.group_extended"/>
name="Incoming Shipments" sequence="9"/>
<menuitem action="stock.action_reception_picking_move" id="menu_action_picking_tree_in_move"
parent="menu_procurement_management_inventory" sequence="11"/>
parent="menu_procurement_management_inventory" sequence="11"
groups="base.group_extended"/>
<!--Invoice control-->
<menuitem id="menu_procurement_management_invoice" name="Invoice Control"

View File

@ -1585,36 +1585,60 @@ class stock_move(osv.osv):
""" Gets default address of partner for destination location
@return: Address id or False
"""
mod_obj = self.pool.get('ir.model.data')
picking_type = context.get('picking_type')
location_id = False
if context is None:
context = {}
if context.get('move_line', []):
if context['move_line'][0]:
if isinstance(context['move_line'][0], (tuple, list)):
return context['move_line'][0][2] and context['move_line'][0][2].get('location_dest_id',False)
location_id = context['move_line'][0][2] and context['move_line'][0][2].get('location_dest_id',False)
else:
move_list = self.pool.get('stock.move').read(cr, uid, context['move_line'][0], ['location_dest_id'])
return move_list and move_list['location_dest_id'][0] or False
if context.get('address_out_id', False):
location_id = move_list and move_list['location_dest_id'][0] or False
elif context.get('address_out_id', False):
property_out = self.pool.get('res.partner.address').browse(cr, uid, context['address_out_id'], context).partner_id.property_stock_customer
return property_out and property_out.id or False
return False
location_id = property_out and property_out.id or False
else:
location_xml_id = False
if picking_type == 'in':
location_xml_id = 'stock_location_stock'
elif picking_type == 'out':
location_xml_id = 'stock_location_customers'
if location_xml_id:
location_model, location_id = mod_obj.get_object_reference(cr, uid, 'stock', location_xml_id)
return location_id
def _default_location_source(self, cr, uid, context=None):
""" Gets default address of partner for source location
@return: Address id or False
"""
mod_obj = self.pool.get('ir.model.data')
picking_type = context.get('picking_type')
location_id = False
if context is None:
context = {}
if context.get('move_line', []):
try:
return context['move_line'][0][2]['location_id']
location_id = context['move_line'][0][2]['location_id']
except:
pass
if context.get('address_in_id', False):
elif context.get('address_in_id', False):
part_obj_add = self.pool.get('res.partner.address').browse(cr, uid, context['address_in_id'], context=context)
if part_obj_add.partner_id:
return part_obj_add.partner_id.property_stock_supplier.id
return False
location_id = part_obj_add.partner_id.property_stock_supplier.id
else:
location_xml_id = False
if picking_type == 'in':
location_xml_id = 'stock_location_suppliers'
elif picking_type == 'out':
location_xml_id = 'stock_location_stock'
if location_xml_id:
location_model, location_id = mod_obj.get_object_reference(cr, uid, 'stock', location_xml_id)
return location_id
_defaults = {
'location_id': _default_location_source,
@ -1743,7 +1767,7 @@ class stock_move(osv.osv):
""" On change of product id, if finds UoM, UoS, quantity and UoS quantity.
@param prod_id: Changed Product id
@param loc_id: Source location id
@param loc_id: Destination location id
@param loc_dest_id: Destination location id
@param address_id: Address id of partner
@return: Dictionary of values
"""

View File

@ -904,7 +904,7 @@
</group>
<notebook colspan="4">
<page string="Products">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id, 'picking_type': type}" >
<tree colors="grey:scrapped==True" string="Stock Moves">
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -1125,7 +1125,7 @@
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}" >
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id, 'picking_type': type}" >
<tree colors="grey:scrapped==True" string="Stock Moves">
<field name="product_id" />
<field name="product_qty" />
@ -1357,7 +1357,7 @@
<menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="2"/>
<menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="2" groups="base.group_extended"/>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">stock.move.tree</field>
@ -1892,8 +1892,8 @@
<field name="act_window_id" ref="action_out_picking_move"/>
</record>
<menuitem action="action_reception_picking_move" id="menu_action_pdct_in" parent="menu_stock_products_moves" sequence="1"/>
<menuitem action="action_out_picking_move" id="menu_action_pdct_out" parent="menu_stock_products_moves" sequence="2"/>
<menuitem action="action_reception_picking_move" id="menu_action_pdct_in" parent="menu_stock_products_moves" sequence="1" groups="base.group_extended"/>
<menuitem action="action_out_picking_move" id="menu_action_pdct_out" parent="menu_stock_products_moves" sequence="2" groups="base.group_extended"/>
<record id="view_stock_journal_filter" model="ir.ui.view">