odoo 获取字段 string

FIELDS_LIST = ['other_file']
    @api.model
    def create(self, vals_list):
        res = super(UprodSupplier, self).create(vals_list)
        licence_field = [rec for rec in vals_list if rec in FIELDS_LIST and vals_list[rec]]
        if licence_field:
            res.update_supplier_licence(licence_field)
        return res

    def write(self, vals_list):
        res = super(UprodSupplier, self).write(vals_list)
        licence_field = [rec for rec in vals_list if rec in FIELDS_LIST and vals_list[rec]]
        if licence_field:
            self.update_supplier_licence(licence_field)
        return res
    def update_supplier_licence(self, file_fields):
        for file_field in file_fields:
            start_date, send_date = self.get_start_end_value(file_field)
            licence_id = self.env['licence.type'].sudo().create(
                {'name': self._fields[file_field].string, 'advance_reind': 5,
                 'licence_type': self.env.ref('uprod_supplier.supplier_licence_supplier').id,
                 'accept_roles': self.create_uid.id,
                 'supplier_id': self.id, 'file_field': file_field, 'start_date': start_date, 'end_date': send_date})

你可能感兴趣的:(odoo14,odoo15,ERP,python,odoo16)