Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2346 Zobrazení

in stock.picking, i added a new one2many field for printing

class incomingShipments_picking(osv.osv):

    _inherit = 'stock.picking.in'
    
    _columns = {
        'summary_lines': fields.one2many('stock.move.summary', 'picking_id', 'Summary'),
    }
incomingShipments_picking();

class incomingshipments_summary(osv.osv):

    _name = 'stock.move.summary'
    
    _columns = {
        'product_id': fields.many2one('product.product', 'Product'),
        'picking_id': fields.many2one('stock.picking', 'Reference'),
        'qty': fields.integer('Quantity'),
        'state': fields.selection(
        [('draft', 'Draft'),
        ('auto', 'Waiting Another Operation'),
        ('confirmed', 'Waiting Availability'),
        ('assigned', 'Inbound'),
        ('delivered', 'Delivered'),
        ('done', 'Received'),
        ('cancel', 'Cancelled'),],
        'Status', select=True),
        'date': fields.datetime('Date', select=True, states={'done': [('readonly', True)]}),

    }
incomingshipments_summary();

and i added a section in my rml file:

<section>
        <para style="P1">[[repeatIn(o.summary_lines,'l')]]</para>
        <blockTable colWidths="280,255" style="Table_Order_Pur_line_Content">
        <tr>
            <td>
                <para style="P1">[[l.product_id.name]]</para>
            </td>
            <td>
                <para style="P1">[[l.qty]]</para>
            </td>
        </tr>
      </blockTable>
    </section>

and it shows error

except_osv: (u'summary_lines', (<type 'exceptions.AttributeError'>, AttributeError(KeyError('summary_lines',),), <traceback object at 0x7ff9fbd47ef0>))

 

What should I do to solve this problem?

Avatar
Zrušit

@Willie Does your 'o' refers to the model 'stock.picking.in', check this in your rml report

Nejlepší odpověď

For stock.picking (including stock.picking.in and stock.picking.put), you need to also define the same columns for stock.picking.  You cannot only define it for stock.picking.in or stock.picking.out.

Avatar
Zrušit