[IMP]make warehouse required true and improve warning when there is no warehouse define for current company

bzr revid: sgo@tinyerp.com-20130607100129-vyvxbhbckakc7kr6
This commit is contained in:
sgo@tinyerp.com
2013-06-07 15:31:29 +05:30
parent 1202f9c6d5
commit 5418e39573
+2 -2
View File
@@ -70,7 +70,7 @@ class sale_order(osv.osv):
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
warehouse_ids = self.pool.get('stock.warehouse').search(cr, uid, [('company_id','=',company_id)], context=context)
if not warehouse_ids:
raise osv.except_osv(_('Error!'), _('There is no default location for the current user\'s company!'))
raise osv.except_osv(_('Error!'), _('There is no warehouse defined for the current company!'))
return warehouse_ids[0]
# This is False
@@ -140,7 +140,7 @@ class sale_order(osv.osv):
'picking_ids': fields.one2many('stock.picking.out', 'sale_id', 'Related Picking', readonly=True, help="This is a list of delivery orders that has been generated for this sales order."),
'shipped': fields.boolean('Delivered', readonly=True, help="It indicates that the sales order has been delivered. This field is updated only after the scheduler(s) have been launched."),
'picked_rate': fields.function(_picked_rate, string='Picked', type='float'),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse',required=True),
'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on',
help="The sales order will automatically create the invoice proposition (draft invoice).\
You have to choose if you want your invoice based on ordered ", required=True, readonly=True, states={'draft': [('readonly', False)]}),