merge data

bzr revid: jke@openerp.com-20131009133039-z6gj37omov4xh1qu
This commit is contained in:
jke-openerp 2013-10-09 15:30:39 +02:00
parent b31a674c42
commit 27f2eb58fc
8 changed files with 89 additions and 28 deletions

View File

@ -69,7 +69,8 @@ Dashboard / Reports for Warehouse Management will include:
'security/stock_security.xml',
'security/ir.model.access.csv',
'stock_data.xml',
'stock_location_data.xml',
'stock_data.yml',
# 'stock_location_data.xml',
'wizard/stock_move_view.xml',
'wizard/stock_change_product_qty_view.xml',
'wizard/stock_inventory_merge_view.xml',

View File

@ -134,11 +134,10 @@ class product_product(osv.osv):
# if field_names in ['incoming_qty', 'outgoing_qty', 'virtual_available']:
moves_in = self.pool.get('stock.move').read_group(cr, uid, domain_move_in, ['product_id', 'product_qty'], ['product_id'], context=context)
moves_out = self.pool.get('stock.move').read_group(cr, uid, domain_move_out, ['product_id', 'product_qty'], ['product_id'], context=context)
quants = self.pool.get('stock.quant').read_group(cr, uid, domain_quant, ['product_id', 'qty'], ['product_id'], context=context)
quants = dict(map(lambda x: (x['product_id'][0], x['qty']), quants))
moves_in = dict(map(lambda x: (x['product_id'][0], x['product_qty']), moves_in))
moves_out = dict(map(lambda x: (x['product_id'][0], x['product_qty']), moves_out))
@ -149,7 +148,8 @@ class product_product(osv.osv):
'incoming_qty': moves_in.get(id, 0.0),
'outgoing_qty': moves_out.get(id, 0.0),
'virtual_available': quants.get(id, 0.0) + moves_in.get(id, 0.0) - moves_out.get(id, 0.0),
}
}
return res
_columns = {
@ -263,6 +263,20 @@ class product_product(osv.osv):
res['fields']['qty_available']['string'] = _('Produced Qty')
return res
def action_view_routes(self, cr, uid, ids, context=None):
route_obj = self.pool.get("stock.location.route")
act_obj = self.pool.get('ir.actions.act_window')
mod_obj = self.pool.get('ir.model.data')
product_route_ids = set()
for product in self.browse(cr, uid, ids, context=context):
product_route_ids |= set([r.id for r in product.route_ids])
product_route_ids |= set([r.id for r in product.categ_id.total_route_ids])
route_ids = route_obj.search(cr, uid, ['|', ('id', 'in', list(product_route_ids)), ('warehouse_selectable', '=', True)], context=context)
result = mod_obj.get_object_reference(cr, uid, 'stock_location', 'action_routes_form')
id = result and result[1] or False
result = act_obj.read(cr, uid, [id], context=context)[0]
result['domain'] = "[('id','in',[" + ','.join(map(str, route_ids)) + "])]"
return result
class product_template(osv.osv):
_name = 'product.template'

View File

@ -48,7 +48,7 @@
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain" eval="[('picking_type_id','=',ref('picking_type_in')), ('location_id.usage','!=','internal'), ('location_dest_id.usage', '=', 'internal')]"/>
<field name="domain" eval="[('picking_id.picking_type_id.code_id','=','outgoing'), ('location_id.usage','!=','internal'), ('location_dest_id.usage', '=', 'internal')]"/>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context" eval="'{\'search_default_product_id\': [active_id]}'"/>
<field name="help" type="html">
@ -69,7 +69,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="domain" eval="[('picking_type_id','=',ref('picking_type_out')), ('location_id.usage','=','internal'), ('location_dest_id.usage', '!=', 'internal')]"/>
<field name="domain" eval="[('picking_type_id.code_id','=','outgoing'), ('location_id.usage','=','internal'), ('location_dest_id.usage', '!=', 'internal')]"/>
<field name="context" eval="'{\'search_default_product_id\': [active_id]}'"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">

View File

@ -1944,6 +1944,7 @@ class stock_inventory(osv.osv):
def _default_stock_location(self, cr, uid, context=None):
try:
stock_location = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock')
#stock_location = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context).lot_stock_id
return stock_location.id
except:
return False

View File

@ -61,6 +61,9 @@
<field name="usage">customer</field>
<field name="company_id"></field>
</record>
<!-- REMOVED FOR AVOID DUPLICATION
<record id="stock_location_company" model="stock.location">
<field name="name" model="res.company" search="[]" use="name"/>
<field name="usage">view</field>
@ -76,9 +79,11 @@
<field name="name">Stock</field>
<field name="location_id" ref="stock_location_company"/>
</record>
-->
<!-- Sequences for picking types -->
<!-- Sequences for picking types
<record id="seq_picking_type_in" model="ir.sequence">
<field name="name">WH Picking in</field>
<field name="prefix">WH\IN</field>
@ -99,7 +104,8 @@
<field name="padding">5</field>
<field name="company_id" eval="False"/>
</record>
-->
<!--
<record id="picking_type_in" model="stock.picking.type">
<field name="name">Receptions</field>
<field name="sequence_id" ref="seq_picking_type_in"/>
@ -124,7 +130,7 @@
<field name="default_location_dest_id" ref="stock_location_stock"/>
<field name="code_id">internal</field>
</record>
-->
</data>
@ -150,13 +156,14 @@ watch your stock valuation, and track production lots upstream and downstream (b
</record>
<!--
Procurement rules
-->
<!--
DUPLIQ pas vsur - confirmed
<record id="procurement_rule_customer0" model="procurement.rule">
<field name="name">Your Company: Stock → Customer</field>
<field name="action">move</field>
@ -165,12 +172,15 @@ watch your stock valuation, and track production lots upstream and downstream (b
<field name="picking_type_id" ref="picking_type_out"/>
<field name="procure_method">make_to_stock</field>
</record>
-->
<record id="route_warehouse0_mto" model='stock.location.route'>
<field name="name">MTO</field>
<field name="sequence">10</field>
</record>
<!--
DUPLIQ
<record id="procurement_rule_customer_mto" model="procurement.rule">
<field name="name">Your Company: Stock → Customer</field>
@ -181,6 +191,7 @@ watch your stock valuation, and track production lots upstream and downstream (b
<field name="procure_method">make_to_order</field>
<field name="route_id" ref="route_warehouse0_mto"/>
</record>
-->
<!--
Properties
@ -195,11 +206,13 @@ watch your stock valuation, and track production lots upstream and downstream (b
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_stock_customer')]"/>
<field eval="'stock.location,'+str(stock_location_customers)" name="value"/>
</record>
<!--
DUPLIQ garder via un yml
<record id="base.main_partner" model="res.partner">
<field name="property_stock_customer" eval="ref('stock_location_stock')"/>
</record>
-->
<record forcecreate="True" id="property_stock_procurement" model="ir.property">
<field name="name">property_stock_procurement</field>
<field name="fields_id" search="[('model','=','product.template'),('name','=','property_stock_procurement')]"/>
@ -225,12 +238,14 @@ watch your stock valuation, and track production lots upstream and downstream (b
<!--
Resource: stock.warehouse
-->
<record id="warehouse0" model="stock.warehouse">
<field model="res.company" name="name" search="[]" use="name"/>
<field name="lot_stock_id" ref="stock_location_stock"/>
<field name="code">WH</field>
</record>
<record id="sequence_mrp_op_type" model="ir.sequence.type">
<field name="name">Stock orderpoint</field>
<field name="code">stock.orderpoint</field>
@ -247,7 +262,7 @@ watch your stock valuation, and track production lots upstream and downstream (b
<!--
Add Warehouse to picking_type
-->
<record id="picking_type_in" model="stock.picking.type">
<field name="warehouse_id" ref="warehouse0"/>
</record>
@ -259,5 +274,7 @@ watch your stock valuation, and track production lots upstream and downstream (b
<record id="picking_type_internal" model="stock.picking.type">
<field name="warehouse_id" ref="warehouse0"/>
</record>
-->
</data>
</openerp>

View File

@ -0,0 +1,6 @@
-
!python {model: res.partner}: |
main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context)
print(main_warehouse.name)
self.write(cr, uid, ref('base.main_partner'), {'property_stock_customer':main_warehouse.lot_stock_id.id})

View File

@ -3,10 +3,10 @@
<data>
<!--Pick / Pack / Input location
-->
<!--
<record id="location_pack_zone" model="stock.location">
<field name="name">Packing zone</field>
<field name="location_id" ref="stock.stock_location_company"/>
<field name="location_id" ref="company"/>
<field name="usage">internal</field>
<field name="active" eval="False"/>
</record>
@ -24,9 +24,9 @@
<field name="usage">internal</field>
<field name="active" eval="False"/>
</record>
-->
<!-- Sequences and picking types -->
<record id="seq_picking_type_pack" model="ir.sequence">
<!-- <record id="seq_picking_type_pack" model="ir.sequence">
<field name="name">Main warehouse: Pack</field>
<field name="prefix">WH\PACK</field>
<field name="padding">5</field>
@ -57,10 +57,10 @@
<field name="code_id">internal</field>
<field name="active" eval="False"/>
</record>
-->
<!--
Procurement rules
-->
--><!--
<record id="route_warehouse0_mts" model='stock.location.route'>
<field name="name">Your Company: Ship only</field>
<field name="sequence">20</field>
@ -108,9 +108,9 @@
<field name="picking_type_id" ref="stock.picking_type_internal"/>
<field name="active" eval="False"/>
</record>
-->
<!-- reception route -->
<record id="route_1_push" model='stock.location.route'>
<!-- <record id="route_1_push" model='stock.location.route'>
<field name="name">1-step Receival</field>
<field name="sequence">20</field>
<field name="product_categ_selectable" eval="True"/>
@ -134,6 +134,6 @@
<field name="delivery_route_id" ref="route_warehouse0_mts"/>
<field name="crossdock_route_id" ref="route_warehouse0_crossdock"/>
</record>
-->
</data>
</openerp>

View File

@ -1265,7 +1265,7 @@
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain" eval="['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_type_id','=',ref('picking_type_in'))]"/>
<field name="domain" eval="['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.picking_type_id.code_id','=','outgoing')]"/>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context">{'product_receive': True, 'search_default_future': True}</field>
<field name="help" type="html">
@ -2080,5 +2080,27 @@
<menuitem action="action_routes_form" id="menu_stock_routes"
parent="stock.menu_stock_configuration" sequence="11" />
<record id="procurement_form_view_inherit" model="ir.ui.view">
<field name="name">procurement.order.form.view.inherit</field>
<field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="model">procurement.order</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='rule_id']" position="after">
<field name="route_ids" widget="many2many_tags" />
</xpath>
</field>
</record>
<record id="view_product_procurement_rule_form" model="ir.ui.view">
<field name="name">product.template.procurement.rule.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button name="action_view_routes" string="View Logistic Flows" type="object" />
</xpath>
</field>
</record>
</data>
</openerp>