Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/16/16, 4:01 AM|
|Seen: 499 times|
|Last updated: 2/16/16, 4:31 AM|