Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
8181 Lượt xem

ValueError: Wrong value for inward.item_category: {u'time_in': False, u'vehicle_type': False, u'lc': False, u'vehicle': False, u'invoice_ref': False, u'bilty': False, u'date': False, u'gin': False, u'time_out': False, u'document_type': False, u'id': False, u'supplier_details': False}

.py file


class inwardpass(models.Model):

_name='inwardpass'

date = fields.Date('Date', required=True)

document_type = fields.Boolean('LC or PO')

invoice_ref = fields.Char('Invoice Ref #')

gin = fields.Char('GIN #')

lc = fields.Char('LC Ref.#/PO #')

bilty = fields.Char('Bilty ')

time_out = fields.Date('Time Out', required=True)

vehicle = fields.Char('Vehicle')

time_in = fields.Date('Time In', required=True)

vehicle_type = fields.Char('Vehicle Type')

supplier_details= fields.Char('Supplier Details')

Details = fields.One2many('inward','item_category',ondelete='cascade')

class inward(models.Model):

_name = 'inward'

item_category = fields.One2many('inwardpass','Details','Item Category')

uom = fields.Char('UOM')

qty = fields.Char('QTY')

item = fields.Char('Item Category')


XML file


<notebook position="after">

<page string="Details">

<group col="4" colspan="4" string="General">

<field name="Details"  >

<tree>

<field name="item" placeholder="Item Category" />

<field name="uom" placeholder="UMO"/>

<field name="qty" placeholder="Quantity"/>

</tree>

</field>

</group>

</page>

</notebook>


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

In one2many field you should have a many2one field as inverse name in the related model. which you haven't,

your two fields with types One2many, kindly check this link for more details


Regards,

Ảnh đại diện
Huỷ bỏ