[CLEAN] Misc cleaning before merging.
bzr revid: tde@openerp.com-20130614141643-29z9zslusyhj4u5j
This commit is contained in:
parent
c99ac69e61
commit
bc58a5a224
|
@ -115,11 +115,11 @@ class pos_config(osv.osv):
|
|||
|
||||
def _default_warehouse(self, cr, uid, context=None):
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context)
|
||||
res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id','=',user.company_id.id)], context=context)
|
||||
res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context)
|
||||
return res and res[0] or False
|
||||
|
||||
def _default_pricelist(self, cr, uid, context=None):
|
||||
res = self.pool.get('product.pricelist').search(cr, uid, [('type', '=', 'sale')])
|
||||
res = self.pool.get('product.pricelist').search(cr, uid, [('type', '=', 'sale')], limit=1, context=context)
|
||||
return res and res[0] or False
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -152,7 +152,7 @@ class sale_order(osv.osv):
|
|||
return result.keys()
|
||||
|
||||
def _get_default_company(self, cr, uid, context=None):
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
company_id = self.pool.get('res.users')._get_company(cr, uid, uid, context=context)
|
||||
if not company_id:
|
||||
raise osv.except_osv(_('Error!'), _('There is no default company for the current user!'))
|
||||
return company_id
|
||||
|
@ -219,7 +219,7 @@ class sale_order(osv.osv):
|
|||
'invoice_quantity': fields.selection([('order', 'Ordered Quantities')], 'Invoice on', help="The sales order will automatically create the invoice proposition (draft invoice).", required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Term'),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
|
||||
'company_id': fields.many2one('res.company','Company')
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
}
|
||||
_defaults = {
|
||||
'date_order': fields.date.context_today,
|
||||
|
|
|
@ -67,8 +67,8 @@ class sale_order(osv.osv):
|
|||
return order
|
||||
|
||||
def _get_default_warehouse(self, cr, uid, context=None):
|
||||
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)
|
||||
company_id = self.pool.get('res.users')._get_company(cr, uid, uid, context=context)
|
||||
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 warehouse defined for current company.'))
|
||||
return warehouse_ids[0]
|
||||
|
@ -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',required=True),
|
||||
'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)]}),
|
||||
|
@ -168,7 +168,7 @@ class sale_order(osv.osv):
|
|||
val = {}
|
||||
if warehouse_id:
|
||||
warehouse = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context=context)
|
||||
if warehouse.company_id.id:
|
||||
if warehouse.company_id:
|
||||
val['company_id'] = warehouse.company_id.id
|
||||
return {'value': val}
|
||||
|
||||
|
|
Loading…
Reference in New Issue