Skip to Content
Menu
This question has been flagged
1 Odpoveď
5672 Zobrazenia

I'm trying to upload a file in the a custom model but I'm getting the following error:

aError:
Uncaught TypeError: Cannot read property 'clone' of undefined
http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:957
Rastreo de error:
TypeError: Cannot read property 'clone' of undefined
at Object.formatDateTime [as datetime] (http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:957:69)
at Class._renderBodyCell (http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:1575:137)
at http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:1593:132
at Function._.map._.collect (http://odoo:8069/web/content/3751-9f77f21/web.assets_common.js:13:270)
at Class._renderRow [as _super] (http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:1593:82)
at Class._renderRow (http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:1538:71)
at Class._renderRow (http://odoo:8069/web/content/3751-9f77f21/web.assets_common.js:3814:371)
at Function._.map._.collect (http://odoo:8069/web/content/3751-9f77f21/web.assets_common.js:13:270)
at Class._renderRows (http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:1594:85)
at Class._renderRows (http://odoo:8069/web/content/3752-d2319e5/web.assets_backend.js:1539:53)
There is my code

class partner_document(models.Model):    
_name = "partner.document"
_rec_name = "doc_type"
global function_env
function_env = 'pecuchile.partner.functions'
partner_id = fields.Many2one('res.partner', string=u"Tercero", ondelete="cascade")
doc_type = fields.Selection([(u'cover_letter', u'Carta de respaldo'),
(u'dni', u'DNI'),
                                 (u'rut', u'RUT'),
                                 (u'institution_document', u'RUT Tributario'),
(u'other', u'Otro') ], string=u"Tipo de documento",

required=True)
document_filename = fields.Char(string=u"Nombre de archivo")
document = fields.Binary(string=u"Archivo")
description = fields.Text(string=u"Descripción") 
rut_serie = fields.Char(string=u"Número/Serie")
 
comment = fields.Text(string=u"Comentarios adicionales")
still_valid = fields.Selection([(u'valid', u'Documento Válido'),
(u'invalid', u'Documento caducado')
                                ], default=u'valid', string=u"Validez", required=True)
additional_data = fields.Boolean(string=u"¿Información adicional?")

The model partner_document its called from another model (an extended version of res.partner) whit this declaration:

document_ids = fields.One2many('partner.document', 'partner_id', string=u"Documentos")

I've tried with different widgets and field declarations, but all ends in the same error message.

Regards

Avatar
Zrušiť
Autor Best Answer

Finally I've solved my problem, the issue was generated by the create_date field In my view, because when you create a new record through a M2O (I suppose is the same for O2M or M2M fields), the recordas are not saved to the database until you  save the parent record. So I've removed the create_date from the view and solved my issue.

Now im going to make a calculated field for the creation date of the record.

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
2
feb 23
8946
0
júl 16
4364
2
sep 23
17432
1
dec 22
5567
1
máj 21
8785