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.

0

How can I retrieve the production_id of a stock.move of a Delivery Order in an RML report?

By
Mathieu Planche
on 8/13/14, 6:21 PM 947 views

I'm trying to edit the RML report of the Delivery Order ( /addons/delivery/report/shipping.rml) so that it displays not only the finished products, but also the detailed list of the products that were consumed in the Manufacturing Order and their associated serial numbers.

I understand that in order to do so, I need to access the consumed products list (mrp_production.move_lines2) of the Manufacturing Order associated to the Delivery Order. And I thought I could do that by doing the following : 

- One loop to iterate on the move lines of the Delivery Order : [[repeatIn(o.move_lines, 'do_line')]]

- Another loop to iterate on the consumed products list : [[repeatIn(do_line.production_id.move_lines2, 'mo_lines')]]

However, it seems like the production_id field associated to my stock_move (do_line) is empty. When I try to print on the report [[do_line.sale_line_id]], it prints "browse_record(sale.order.line, 1)", which makes sense. When I try to print on the report [[do_line.production_id]] it doesn't print anything.

When I check the online documentation (http://useopenerp.com/v8/model/stock-move#columns-product_id), it tells me that the production_id field is a "column extended with add-on mrp > stock.py > class StockMove". I however do believe that I have the mrp module installed, since I can manage my Manufacturing Orders and since I can find the file /addons/mrp/stock.py.

 

Can someone please help me with this matter? I'd be forever grateful :-)

0
Mathieu Planche
On 8/14/14, 11:11 AM

Thanks for your reply Abegail.

I thought this is what I had done. Let me paste my code here:

 

    <para style="terp_default_9">[[repeatIn(objects,'o')]]</para>

    [......]

    <section>
      <para style="terp_default_1">[[repeatIn(o.move_lines,'do_line')]]</para>
      <blockTable colWidths="83.0,370.0,85.0" style="Table4">
        <tr>
          <td>
            <para style="terp_default_9">[[formatLang(do_line.product_qty)]]</para>
          </td>
          <td>
            <para style="terp_default_9">[[do_line.product_id and do_line.product_id.name or '']]</para>
          </td>
          <td>
            <para style="terp_default_Right_9">[[(do_line.prodlot_id and (do_line.prodlot_id.name + (do_line.prodlot_id.ref and ('/' + do_line.prodlot_id.ref) or ''))) or '']]</para>
          </td>
        </tr>
        <tr>
          <td></td>
          <td>including:</td>
          <td></td>
        </tr>
      </blockTable>
      <section>
        <para style="terp_default_1">[[repeatIn(do_line.production_id.move_lines2, 'mo_line')]]</para>
        <blockTable colWidths="83.0,370.0,85.0" style="Table4">
          <tr>
            <td>
              <para style="terp_default_9">[[formatLang(mo_line.product_qty)]]</para>
            </td>
              <td>
              <para style="terp_default_9">[[mo_line.product_id and do_line.product_id.name or '']]</para>
            </td>
            <td>
              <para style="terp_default_9">[[(mo_line.prodlot_id and (mo_line.prodlot_id.name + (mo_line.prodlot_id.ref and ('/' + mo_line.prodlot_id.ref) or ''))) or '']]</para>
            </td>
          </tr>
        </blockTable>
      </section>
      <para style="terp_default_1">
        <font color="white"> </font>
      </para>
    </section>

But the problem is that [[repeatIn(do_line.production_id.move_lines2, 'mo_line')]] yields the error "Cannot iterate on NoneType object" and that when I try to do [[do_line.production_id]], the result is empty.

Thanks again for your help!

0
Abegail Sanchez
On 8/14/14, 12:38 AM

You need to iterate again the object..

<para style="P10">[[ repeatIn(objects,'o') ]]</para>

parent table

<tr>
        <td>
          <para style="P5">[[ o.name ]]</para>
        </td>

</tr>

child table

<tr>
          <para style="P10">[[ repeatIn(o.do_line,'line') ]]</para>
        <td>
          <para style="P5">[[ line.production_id ]]</para>
        </td>

</tr>

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: 8/13/14, 6:21 PM
Seen: 947 times
Last updated: 3/16/15, 8:10 AM