If you do in this way, aren't you doing LIFO or trying at least? Standard price is not the last one that you purchase the product, and this willbe the result obtained with your algoritmh friend.
Standard price is calculated with so many factors envolved in obtain the product, and it can not be taken from PO, at least not for accounting porpose. Regards. Reference: Rather than assigning the actual costs of direct material, direct labor, and manufacturing overhead to a product, many manufacturers assign the expected or standard cost. This means that a manufacturer's inventories and cost of goods sold will begin with amounts reflecting the standard costs, not the actual costs, of a product. Manufacturers, of course, still have to pay the actual costs. As a result there are almost always differences between the actual costs and the standard costs, and those differences are known as *variances<http://www.accountingcoach.com/terms/V/variance.html> *. SOurce: http://www.accountingcoach.com/online-accounting-course/30Xpg01.html 2012/1/27 Ferdinand @ Camptocamp <[email protected]> > Hmm > I try to find a price in PO and if not I take it from product, > nevertheless it could be possible that there is no price either, have to > check how the validation moves are evaluated > > standard_price = '' > if i_line.product_id.cost_method == > 'average': > po_obj = self.pool.get('purchase.order') > po_lines_obj = > self.pool.get('purchase.order.line') > po_ids = po_obj.search(cr, uid, > [('invoice_ids','=', inv.id )]) > > logger.notifyChannel('addons.'+self._name, netsvc.LOG_INFO, 'po_ids: %s' % > po_ids) > po_line_ids = po_lines_obj.search(cr, > uid, [('order_id','in', po_ids ), ('product_id','=',i_line.product_id.id > )]) > for po_lines in po_lines_obj.browse(cr, > uid, po_line_ids): > standard_price = po_lines.price_unit > > logger.notifyChannel('addons.'+self._name, netsvc.LOG_INFO, 'po_id > standard_price: %s' % standard_price) > > if not standard_price: > standard_price = > self.pool.get('product.uom')._compute_price(cr, uid, uom.id, > i_line.product_id.standard_price, i_line.uos_id.id) > > -- > You received this bug notification because you are subscribed to OpenERP > Project Group. > https://bugs.launchpad.net/bugs/922077 > > Title: > anglo saxon - must handle product price diff between purchase and > invoice > > Status in OpenERP Addons (modules): > Incomplete > > Bug description: > very often the purchase order price is an indication, but the "real" > (day) price is different > > using anglo saxon method this difference must result in a account > move line to balance the input account > > patch will follow > > To manage notifications about this bug go to: > https://bugs.launchpad.net/openobject-addons/+bug/922077/+subscriptions > -- -------------------- Saludos Cordiales Nhomar G. Hernandez M. +58-414-4110269 Skype: nhomar00 Web-Blog: http://geronimo.com.ve Servicios IT: http://openerp.com.ve Linux-Counter: 467724 Correos: [email protected] [email protected] twitter @nhomar -- You received this bug notification because you are a member of OpenERP Framework Experts, which is subscribed to OpenERP Addons. https://bugs.launchpad.net/bugs/922077 Title: anglo saxon - must handle product price diff between purchase and invoice Status in OpenERP Addons (modules): Incomplete Bug description: very often the purchase order price is an indication, but the "real" (day) price is different using anglo saxon method this difference must result in a account move line to balance the input account patch will follow To manage notifications about this bug go to: https://bugs.launchpad.net/openobject-addons/+bug/922077/+subscriptions -- Mailing list: https://launchpad.net/~credativ Post to : [email protected] Unsubscribe : https://launchpad.net/~credativ More help : https://help.launchpad.net/ListHelp

