Skip to Content
Menu
This question has been flagged
1 Reply
5621 Views

I am using Odoo 12 and I would like to make a report for printing the Inventory Valuation at specific date. When I look at the list the quantities are correct and the value also, but when I try to make it work in a report it shows something else, it doesn't take the same value.

   <report id="report_inventory_valuation"
      model="product.product"
      string="Inventory Valuation Report"
      name="mymodule.inventory_valuation_report"
      file="mymodule.inventory_valuation"
      report_type="qweb-pdf" />

    <template id="inventory_valuation_report">
      <t t-call="web.html_container">
        <t t-call="web.external_layout">
          <div class="page">
            <h2>Inventory Valuation Report</h2>
            <div class="row mt32 mb32">
              <div class="col-3">
                <!--<t t-esc="datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')"/>-->
              </div>
            </div>

            <table class="table table-sm">
              <thead>
                <th>#</th>
                <th>SKU</th>
                <th>Name</th>
                <th>Quantity</th>
                <th>Price</th>
              </thead>
              <tbody>
                <t t-set="inventory_cost" t-value="0"/>
                <t t-set="index" t-value="1"/>
                <tr t-foreach="docs.sorted(key=lambda x: x.name)" t-as="product"> <t t-if="product.standard_price > 0 and product.qty_at_date > 0"> <td t-esc="index"/><t t-set="index" t-value="index + 1"/> <td t-if="product.code"> [<span t-esc="product.code"/>] </td> <td t-else=""> </td> <td><span t-esc="product.name"/></td> <td><span t-esc="'{0:,.2f}'.format(product.qty_at_date)"/></td> <td><span t-esc="'{0:,.2f}'.format(product.standard_price * product.qty_at_date)"/></td> <t t-set="inventory_cost" t-value="inventory_cost + (product.standard_price * product.qty_at_date)"/> </t> </tr> </tbody>
<tfoot> <tr> <td>TOTAL</td> <td colspan="3"/> <td t-esc="'{0:,.2f}'.format(inventory_cost)"/> </tr> </tfoot> </table> </div> </t> </t> </template>
It shows actually the current value in stock not what I ask qty_at_date. Is there a solution to get the qty_at_date computed correctly on a qweb report?    
Avatar
Discard

product.with_context({'to_date': date_val}).qty_available

Best Answer

Please follow the link: https://www.odoo.com/forum/help-1/how-to-get-specific-date-product-stock-opening-stock-in-odoo-12cc-149213

Avatar
Discard
Related Posts Replies Views Activity
0
Oct 24
143
6
Jan 24
11499
7
Dec 23
20073
4
Nov 24
5233
1
Mar 24
393