0

Hi when i try a fucntion to get one2many track_visibility in odoo 10 , when i click on save it throws me this error:

NameError: global name 'Anything' is not defined

This is My code :

class TransportManagementLines(models.Model):

    
    _name = 'transport.management.lines'
    _inherit = ['mail.thread','ir.needaction_mixin']
    _description = 'Transport Management Lines'
    _rec_name = 'chauffeur'
    

    lines_id = fields.Many2one('transport.management',string="Crée Par")
    chauffeur = fields.Many2one('transport.management.matricule',string='Nom Chauffeur', required="1")

This is the function i use:

 @api.model
    def create(self, vals):
                res = super(Anything, self).create(vals)
                if vals:
                    message = "Changes info"
                    res.lines_id.message_post(message)
                return res

  • It looks like you have note defined the variable `Anything` in the code. – Sefan Aug 06 '21 at 09:49
  • How i can define that ? – Abdellah Hajjam Aug 06 '21 at 09:53
  • Based on the code you posted `Anything` should be replaced with `TransportManagementLines`. See https://www.odoo.com/documentation/10.0/howtos/backend.html for more information – Sefan Aug 06 '21 at 10:01
  • it solve that error Thanks for you help but when i change a one2many fields nothing shows in the chatter log like if i change a field called state from accept to delete nothing shows – Abdellah Hajjam Aug 06 '21 at 10:18

0 Answers0