For a specific partner and a specific product I want to get the last price for that I tried this one but I get not the last_price
def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, company_id=None, context=None):
res = super(kms_account_invoice_line, self).product_id_change(cr, uid, ids, product, uom_id, qty, name, type, partner_id, fposition_id, price_unit, currency_id=currency_id, company_id=company_id, context=context)
acc_inv_obj = self.pool.get('account.invoice.line')
acc_inv_ids = acc_inv_obj.search(cr, uid,[('partner_id', '=', partner_id),('product_id','=',product)], context=context)
for acc_inv_data in acc_inv_obj.browse(cr, uid, acc_inv_ids, context=context):
could you help me please to get the write last_price.
acc_inv_ids = acc_inv_obj.search(cr, uid,[('partner_id', '=', partner_id),('product_id','=',product), ('id', 'not in', [ids])], ,order="asc", limit=1, context=context)
Use this domain in your search so it will return latest id of the invoice line and return only single id at a time because we used limit=1 and in case you didn't get any id from the search then please remove ('id', 'not in', [ids]) this domain from search.
hope this will help you.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 2/16/16, 4:01 AM|
|Seen: 267 times|
|Last updated: 2/16/16, 4:31 AM|