Odoo Help

Welcome!

This community 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.

1

How to determine the cost of goods sold?

By
Santiago EV
on 9/11/15, 2:03 PM 422 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?

Marcio
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"

Santiago EV
on 9/11/15, 3:12 PM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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