Skip to Content
Menu
This question has been flagged
2573 Views

hello i need to add currency to quotation model. here is my code: 

from openerp.osv import osv, fields

import openerp.addons.decimal_precision as dp

class SaleOrder(osv.osv):

_inherit = 'sale.order'

_columns = {

'expiry': fields.datetime("Quotation Expiry Date"),

'ord_lead_time': fields.many2one(

'account.payment.term',

"ORD Lead-Time"),

'requestor_po': fields.char("Requestor PO"),

'incoterm_id': fields.many2one(

'stock.incoterms', 'Incoterm',

help="International Commercial Terms are a series of predefined commercial terms "),

'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement.')

}

class SaleOrderLine(osv.osv):

_inherit = 'sale.order.line'

def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,

uom=False, qty_uos=0, uos=False, name='', partner_id=False,

lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, order_line_label=False, flag=False, context=None):

context = context or {}

res = super(SaleOrderLine, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,

uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,

lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)

return {'value': {'price_unit':price_unit*line.order_id.currency.rate}}


i need to call the currency rate from sale order current id how can i do this?

Avatar
Discard
Related Posts Replies Views Activity
0
Jul 24
162
1
Apr 24
328
2
Jan 24
536
2
Nov 23
1004
0
Nov 23
692