Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2361 Vizualizări

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?

Imagine profil
Abandonează

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

Cel mai bun răspuns

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.

Imagine profil
Abandonează