diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 47bb972c07a..5a969154cc7 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -212,30 +212,30 @@ class purchase_order(osv.osv): 'purchase.order.line': (_get_order, ['date_planned'], 10), } ), - 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Untaxed Amount', + 'amount_untaxed': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Untaxed Amount', store={ 'purchase.order.line': (_get_order, None, 10), }, multi="sums", help="The amount without tax", track_visibility='always'), - 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Taxes', + 'amount_tax': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Taxes', store={ 'purchase.order.line': (_get_order, None, 10), }, multi="sums", help="The tax amount"), - 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Total', + 'amount_total': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Total', store={ 'purchase.order.line': (_get_order, None, 10), - }, multi="sums",help="The total amount"), + }, multi="sums", help="The total amount"), 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'), 'payment_term_id': fields.many2one('account.payment.term', 'Payment Term'), 'incoterm_id': fields.many2one('stock.incoterms', 'Incoterm', help="International Commercial Terms are a series of predefined commercial terms used in international transactions."), - 'product_id': fields.related('order_line','product_id', type='many2one', relation='product.product', string='Product'), - 'create_uid': fields.many2one('res.users', 'Responsible'), - 'company_id': fields.many2one('res.company','Company',required=True,select=1, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}), + 'product_id': fields.related('order_line', 'product_id', type='many2one', relation='product.product', string='Product'), + 'create_uid': fields.many2one('res.users', 'Responsible'), + 'company_id': fields.many2one('res.company', 'Company', required=True, select=1, states={'confirmed': [('readonly', True)], 'approved': [('readonly', True)]}), 'journal_id': fields.many2one('account.journal', 'Journal'), 'bid_date': fields.date('Bid Received On', readonly=True, help="Date on which the bid was received"), 'bid_validity': fields.date('Bid Valid Until', help="Date on which the bid expired"), - 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', help="This will determine picking type of incoming shipment", required=True, - states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}), - 'related_location_id':fields.related('picking_type_id', 'default_location_dest_id', type='many2one', relation='stock.location', string="Related location", store=True), + 'picking_type_id': fields.many2one('stock.picking.type', 'Deliver To', help="This will determine picking type of incoming shipment", required=True, + states={'confirmed': [('readonly', True)], 'approved': [('readonly', True)], 'done': [('readonly', True)]}), + 'related_location_id': fields.related('picking_type_id', 'default_location_dest_id', type='many2one', relation='stock.location', string="Related location", store=True), } _defaults = { 'date_order': fields.date.context_today, @@ -245,7 +245,7 @@ class purchase_order(osv.osv): 'invoice_method': 'order', 'invoiced': 0, 'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id, - 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c), + 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c), 'journal_id': _get_journal, 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id, 'picking_type_id': _get_picking_in, diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index b23a71b8fa0..23ff2f3271e 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -197,7 +197,7 @@ - + Requests for Quotation ir.actions.act_window purchase.order - {} + {'special_shortened_wh_name': True} [('state','in',('draft','sent','bid','cancel', 'confirmed'))] tree,form,graph,calendar @@ -372,7 +372,7 @@ ir.actions.act_window purchase.order tree,form,graph,calendar - {} + {'special_shortened_wh_name': True} [('state','not in',('draft','sent','bid', 'confirmed'))] diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 0c8df8f8173..15f6b31f36d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2616,6 +2616,8 @@ class stock_picking_type(osv.osv): def name_get(self, cr, uid, ids, context=None): """Overides orm name_get method to display 'Warehouse_name: PickingType_name' """ + if context is None: + context = {} if not isinstance(ids, list): ids = [ids] res = [] @@ -2625,6 +2627,11 @@ class stock_picking_type(osv.osv): name = record.name if record.warehouse_id: name = record.warehouse_id.name + ': ' +name + if context.get('special_shortened_wh_name'): + if record.warehouse_id: + name = record.warehouse_id.name + else: + name = _('Customer') + ' (' + record.name + ')' res.append((record.id, name)) return res