[IMP] Task Warehouse configuration - Add buy route/rule in purchase and manufacture route/rule in mrp + field default resupply in warehouse form auto hide/display
bzr revid: jke@openerp.com-20131022065446-sxsqy1y9wg8kdzrz
This commit is contained in:
@@ -58,6 +58,7 @@ Dashboard / Reports for MRP will include:
|
||||
'security/ir.model.access.csv',
|
||||
'mrp_workflow.xml',
|
||||
'mrp_data.xml',
|
||||
'mrp_stock_data.yml',
|
||||
'wizard/mrp_product_produce_view.xml',
|
||||
'wizard/change_production_qty_view.xml',
|
||||
'wizard/mrp_price_view.xml',
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
-
|
||||
Set "can_manufacture_for_resupply" at true for warehouse0 by default
|
||||
-
|
||||
!python {model: stock.warehouse}: |
|
||||
main_warehouse = self.browse(cr, uid, ref('stock.warehouse0'), context=context)
|
||||
main_warehouse.can_manufacture_for_resupply = True
|
||||
manufacture_pull_vals= self._get_manufacture_pull_rule(cr, uid, main_warehouse, context=context)
|
||||
pull_id = self.pool.get('procurement.rule').create(cr, uid, manufacture_pull_vals, context=context)
|
||||
self.write(cr,uid,main_warehouse.id,{'manufacture_pull_id':pull_id, 'can_manufacture_for_resupply':True},context=context)
|
||||
|
||||
@@ -1028,5 +1028,16 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_warehouse_inherited" model="ir.ui.view">
|
||||
<field name="name">Stock Warehouse Inherited</field>
|
||||
<field name="model">stock.warehouse</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='default_resupply_wh_id']" position="after">
|
||||
<field name="can_manufacture_for_resupply" groups="stock.group_adv_location"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
+86
-1
@@ -21,6 +21,7 @@
|
||||
|
||||
from openerp.osv import fields
|
||||
from openerp.osv import osv
|
||||
from openerp.tools.translate import _
|
||||
|
||||
|
||||
class StockMove(osv.osv):
|
||||
@@ -179,4 +180,88 @@ class split_in_production_lot(osv.osv_memory):
|
||||
return new_moves
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
class stock_warehouse(osv.osv):
|
||||
_inherit = 'stock.warehouse'
|
||||
_columns = {
|
||||
'can_manufacture_for_resupply': fields.boolean('Can manufacture for resupply this warehouse'),
|
||||
'manufacture_pull_id': fields.many2one('procurement.rule', 'Manufacture rule'),
|
||||
}
|
||||
_defaults= {
|
||||
'can_manufacture_for_resupply': False,
|
||||
'manufacture_pull_id' : False
|
||||
}
|
||||
|
||||
def _get_manufacture_pull_rule(self, cr, uid, warehouse, context=None):
|
||||
if not warehouse.can_manufacture_for_resupply:
|
||||
return False
|
||||
#
|
||||
route_obj = self.pool.get('stock.location.route')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
try:
|
||||
manufacture_route_id = data_obj.get_object_reference(cr, uid, 'stock', 'route_warehouse0_manufacture')[1]
|
||||
except:
|
||||
manufacture_route_id = route_obj.search(cr, uid, [('name', 'like', _('Manufacture'))], context=context)
|
||||
manufacture_route_id = manufacture_route_id and manufacture_route_id[0] or False
|
||||
if not manufacture_route_id:
|
||||
raise osv.except_osv(_('Error!'), _('Can\'t find any generic Manufacture route.'))
|
||||
|
||||
dest_loc = warehouse.in_type_id
|
||||
return {
|
||||
'name': warehouse.name + ': ' + _(' Manufacture') + ' -> ' + dest_loc.name,
|
||||
'location_id': warehouse.wh_input_stock_loc_id.id,
|
||||
'route_id': manufacture_route_id,
|
||||
'action': 'move',
|
||||
'picking_type_id': dest_loc.id,
|
||||
'procure_method': 'make_to_order',
|
||||
'active': True,
|
||||
}
|
||||
|
||||
def create_routes(self, cr, uid, ids, warehouse, context=None):
|
||||
pull_obj = self.pool.get('procurement.rule')
|
||||
res = super(stock_warehouse, self).create_routes(cr, uid, ids, warehouse, context=context)
|
||||
manufacture_pull_vals = self._get_manufacture_pull_rule(cr, uid, warehouse, context=context)
|
||||
if manufacture_pull_vals:
|
||||
manufacture_pull_id = pull_obj.create(cr, uid, manufacture_pull_vals, context=context)
|
||||
res['manufacture_pull_id'] = manufacture_pull_id
|
||||
else:
|
||||
res['manufacture_pull_id'] = False
|
||||
return res
|
||||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
pull_obj = self.pool.get('procurement.rule')
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
|
||||
#only if update and checkbox have changed !
|
||||
if not vals.get("can_manufacture_for_resupply",None) is None:
|
||||
|
||||
if vals.get("can_manufacture_for_resupply",False):
|
||||
for warehouse in self.browse(cr, uid, ids, context=context):
|
||||
if not warehouse.manufacture_pull_id:
|
||||
warehouse.can_manufacture_for_resupply = True
|
||||
manufacture_pull_vals = self._get_manufacture_pull_rule(cr, uid, warehouse, context=context)
|
||||
manufacture_pull_id = pull_obj.create(cr, uid, manufacture_pull_vals, context=context)
|
||||
vals['manufacture_pull_id'] = manufacture_pull_id
|
||||
else:
|
||||
for warehouse in self.browse(cr, uid, ids, context=context):
|
||||
if warehouse.manufacture_pull_id:
|
||||
manufacture_pull_id = pull_obj.unlink(cr, uid, warehouse.manufacture_pull_id.id, context=context)
|
||||
vals['manufacture_pull_id'] = False
|
||||
|
||||
return super(stock_warehouse,self).write(cr, uid, ids, vals, context=None)
|
||||
|
||||
def get_all_routes_for_wh(self, cr, uid, warehouse, context=None):
|
||||
all_routes = super(stock_warehouse,self).get_all_routes_for_wh(cr,uid,warehouse,context=context)
|
||||
if warehouse.can_manufacture_for_resupply and warehouse.manufacture_pull_id and warehouse.manufacture_pull_id.route_id:
|
||||
all_routes += [warehouse.manufacture_pull_id.route_id.id]
|
||||
return all_routes
|
||||
|
||||
def _get_all_products_to_resupply(self, cr, uid, warehouse, context=None):
|
||||
res = super(stock_warehouse,self)._get_all_products_to_resupply(cr, uid, warehouse, context=context)
|
||||
for product_id in res:
|
||||
for route in self.pool.get('product.product').browse(cr, uid, product_id, context=context).route_ids:
|
||||
if warehouse.manufacture_pull_id and warehouse.manufacture_pull_id.route_id and route.id == warehouse.manufacture_pull_id.route_id.id:
|
||||
res.remove(product_id)
|
||||
break
|
||||
return res
|
||||
|
||||
@@ -64,6 +64,7 @@ Dashboard / Reports for Purchase Management will include:
|
||||
'report/purchase_report_view.xml',
|
||||
'board_purchase_view.xml',
|
||||
'edi/purchase_order_action_data.xml',
|
||||
'purchase_stock_data.yml',
|
||||
'res_config_view.xml',
|
||||
],
|
||||
'test': [
|
||||
@@ -86,6 +87,7 @@ Dashboard / Reports for Purchase Management will include:
|
||||
'demo': [
|
||||
'purchase_order_demo.yml',
|
||||
'purchase_demo.xml',
|
||||
'purchase_stock_demo.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
||||
@@ -68,21 +68,26 @@
|
||||
|
||||
<!--
|
||||
Procurement rules and routes
|
||||
-->
|
||||
-->
|
||||
|
||||
<record id="route_warehouse0_buy" model='stock.location.route'>
|
||||
<field name="name">Buy</field>
|
||||
<field name="sequence">5</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- TODO: use a yaml file with python code to enable purcahse on main warehouse, so that the location_id is correct -->
|
||||
<record id="procurement_rule_supply_stock" model="procurement.rule">
|
||||
<field name="name">WH: Buy</field>
|
||||
<field name="action">buy</field>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
<field name="picking_type_id" ref="stock.picking_type_in"/>
|
||||
<field name="route_id" ref="route_warehouse0_buy"/>
|
||||
</record>
|
||||
<!--
|
||||
<record id="procurement_rule_supply_stock" model="procurement.rule">
|
||||
<field name="name">WH: Buy</field>
|
||||
<field name="action">buy</field>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
<field name="picking_type_id" ref="stock.picking_type_in"/>
|
||||
<field name="route_id" ref="route_warehouse0_buy"/>
|
||||
</record>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-
|
||||
!python {model: stock.warehouse}: |
|
||||
main_warehouse = self.browse(cr, uid, ref('stock.warehouse0'), context=context)
|
||||
buy_pull_vals= self._get_buy_pull_rule(cr, uid, main_warehouse, context=context)
|
||||
pull_id = self.pool.get('procurement.rule').create(cr, uid, buy_pull_vals, context=context)
|
||||
self.write(cr,uid,main_warehouse.id,{'buy_pull_id':pull_id},context=context)
|
||||
@@ -0,0 +1,13 @@
|
||||
-
|
||||
!python {model: stock.warehouse}: |
|
||||
pull_obj = self.pool.get('procurement.rule')
|
||||
wh_to_assign = ['stock_warehouse_shop0','stock_warehouse_shop1','warehouse_icecream']
|
||||
for wh_ref in wh_to_assign:
|
||||
warehouse = self.browse(cr, uid, ref('stock.' + wh_ref), context=context)
|
||||
buy_pull_vals= self._get_buy_pull_rule(cr, uid, warehouse, context=context)
|
||||
pull_id = self.pool.get('procurement.rule').create(cr, uid, buy_pull_vals, context=context)
|
||||
self.write(cr,uid,warehouse.id,{'buy_pull_id':pull_id},context=context)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp import netsvc
|
||||
from openerp.tools.translate import _
|
||||
|
||||
class stock_move(osv.osv):
|
||||
_inherit = 'stock.move'
|
||||
_columns = {
|
||||
@@ -56,3 +58,96 @@ class stock_picking(osv.osv):
|
||||
# Here is how it should work:
|
||||
# On a draft invoice, allows to select purchase_orders (many2many_tags)
|
||||
# This fills in automatically PO lines or from related receptions if any
|
||||
|
||||
class stock_warehouse(osv.osv):
|
||||
_inherit = 'stock.warehouse'
|
||||
_columns = {
|
||||
'can_buy_for_resupply': fields.boolean('Can buy for resupply this warehouse'),
|
||||
'buy_pull_id': fields.many2one('procurement.rule', 'BUY rule'),
|
||||
}
|
||||
_defaults= {
|
||||
'can_buy_for_resupply': True,
|
||||
'buy_pull_id' : False
|
||||
}
|
||||
|
||||
def _get_buy_pull_rule(self, cr, uid, warehouse, context=None):
|
||||
if not warehouse.can_buy_for_resupply:
|
||||
return False
|
||||
#
|
||||
route_obj = self.pool.get('stock.location.route')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
try:
|
||||
buy_route_id = data_obj.get_object_reference(cr, uid, 'stock', 'route_warehouse0_buy')[1]
|
||||
except:
|
||||
buy_route_id = route_obj.search(cr, uid, [('name', 'like', _('Buy'))], context=context)
|
||||
buy_route_id = buy_route_id and buy_route_id[0] or False
|
||||
if not buy_route_id:
|
||||
raise osv.except_osv(_('Error!'), _('Can\'t find any generic Buy route.'))
|
||||
|
||||
dest_loc = warehouse.in_type_id
|
||||
return {
|
||||
'name': warehouse.name + ': ' + _(' Buy') + ' -> ' + dest_loc.name,
|
||||
'location_id': warehouse.wh_input_stock_loc_id.id,
|
||||
'route_id': buy_route_id,
|
||||
'action': 'move',
|
||||
'picking_type_id': dest_loc.id,
|
||||
'procure_method': 'make_to_order',
|
||||
'active': True,
|
||||
}
|
||||
|
||||
def create_routes(self, cr, uid, ids, warehouse, context=None):
|
||||
pull_obj = self.pool.get('procurement.rule')
|
||||
res = super(stock_warehouse, self).create_routes(cr, uid, ids, warehouse, context=context)
|
||||
buy_pull_vals = self._get_buy_pull_rule(cr, uid, warehouse, context=context)
|
||||
if buy_pull_vals:
|
||||
buy_pull_id = pull_obj.create(cr, uid, buy_pull_vals, context=context)
|
||||
res['buy_pull_id'] = buy_pull_id
|
||||
else:
|
||||
res['buy_pull_id'] = False
|
||||
return res
|
||||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
pull_obj = self.pool.get('procurement.rule')
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
|
||||
#only if update and checkbox have changed !
|
||||
if not vals.get("can_buy_for_resupply",None) is None:
|
||||
|
||||
if vals.get("can_buy_for_resupply",False):
|
||||
for warehouse in self.browse(cr, uid, ids, context=context):
|
||||
if not warehouse.buy_pull_id:
|
||||
warehouse.can_buy_for_resupply = True
|
||||
buy_pull_vals = self._get_buy_pull_rule(cr, uid, warehouse, context=context)
|
||||
buy_pull_id = pull_obj.create(cr, uid, buy_pull_vals, context=context)
|
||||
vals['buy_pull_id'] = buy_pull_id
|
||||
else:
|
||||
for warehouse in self.browse(cr, uid, ids, context=context):
|
||||
if warehouse.buy_pull_id:
|
||||
buy_pull_id = pull_obj.unlink(cr, uid, warehouse.buy_pull_id.id, context=context)
|
||||
vals['buy_pull_id'] = False
|
||||
|
||||
return super(stock_warehouse,self).write(cr, uid, ids, vals, context=None)
|
||||
|
||||
# def change_route(self, cr, uid, ids, warehouse, new_reception_step=False, new_delivery_step=False, context=None):
|
||||
# pull_obj = self.pool.get('procurement.rule')
|
||||
# res = super(stock_warehouse, self).change_route(cr, uid, ids, warehouse, new_reception_step, new_delivery_step, context)
|
||||
# buy_pull_vals = self._get_buy_pull_rule(cr, uid, warehouse, context=context)
|
||||
# pull_obj.write(cr, uid, warehouse.buy_pull_id.id, buy_pull_vals, context=context)
|
||||
# return res
|
||||
|
||||
def get_all_routes_for_wh(self, cr, uid, warehouse, context=None):
|
||||
all_routes = super(stock_warehouse,self).get_all_routes_for_wh(cr,uid,warehouse,context=context)
|
||||
if warehouse.can_buy_for_resupply and warehouse.buy_pull_id and warehouse.buy_pull_id.route_id:
|
||||
all_routes += [warehouse.buy_pull_id.route_id.id]
|
||||
return all_routes
|
||||
|
||||
def _get_all_products_to_resupply(self, cr, uid, warehouse, context=None):
|
||||
res = super(stock_warehouse,self)._get_all_products_to_resupply(cr, uid, warehouse, context=context)
|
||||
for product_id in res:
|
||||
for route in self.pool.get('product.product').browse(cr, uid, product_id, context=context).route_ids:
|
||||
if warehouse.buy_pull_id and warehouse.buy_pull_id.route_id and route.id == warehouse.buy_pull_id.route_id.id:
|
||||
res.remove(product_id)
|
||||
break
|
||||
return res
|
||||
@@ -51,6 +51,19 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_warehouse_inherited" model="ir.ui.view">
|
||||
<field name="name">Stock Warehouse Inherited</field>
|
||||
<field name="model">stock.warehouse</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='default_resupply_wh_id']" position="after">
|
||||
<field name="can_buy_for_resupply" groups="stock.group_adv_location"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="action_picking_tree_picking_to_invoice" model="ir.actions.act_window">
|
||||
<field name="name">On Incoming Shipments</field>
|
||||
|
||||
@@ -65,7 +65,7 @@ Dashboard / Reports for Warehouse Management will include:
|
||||
'stock_orderpoint.yml',
|
||||
'stock_demo.yml',
|
||||
'stock_location_demo_cpu1.xml',
|
||||
'stock_location_demo_cpu3.yml',
|
||||
'stock_location_demo_cpu3.yml',
|
||||
],
|
||||
'data': [
|
||||
'security/stock_security.xml',
|
||||
@@ -114,6 +114,7 @@ Dashboard / Reports for Warehouse Management will include:
|
||||
'static/lib/justgage.js',
|
||||
'static/src/js/stock_picking_type.js',
|
||||
'static/src/js/widgets.js',
|
||||
'static/src/js/CheckHide.js',
|
||||
],
|
||||
'qweb': ['static/src/xml/picking.xml'],
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
function openerp_wh_hide(openerp) {
|
||||
var module = openerp.stock;
|
||||
var _t = openerp.web._t;
|
||||
|
||||
openerp.web.form.FieldMany2ManyCheckBoxes.include({
|
||||
render_value: function(){
|
||||
this._super();
|
||||
var self = this;
|
||||
setTimeout(function () {
|
||||
self.ShowHide();
|
||||
}, 0);
|
||||
},
|
||||
from_dom: function(){
|
||||
this._super();
|
||||
this.ShowHide();
|
||||
},
|
||||
ShowHide: function() {
|
||||
var bShow = false;
|
||||
this.$("input").each(function() {
|
||||
bShow = bShow || ($(this).attr("checked") ? true : false)
|
||||
});
|
||||
if (bShow) {
|
||||
$(".resupply_ids").show();
|
||||
}
|
||||
else {
|
||||
$(".resupply_ids").hide();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
openerp.web.form.custom_widgets.add("m2m_hide_resupply","openerp.stock.manageResupply");
|
||||
|
||||
//var a = false; $(".m2m_whids div").find(':checkbox').each( function(){ a = a | $(this)[0].checked; } ); alert(a);
|
||||
}
|
||||
@@ -65,5 +65,6 @@ openerp.stock = function(openerp) {
|
||||
|
||||
openerp.stock = openerp.stock || {};
|
||||
openerp_picking_widgets(openerp);
|
||||
openerp_wh_hide(openerp);
|
||||
|
||||
};
|
||||
|
||||
+27
-16
@@ -2315,8 +2315,8 @@ class stock_warehouse(osv.osv):
|
||||
'delivery_steps': 'ship_only',
|
||||
}
|
||||
_sql_constraints = [
|
||||
('warehouse_name_uniq', 'unique (name, company_id)', 'The name of the warehouse must be unique per company!'),
|
||||
('warehouse_code_uniq', 'unique (code, company_id)', 'The code of the warehouse must be unique per company !'),
|
||||
('warehouse_name_uniq', 'unique(name, company_id)', 'The name of the warehouse must be unique per company!'),
|
||||
('warehouse_code_uniq', 'unique(code, company_id)', 'The code of the warehouse must be unique per company !'),
|
||||
]
|
||||
|
||||
def _get_partner_locations(self, cr, uid, ids, context=None):
|
||||
@@ -2464,14 +2464,14 @@ class stock_warehouse(osv.osv):
|
||||
#create route selectable on the product to resupply the warehouse from another one
|
||||
self._create_resupply_routes(cr, uid, warehouse, warehouse.resupply_wh_ids, warehouse.default_resupply_wh_id, context=context)
|
||||
|
||||
#set routes and mto pull rule on warehouse
|
||||
return self.write(cr, uid, warehouse.id, {
|
||||
'route_ids': wh_route_ids,
|
||||
'mto_pull_id': mto_pull_id,
|
||||
'reception_route_id': reception_route_id,
|
||||
'delivery_route_id': delivery_route_id,
|
||||
'crossdock_route_id': crossdock_route_id,
|
||||
}, context=context)
|
||||
#return routes and mto pull rule for warehouse
|
||||
return {
|
||||
'route_ids': wh_route_ids,
|
||||
'mto_pull_id': mto_pull_id,
|
||||
'reception_route_id': reception_route_id,
|
||||
'delivery_route_id': delivery_route_id,
|
||||
'crossdock_route_id': crossdock_route_id,
|
||||
}
|
||||
|
||||
def change_route(self, cr, uid, ids, warehouse, new_reception_step=False, new_delivery_step=False, context=None):
|
||||
picking_type_obj = self.pool.get('stock.picking.type')
|
||||
@@ -2527,6 +2527,7 @@ class stock_warehouse(osv.osv):
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if vals is None:
|
||||
vals = {}
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
@@ -2654,7 +2655,8 @@ class stock_warehouse(osv.osv):
|
||||
warehouse.refresh()
|
||||
|
||||
#create routes and push/pull rules
|
||||
self.create_routes(cr, uid, new_id, warehouse, context=context)
|
||||
ret = self.create_routes(cr, uid, new_id, warehouse, context=context)
|
||||
self.write(cr, uid, warehouse.id, ret , context=context)
|
||||
return new_id
|
||||
|
||||
def _format_rulename(self, cr, uid, obj, from_loc, dest_loc, context=None):
|
||||
@@ -2674,7 +2676,7 @@ class stock_warehouse(osv.osv):
|
||||
'crossdock': (_('Cross-Dock'), [(warehouse.wh_input_stock_loc_id, warehouse.wh_output_stock_loc_id, warehouse.int_type_id.id), (warehouse.wh_output_stock_loc_id, customer_loc, warehouse.out_type_id.id)]),
|
||||
'ship_only': (_('Ship Only'), [(warehouse.lot_stock_id, customer_loc, warehouse.out_type_id.id)]),
|
||||
'pick_ship': (_('Pick + Ship'), [(warehouse.lot_stock_id, warehouse.wh_output_stock_loc_id, warehouse.pick_type_id.id), (warehouse.wh_output_stock_loc_id, customer_loc, warehouse.out_type_id.id)]),
|
||||
'pick_pack_ship': (_('Pick + Pack + Ship'), [(warehouse.lot_stock_id, warehouse.wh_pack_stock_loc_id, warehouse.int_type_id.id), (warehouse.wh_pack_stock_loc_id, warehouse.wh_output_stock_loc_id, warehouse.pack_type_id.id), (warehouse.wh_output_stock_loc_id, customer_loc, warehouse.out_type_id.id)]),
|
||||
'pick_pack_ship': (_('Pick + Pack + Ship'), [(warehouse.lot_stock_id, warehouse.wh_pack_stock_loc_id, warehouse.int_type_id.id), (warehouse.wh_pack_stock_loc_id, warehouse.wh_output_stock_loc_id, warehouse.pack_type_id.id), (warehouse.wh_output_stock_loc_id, customer_loc, warehouse.out_type_id.id)]),
|
||||
}
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
@@ -2682,8 +2684,7 @@ class stock_warehouse(osv.osv):
|
||||
context = {}
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
seq_obj = self.pool.get('ir.sequence')
|
||||
location_obj = self.pool.get('stock.location')
|
||||
route_obj = self.pool.get('stock.location.route')
|
||||
@@ -3162,6 +3163,16 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
|
||||
return True
|
||||
|
||||
def _check_uniq_name(self, cr, uid, ids, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
for name in self.browse(cr, uid, ids, context=context):
|
||||
if rule.product_id.uom_id.category_id.id != rule.product_uom.category_id.id:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=32, required=True),
|
||||
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the orderpoint without removing it."),
|
||||
@@ -3192,10 +3203,10 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=context)
|
||||
}
|
||||
_sql_constraints = [
|
||||
('qty_multiple_check', 'CHECK( qty_multiple > 0 )', 'Qty Multiple must be greater than zero.'),
|
||||
('qty_multiple_check', 'CHECK( qty_multiple > 0 )', 'Qty Multiple must be greater than zero.'),
|
||||
]
|
||||
_constraints = [
|
||||
(_check_product_uom, 'You have to select a product unit of measure in the same category than the default unit of measure of the product', ['product_id', 'product_uom']),
|
||||
(_check_product_uom, 'You have to select a product unit of measure in the same category than the default unit of measure of the product', ['product_id', 'product_uom']),
|
||||
]
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--Pick / Pack / Input location
|
||||
-->
|
||||
<!--
|
||||
<record id="location_pack_zone" model="stock.location">
|
||||
<field name="name">Packing zone</field>
|
||||
<field name="location_id" ref="company"/>
|
||||
<field name="usage">internal</field>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="stock_location_input" model="stock.location">
|
||||
<field name="name">Input</field>
|
||||
<field name="location_id" ref="stock.stock_location_company"/>
|
||||
<field name="usage">internal</field>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="stock_location_quality" model="stock.location">
|
||||
<field name="name">Quality Control</field>
|
||||
<field name="location_id" ref="stock.stock_location_company"/>
|
||||
<field name="usage">internal</field>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
-->
|
||||
<!-- Sequences and picking types -->
|
||||
<!-- <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>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
<record id="picking_type_pack" model="stock.picking.type">
|
||||
<field name="name">Pack Operations</field>
|
||||
<field name="sequence_id" ref="seq_picking_type_pack"/>
|
||||
<field name="default_location_src_id" ref="location_pack_zone"/>
|
||||
<field name="default_location_dest_id" ref="stock.stock_location_output"/>
|
||||
<field name="code_id">internal</field>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="seq_picking_type_pick" model="ir.sequence">
|
||||
<field name="name">Main warehouse: Pick</field>
|
||||
<field name="prefix">WH\PICK</field>
|
||||
<field name="padding">5</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="picking_type_pick" model="stock.picking.type">
|
||||
<field name="name">Pick Operations</field>
|
||||
<field name="sequence_id" ref="seq_picking_type_pick"/>
|
||||
<field name="default_location_src_id" ref="stock.stock_location_stock"/>
|
||||
<field name="default_location_dest_id" ref="location_pack_zone"/>
|
||||
<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>
|
||||
<field name="warehouse_selectable" eval="True"/>
|
||||
<field name="product_selectable" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="procurement_rule_customer0_mts" model="procurement.rule">
|
||||
<field name="name">Your Company: Stock → Customers</field>
|
||||
<field name="action">move</field>
|
||||
<field name="location_id" ref="stock.stock_location_customers"/>
|
||||
<field name="location_src_id" ref="stock.stock_location_stock"/>
|
||||
<field name="procure_method">make_to_stock</field>
|
||||
<field name="route_id" ref="route_warehouse0_mts"/>
|
||||
<field name="picking_type_id" ref="stock.picking_type_out"/>
|
||||
</record>
|
||||
|
||||
<record id="route_warehouse0_crossdock" model='stock.location.route'>
|
||||
<field name="name">Your Company: Cross-Dock</field>
|
||||
<field name="sequence">9</field>
|
||||
<field name="product_categ_selectable" eval="True"/>
|
||||
<field name="warehouse_selectable" eval="True"/>
|
||||
<field name="product_selectable" eval="False"/>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="procurement_rule_customer0_xdock" model="procurement.rule">
|
||||
<field name="name">Your Company: Output → Customers</field>
|
||||
<field name="action">move</field>
|
||||
<field name="location_id" ref="stock.stock_location_customers"/>
|
||||
<field name="location_src_id" ref="stock.stock_location_output"/>
|
||||
<field name="procure_method">make_to_order</field>
|
||||
<field name="route_id" ref="route_warehouse0_crossdock"/>
|
||||
<field name="picking_type_id" ref="stock.picking_type_out"/>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="procurement_rule_customer0_xdock_start" model="procurement.rule">
|
||||
<field name="name">Your Company: Input → Output</field>
|
||||
<field name="action">move</field>
|
||||
<field name="location_id" ref="stock.stock_location_output"/>
|
||||
<field name="location_src_id" ref="stock_location_input"/>
|
||||
<field name="procure_method">make_to_stock</field>
|
||||
<field name="route_id" ref="route_warehouse0_crossdock"/>
|
||||
<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'>
|
||||
<field name="name">1-step Receival</field>
|
||||
<field name="sequence">20</field>
|
||||
<field name="product_categ_selectable" eval="True"/>
|
||||
<field name="product_selectable" eval="False"/>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="stock.warehouse0" model="stock.warehouse">
|
||||
<field name="route_ids" eval="[(6, 0, [ref('route_warehouse0_crossdock'), ref('route_warehouse0_mts'), ref('route_1_push')])]"/>
|
||||
<field name="mto_pull_id" ref="stock.procurement_rule_customer_mto"/>
|
||||
<field name="wh_input_stock_loc_id" ref="stock_location_input"/>
|
||||
<field name="wh_output_stock_loc_id" ref="stock.stock_location_output"/>
|
||||
<field name="wh_qc_stock_loc_id" ref="stock_location_quality"/>
|
||||
<field name="wh_pack_stock_loc_id" ref="location_pack_zone"/>
|
||||
<field name="pick_type_id" ref="picking_type_pick"/>
|
||||
<field name="pack_type_id" ref="picking_type_pack"/>
|
||||
<field name="in_type_id" ref="stock.picking_type_in"/>
|
||||
<field name="out_type_id" ref="stock.picking_type_out"/>
|
||||
<field name="int_type_id" ref="stock.picking_type_internal"/>
|
||||
<field name="reception_route_id" ref="route_1_push"/>
|
||||
<field name="delivery_route_id" ref="route_warehouse0_mts"/>
|
||||
<field name="crossdock_route_id" ref="route_warehouse0_crossdock"/>
|
||||
</record>
|
||||
-->
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -667,13 +667,13 @@
|
||||
<group colspan="4">
|
||||
<field name="reception_steps" widget='radio'/>
|
||||
<field name="delivery_steps" widget='radio'/>
|
||||
<field name="resupply_wh_ids" domain="[('id', '!=', id)]" widget='many2many_checkboxes'/>
|
||||
<field name="default_resupply_wh_id"/> <!-- TODO should be filtered on resupply_wh_ids only... -->
|
||||
<field name="resupply_wh_ids" domain="[('id', '!=', id)]" widget='many2many_checkboxes' class="m2m_whids"/> <!--many2many_checkboxes-->
|
||||
<field name="default_resupply_wh_id" attrs="{'invisible': [('resupply_wh_ids','=',False)] }" class="resupply_ids"/> <!-- TODO should be filtered on resupply_wh_ids only... -->
|
||||
</group>
|
||||
</page>
|
||||
<page string="Technical Information" groups='base.group_no_one'>
|
||||
<group>
|
||||
<group string="Locations">
|
||||
<group string="Locations">
|
||||
<field name="wh_input_stock_loc_id" readonly="1"/>
|
||||
<field name="wh_qc_stock_loc_id" readonly="1"/>
|
||||
<field name="wh_pack_stock_loc_id" readonly="1"/>
|
||||
|
||||
Reference in New Issue
Block a user