diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 849e558563a..0ad39fca4f8 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -186,7 +186,7 @@ class purchase_order(osv.osv):
'warehouse_id': fields.many2one('stock.warehouse', 'Destination Warehouse'),
'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')], states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]} ),
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
- 'currency_id': fields.related('pricelist_id', 'currency_id', type="many2one", relation="res.currency", string="Currency",readonly=True, required=True),
+ 'currency_id': fields.many2one('res.currency','Currency', readonly=True, required=True,states={'draft': [('readonly', False)],'sent': [('readonly', False)]}),
'state': fields.selection(STATE_SELECTION, 'Status', readonly=True, help="The status of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' status. Then the order has to be confirmed by the user, the status switch to 'Confirmed'. Then the supplier must confirm the order to change the status to 'Approved'. When the purchase order is paid and received, the status becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the status becomes in exception.", select=True),
'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'approved':[('readonly',True)],'done':[('readonly',True)]}),
'validator' : fields.many2one('res.users', 'Validated by', readonly=True),
@@ -237,6 +237,7 @@ class purchase_order(osv.osv):
'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),
'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
}
_sql_constraints = [
('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!'),
@@ -544,7 +545,7 @@ class purchase_order(osv.osv):
'account_id': pay_acc_id,
'type': 'in_invoice',
'partner_id': order.partner_id.id,
- 'currency_id': order.pricelist_id.currency_id.id,
+ 'currency_id': order.currency_id.id,
'journal_id': len(journal_ids) and journal_ids[0] or False,
'invoice_line': [(6, 0, inv_lines)],
'origin': order.name,
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 4432d2b3200..91fb2525be6 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -191,7 +191,7 @@
-
+
diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py
index e64c12a2359..be4169c4624 100644
--- a/addons/purchase/stock.py
+++ b/addons/purchase/stock.py
@@ -70,7 +70,7 @@ class stock_picking(osv.osv):
def get_currency_id(self, cursor, user, picking):
if picking.purchase_id:
- return picking.purchase_id.pricelist_id.currency_id.id
+ return picking.purchase_id.currency_id.id
else:
return super(stock_picking, self).get_currency_id(cursor, user, picking)
@@ -129,7 +129,7 @@ class stock_partial_picking(osv.osv_memory):
def _product_cost_for_average_update(self, cr, uid, move):
if move.picking_id.purchase_id:
return {'cost': move.purchase_line_id.price_unit,
- 'currency': move.picking_id.purchase_id.pricelist_id.currency_id.id}
+ 'currency': move.picking_id.purchase_id.currency_id.id}
return super(stock_partial_picking, self)._product_cost_for_average_update(cr, uid, move)
# Redefinition of the new field in order to update the model stock.picking.in in the orm
diff --git a/addons/purchase/wizard/purchase_line_invoice.py b/addons/purchase/wizard/purchase_line_invoice.py
index f97d82a8456..b8ee4b69a32 100644
--- a/addons/purchase/wizard/purchase_line_invoice.py
+++ b/addons/purchase/wizard/purchase_line_invoice.py
@@ -83,7 +83,7 @@ class purchase_line_invoice(osv.osv_memory):
'account_id': a,
'partner_id': partner.id,
'invoice_line': [(6,0,lines_ids)],
- 'currency_id' : orders[0].pricelist_id.currency_id.id,
+ 'currency_id' : orders[0].currency_id.id,
'comment': multiple_order_invoice_notes(orders),
'payment_term': orders[0].payment_term_id.id,
'fiscal_position': partner.property_account_position.id