Odoo Help


How to determine the cost of goods sold?

Marcio Valenzuela P
on 9/11/15, 2:03 PM 814 views

I'm pulling data from the dB to determine the cogs for the month of August.  So far I pulled all SO's that resulted in invoices but the cost for each invoice comes up null presumably because the cost changes constantly.

How should I handle this?

What query are you using?

on 9/11/15, 3:10 PM

Thanks. Well it's kinda long but here it goes: SELECT so."name", f."number" Factura, fl.origin, fl."name" Producto, fl.price_unit Precio_Unitario, (sl.margin * fl.quantity) margen, (fl.price_subtotal - (sl.margin * fl.quantity)) costo, fl.quantity Cantidad, fl.price_subtotal SubTotal, sl.margin FROM res_partner so RIGHT JOIN account_invoice f ON so."id" = f.partner_id RIGHT JOIN account_invoice_line fl ON f."id" = fl.invoice_id INNER JOIN sale_order_line_invoice_rel vr ON vr.order_line_id = fl."id" INNER JOIN sale_order_line sl ON sl."id" = vr.order_line_id INNER JOIN sale_order s ON sl.order_id = s."id" LEFT JOIN stock_picking sp ON sp.origin = s."name" LEFT JOIN stock_move mo ON sp."id" = mo.picking_id WHERE f."type" = 'out_invoice' AND ( f.date_invoice BETWEEN '20150801' AND '20150830' ) GROUP BY so."name", f."number", fl.origin, fl."name", fl.price_unit, sl.price_unit, fl.quantity, fl.price_subtotal, sl.margin ORDER BY f."number"

Marcio Valenzuela P
on 9/11/15, 3:12 PM

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/11/15, 2:03 PM
Seen: 814 times
Last updated: 9/11/15, 3:12 PM