Beispiel #1
0
    def postprocess_and_fields(self, cr, user, model, node, view_id, context=None):
        """ Return an architecture and a description of all the fields.

        The field description combines the result of fields_get() and
        postprocess().

        :param node: the architecture as as an etree
        :return: a tuple (arch, fields) where arch is the given node as a
            string and fields is the description of all the fields.

        """
        fields = {}
        Model = self.pool.get(model)
        if not Model:
            self.raise_view_error(cr, user, _('Model not found: %(model)s') % dict(model=model), view_id, context)

        if node.tag == 'diagram':
            if node.getchildren()[0].tag == 'node':
                node_model = self.pool[node.getchildren()[0].get('object')]
                node_fields = node_model.fields_get(cr, user, None, context)
                fields.update(node_fields)
                if not node.get("create") and not node_model.check_access_rights(cr, user, 'create', raise_exception=False):
                    node.set("create", 'false')
            if node.getchildren()[1].tag == 'arrow':
                arrow_fields = self.pool[node.getchildren()[1].get('object')].fields_get(cr, user, None, context)
                fields.update(arrow_fields)
        else:
            fields = Model.fields_get(cr, user, None, context)

        fields_def = self.postprocess(cr, user, model, node, view_id, False, fields, context=context)
        node = self._disable_workflow_buttons(cr, user, model, node)
        if node.tag in ('kanban', 'tree', 'form', 'gantt'):
            for action, operation in (('create', 'create'), ('delete', 'unlink'), ('edit', 'write')):
                if not node.get(action) and not Model.check_access_rights(cr, user, operation, raise_exception=False):
                    node.set(action, 'false')
        if node.tag in ('kanban'):
            group_by_field = node.get('default_group_by')
            if group_by_field and Model._all_columns.get(group_by_field):
                group_by_column = Model._all_columns[group_by_field].column
                if group_by_column._type == 'many2one':
                    group_by_model = Model.pool.get(group_by_column._obj)
                    for action, operation in (('group_create', 'create'), ('group_delete', 'unlink'), ('group_edit', 'write')):
                        if not node.get(action) and not group_by_model.check_access_rights(cr, user, operation, raise_exception=False):
                            node.set(action, 'false')

        arch = etree.tostring(node, encoding="utf-8").replace('\t', '')
        for k in fields.keys():
            if k not in fields_def:
                del fields[k]
        for field in fields_def:
            if field == 'id':
                # sometime, the view may contain the (invisible) field 'id' needed for a domain (when 2 objects have cross references)
                fields['id'] = {'readonly': True, 'type': 'integer', 'string': 'ID'}
            elif field in fields:
                fields[field].update(fields_def[field])
            else:
                message = _("Field `%(field_name)s` does not exist") % \
                                dict(field_name=field)
                self.raise_view_error(cr, user, message, view_id, context)
        return arch, fields
Beispiel #2
0
    def payment_disapproves(self, cr, uid, ids, context=None):
        '''
        Mark boolean as False, to Disapprove invoice to be pay.
        Added message to messaging block of supplier invoice, 
        when disapproved to Pay.        
        '''
        context = context or {}

        context.update({'default_body':_(u'Invoice Disapproved to Pay'),
                        'default_parent_id': False,
                        'mail_post_autofollow_partner_ids': [],
                        'default_attachment_ids': [],
                        'mail_post_autofollow': True,
                        'default_composition_mode': '',
                        'default_partner_ids': [],
                        'default_model': 'account.invoice',
                        'active_model': 'account.invoice',
                        'default_res_id': ids and type(ids) is list and \
                                          ids[0] or ids,
                        'active_id': ids and type(ids) is list and \
                                          ids[0] or ids,
                        'active_ids': ids and type(ids) is list and \
                                          ids or [ids],
                        'stop':True,
                        })

        mail_obj = self.pool.get('mail.compose.message')
        fields = mail_obj.fields_get(cr, uid)
        mail_dict = mail_obj.default_get(cr, uid,fields.keys() , context)
        mail_ids = mail_obj.create(cr, uid, mail_dict, context=context)
        mail_obj.send_mail(cr, uid, [mail_ids], context=context)

        return self.write(cr,uid,ids,{'to_pay':False})
Beispiel #3
0
    def postprocess_and_fields(self, cr, user, model, node, view_id, context=None):
        """ Return an architecture and a description of all the fields.

        The field description combines the result of fields_get() and
        postprocess().

        :param node: the architecture as as an etree
        :return: a tuple (arch, fields) where arch is the given node as a
            string and fields is the description of all the fields.

        """
        fields = {}
        Model = self.pool.get(model)
        if not Model:
            self.raise_view_error(cr, user, _('Model not found: %(model)s') % dict(model=model), view_id, context)

        if node.tag == 'diagram':
            if node.getchildren()[0].tag == 'node':
                node_model = self.pool[node.getchildren()[0].get('object')]
                node_fields = node_model.fields_get(cr, user, None, context)
                fields.update(node_fields)
                if not node.get("create") and not node_model.check_access_rights(cr, user, 'create', raise_exception=False):
                    node.set("create", 'false')
            if node.getchildren()[1].tag == 'arrow':
                arrow_fields = self.pool[node.getchildren()[1].get('object')].fields_get(cr, user, None, context)
                fields.update(arrow_fields)
        else:
            fields = Model.fields_get(cr, user, None, context)

        fields_def = self.postprocess(cr, user, model, node, view_id, False, fields, context=context)
        node = self._disable_workflow_buttons(cr, user, model, node)
        if node.tag in ('kanban', 'tree', 'form', 'gantt'):
            for action, operation in (('create', 'create'), ('delete', 'unlink'), ('edit', 'write')):
                if not node.get(action) and not Model.check_access_rights(cr, user, operation, raise_exception=False):
                    node.set(action, 'false')
        if node.tag in ('kanban'):
            group_by_field = node.get('default_group_by')
            if group_by_field and Model._all_columns.get(group_by_field):
                group_by_column = Model._all_columns[group_by_field].column
                if group_by_column._type == 'many2one':
                    group_by_model = Model.pool.get(group_by_column._obj)
                    for action, operation in (('group_create', 'create'), ('group_delete', 'unlink'), ('group_edit', 'write')):
                        if not node.get(action) and not group_by_model.check_access_rights(cr, user, operation, raise_exception=False):
                            node.set(action, 'false')

        arch = etree.tostring(node, encoding="utf-8").replace('\t', '')
        for k in fields.keys():
            if k not in fields_def:
                del fields[k]
        for field in fields_def:
            if field == 'id':
                # sometime, the view may contain the (invisible) field 'id' needed for a domain (when 2 objects have cross references)
                fields['id'] = {'readonly': True, 'type': 'integer', 'string': 'ID'}
            elif field in fields:
                fields[field].update(fields_def[field])
            else:
                message = _("Field `%(field_name)s` does not exist") % \
                                dict(field_name=field)
                self.raise_view_error(cr, user, message, view_id, context)
        return arch, fields
Beispiel #4
0
    def send_mail_task(self, cr, uid, ids, template, context=None):
        imd_obj = self.pool.get('ir.model.data')
        template_ids = imd_obj.search(cr, uid,
                                      [('model', '=', 'email.template'),
                                       ('name', '=', template)])
        if template_ids:
            res_id = imd_obj.read(cr, uid, template_ids,
                                  ['res_id'])[0]['res_id']

            followers = self.read(
                cr, uid, ids.get('id'),
                ['message_follower_ids'])['message_follower_ids']

            ids = [ids.get('id')]
            body_html = self.pool.get('email.template').read(
                cr, uid, res_id, ['body_html']).get('body_html')
            context.update({
                'default_template_id':
                res_id,
                'default_body':
                body_html,
                'default_use_template':
                True,
                'default_composition_mode':
                'comment',
                'active_model':
                'project.task',
                'default_partner_ids':
                followers,
                'mail_post_autofollow_partner_ids':
                followers,
                'active_id':
                ids and type(ids) is list and ids[0] or ids,
                'active_ids':
                ids and type(ids) is list and ids or [ids],
            })

            mail_obj = self.pool.get('mail.compose.message')
            fields = mail_obj.fields_get(cr, uid)
            mail_ids = mail_obj.default_get(cr,
                                            uid,
                                            fields.keys(),
                                            context=context)
            mail_ids.update({
                'model': 'project.task',
                'body': body_html,
                'composition_mode': 'mass_mail',
                'partner_ids': [(6, 0, followers)]
            })
            mail_ids = mail_obj.create(cr, uid, mail_ids, context=context)
            mail_obj.send_mail(cr, uid, [mail_ids], context=context)

        return False
def prepare_salesforce_query(resource, fields, context=None):
    """
    Generat Query for SalesForce
    @param resource: SalesForce Table name
    @param fields: fields list
    @return: string
    """
        
    field_string ="" 
    for field in fields.keys():
       field_string += field+','
    field_string  += "Id"  
    query= "SELECT "+field_string+ " FROM "+resource
    return query 
    def analytic_fields_get(self, cr, uid, model, fields, prefix="a", suffix="id", context=None):
        """Set the label values for the analytic fields."""

        ans_dict = self.get_dimensions_names(cr, uid, model, context=context)

        regex = "{pre}(\d+)_{suf}".format(pre=prefix, suf=suffix)
        match_fct = re.compile(regex).search
        matches = filter(None, map(match_fct, fields.keys()))

        for match in matches:
            field = match.group(0)
            slot = match.group(1)
            fields[field]["string"] = ans_dict.get("{0}".format(slot), "{0}{1}".format(prefix.upper(), slot))

        return fields
Beispiel #7
0
    def set_import_order(self, cr, uid, ids, context={}):

        inst = self.browse(cr, uid, ids)[0]
        fields = self.fields_get(cr,uid)
        f_names = fields.keys()
        f_names_bool = [i for i in f_names if i.startswith('x_bool_')]

        f_names_bool_true = []
        for attr in f_names_bool:
            if getattr(inst, attr):
                f_names_bool_true.append(attr.replace('x_bool_','x_'))

        li = [ getattr(inst, fld) for fld in f_names_bool_true]
        #yustas
#         for pos in li:
#             if li.count(pos)>1:
#                 raise osv.except_osv('Warning', 'Duplicated field position !')
                #raise osv.except_osv(_('Warning'), _('Duplicated field position !'))

        di = {}
        for fld in f_names_bool_true:
#            di[getattr(inst, fld)] = fld
#yustas
            di[fld] = getattr(inst, fld)

        st=st_main=''
        keys = di.keys()
     #   values = di.values()
     #   keys.sort()
        
        for key in keys:
            st += ' %s - #%d; ' % (fields[key]['string'], di[key])
            st_main += "'%s':%d," % (key.replace('x_',''),di[key]-1)

#         for key in keys:
#             st += ' %s - #%d; ' % (fields[di[key]]['string'], key)
#             st_main += "%d:'%s'," % (key-1, di[key].replace('x_',''))
        st_main = '{'+st_main[:-1]+'}'
        done = self.write(cr, uid, inst.id, {'import_order':st})
        done = self.write(cr, uid, inst.id, {'import_order_main':st_main})
        
        


        return True
Beispiel #8
0
    def set_import_order(self, cr, uid, ids, context={}):

        inst = self.browse(cr, uid, ids)[0]
        fields = self.fields_get(cr, uid)
        f_names = fields.keys()
        f_names_bool = [i for i in f_names if i.startswith('x_bool_')]

        f_names_bool_true = []
        for attr in f_names_bool:
            if getattr(inst, attr):
                f_names_bool_true.append(attr.replace('x_bool_', 'x_'))

        li = [getattr(inst, fld) for fld in f_names_bool_true]
        #yustas
        #         for pos in li:
        #             if li.count(pos)>1:
        #                 raise osv.except_osv('Warning', 'Duplicated field position !')
        #raise osv.except_osv(_('Warning'), _('Duplicated field position !'))

        di = {}
        for fld in f_names_bool_true:
            #            di[getattr(inst, fld)] = fld
            #yustas
            di[fld] = getattr(inst, fld)

        st = st_main = ''
        keys = di.keys()
        #   values = di.values()
        #   keys.sort()

        for key in keys:
            st += ' %s - #%d; ' % (fields[key]['string'], di[key])
            st_main += "'%s':%d," % (key.replace('x_', ''), di[key] - 1)


#         for key in keys:
#             st += ' %s - #%d; ' % (fields[di[key]]['string'], key)
#             st_main += "%d:'%s'," % (key-1, di[key].replace('x_',''))
        st_main = '{' + st_main[:-1] + '}'
        done = self.write(cr, uid, inst.id, {'import_order': st})
        done = self.write(cr, uid, inst.id, {'import_order_main': st_main})

        return True
 def get_key_values(self, cr, uid, ids, context, tree):
     model_name = tree['model']
     column = tree['column']
     fields = tree['fields']
     model_columns = self.get_columns(cr, uid, model_name, context)
     model_obj = self.pool.get('ir.model')
     keys = []
     for field_name in fields.keys():
         field = fields[field_name]
         if isinstance(field, dict):
             keys.extend(self.get_key_values(cr, uid, ids, context, field))
             continue
         if field:
             model_id = model_obj.search(cr, uid, [('model', '=', model_name)])[0]
             key_values = {
                 'column': column,
                 'model_id': model_id,
                 'name': field_name,
             }
             keys.append((0, 0, key_values))
     
     return keys
 def make_row(self, cr, uid, ids, context, tree):
     model_name = tree['model']
     column = tree['column']
     fields = tree['fields']
     model_columns = self.get_columns(cr, uid, model_name, context)
     row = {}
     header = []
     for field_name in fields.keys():
         field = fields[field_name]
         if isinstance(field, dict):
             new_row, new_header = self.make_row(cr, uid, ids, context, field)
             row.update(new_row)
             header.extend(new_header)
             continue
         if field_name == '.id':
             header.append(column and (column + '.id') or '.id')
             row[column and (column + '.id') or '.id'] = 'Database ID'
             continue
         else:
             header.append((column and (column + '/') or '') + field_name)                                
         row[column and ((column + '/') + field_name) or field_name] = model_columns[field_name].string
     return row, header
 def get_key_values(self, cr, uid, ids, context, tree):
     model_name = tree['model']
     column = tree['column']
     fields = tree['fields']
     model_columns = self.get_columns(cr, uid, model_name, context)
     model_obj = self.pool.get('ir.model')
     keys = []
     for field_name in fields.keys():
         field = fields[field_name]
         if isinstance(field, dict):
             keys.extend(self.get_key_values(cr, uid, ids, context, field))
             continue
         if field:
             model_id = model_obj.search(cr, uid, [('model','=', model_name)])[0]
             key_values = {
                         'column':   column,
                         'model_id': model_id,
                         'name':     field_name,
                           }
             keys.append((0,0,key_values))
     
     return keys
Beispiel #12
0
    def get_prod_fields(self, cr, uid, ids, context={}):

        inst = self.browse(cr, uid, ids)[0]
        fields = self.pool.get(inst.data_type).fields_get(cr,1)
#        fields = self.pool.get('product.proxy').fields_get(cr,1)

        imp_model_id = self.pool.get('ir.model').search(cr, 1, [('model','=','imp.config')])[0]
        #imp_form_ids = self.pool.get('ir.ui.view').search(cr, 1, [('name','=','imp.config.form')])
        imp_form_id = self.pool.get('ir.ui.view').search(cr, 1, [('name','=','imp.config.form')])[-1]
#        imp_form_id = self.pool.get('ir.ui.view').search(cr, 1, [('name','=','imp.config.form')])[0]
        imp_form = self.pool.get('ir.ui.view').browse(cr, 1, imp_form_id)
        arch = imp_form.arch
        st = ''
        end = '''</group>
</form>'''
        allowed_types = ['float', 'integer', 'char', 'text']
        restricted_fields = []
        keys = fields.keys()
        keys.sort()
        for field in keys:
            if fields[field]['type'] in allowed_types and field not in restricted_fields:
                field_descript = fields[field]['string']
                exist = self.pool.get('ir.model.fields').search(cr, 1, [('name','=','x_'+ field),('model_id','=',imp_model_id)])
                if not exist:
                    new = self.pool.get('ir.model.fields').create(cr, 1, {'name':'x_bool_'+ field,
                                                                        'model_id':imp_model_id,
                                                                        'ttype':'boolean',
                                                                        'state':'manual',
                                                                        'field_description': field_descript
                                                                        })
                if ('x_bool_'+field) in arch:
                    continue
                else:
                    st+='''<field name="x_bool_%s" colspan="3" />\n''' % (field,)
        if st:
            arch = arch.replace(end, st+end)
            self.pool.get('ir.ui.view').write(cr, 1, imp_form_id, {'arch': arch})

        return True
 def make_row(self, cr, uid, ids, context, tree):
     model_name = tree['model']
     column = tree['column']
     fields = tree['fields']
     model_columns = self.get_columns(cr, uid, model_name, context)
     row = []
     header = []
     for field_name in fields.keys():
         field = fields[field_name]
         if isinstance(field, dict):
             new_row, new_header = self.make_row(cr, uid, ids, context, field)
             row.extend(new_row)
             header.extend(new_header)
             continue
         if field_name == '.id':
             header.append(column and column + '.id')
             row.append('Database ID')
             continue
         else:
             header.append((column and (column + '/') or '') + field_name)                                
         row.append(model_columns[field_name].string)
     
     return row, header
    def analytic_fields_get(self,
                            cr,
                            uid,
                            model,
                            fields,
                            prefix='a',
                            suffix='id',
                            context=None):
        """Set the label values for the analytic fields."""

        ans_dict = self.get_dimensions_names(cr, uid, model, context=context)

        regex = '{pre}(\d+)_{suf}'.format(pre=prefix, suf=suffix)
        match_fct = re.compile(regex).search
        matches = filter(None, map(match_fct, fields.keys()))

        for match in matches:
            field = match.group(0)
            slot = match.group(1)
            fields[field]['string'] = ans_dict.get(
                '{0}'.format(slot), '{0}{1}'.format(prefix.upper(), slot))

        return fields
    def send_mail_task(self,cr,uid,ids,template,context=None):
        imd_obj = self.pool.get('ir.model.data')
        template_ids = imd_obj.search(
            cr, uid, [('model', '=', 'email.template'), ('name', '=', template)])
        if template_ids:
            res_id = imd_obj.read(
                cr, uid, template_ids, ['res_id'])[0]['res_id']

            followers = self.read(cr, uid, ids.get('id'), [
                                  'message_follower_ids'])['message_follower_ids']

            ids = [ids.get('id')]
            body_html = self.pool.get('email.template').read(
                cr, uid, res_id, ['body_html']).get('body_html')
            context.update({'default_template_id': res_id,
                            'default_body': body_html,
                            'default_use_template': True,
                            'default_composition_mode': 'comment',
                            'active_model': 'project.task',
                            'default_partner_ids': followers,
                            'mail_post_autofollow_partner_ids': followers,
                            'active_id': ids and type(ids) is list and
                            ids[0] or ids,
                            'active_ids': ids and type(ids) is list and
                            ids or [ids],
                            })

            mail_obj = self.pool.get('mail.compose.message')
            fields = mail_obj.fields_get(cr, uid)
            mail_ids = mail_obj.default_get(
                cr, uid, fields.keys(), context=context)
            mail_ids.update(
                {'model': 'project.task', 'body': body_html, 'composition_mode': 'mass_mail', 'partner_ids': [(6, 0, followers)]})
            mail_ids = mail_obj.create(cr, uid, mail_ids, context=context)
            mail_obj.send_mail(cr, uid, [mail_ids], context=context)

        return False
Beispiel #16
0
    def set_imp_prod_fields(self, cr, uid, ids, context={}):

        inst = self.browse(cr, uid, ids)[0]
        self_fields = self.fields_get(cr,uid)
#        self_fields = self.pool.get('imp.config').fields_get(cr,uid)
        keys = self_fields.keys()
        allowed_fields = []
        for key in keys:
            if key.startswith('x_bool_'):
                if getattr(inst,key):
                    allowed_fields.append(key[7:])

        fields = self.pool.get(inst.data_type).fields_get(cr,1)
#        fields = self.pool.get('product.proxy').fields_get(cr,1)

        imp_model_id = self.pool.get('ir.model').search(cr, 1, [('model','=','imp.imp')])[0]
        imp_form_id = self.pool.get('ir.ui.view').search(cr, 1, [('name','=','imp.imp.form')])[0]
        imp_form = self.pool.get('ir.ui.view').browse(cr, 1, imp_form_id)
        arch = imp_form.arch
        st = ''
        end = '''</group>
</page>
</notebook>
</form>'''
        allowed_types = ['float', 'integer', 'char', 'text']
        restricted_fields = []

        keys = fields.keys()
        keys.sort()
        fields_types_to_save = {}
        for field in keys:
            if fields[field]['type'] in allowed_types and field not in restricted_fields and field in allowed_fields:
                field_type = fields[field]['type']
                field_descript = fields[field]['string']
                fields_types_to_save[field] = field_type
                exist = self.pool.get('ir.model.fields').search(cr, 1, [('name','=','x_'+ field),('model_id','=',imp_model_id)])
                if not exist:
                    new = self.pool.get('ir.model.fields').create(cr, 1, {'name':'x_'+ field,
                                                                        'model_id':imp_model_id,
                                                                        'ttype':'integer',
                                                                        'state':'manual',
                                                                        'field_description': field_descript
                                                                        })
                    new = self.pool.get('ir.model.fields').create(cr, 1, {'name':'x_bool_'+ field,
                                                                        'model_id':imp_model_id,
                                                                        'ttype':'boolean',
                                                                        'state':'manual',
                                                                        'field_description': field_descript
                                                                        })

                if 'x_'+field in arch:
                    continue
                else:
                    st+=''' <field name="x_bool_%s" nolabel="1" colspan="3" attrs="{'invisible':[('x_bool_%s','=',0),('hide_unused','=',1)]}"/>\n
                            <field name="x_%s" colspan="3" attrs="{'readonly':[('x_bool_%s','=',0)],'invisible':[('x_bool_%s','=',0),('hide_unused','=',1)]}" />\n
                            ''' % (field,field,field,field,field)

        if fields_types_to_save:
            self.write(cr, uid, inst.id, {'import_fields_types': str(fields_types_to_save)})
            # debug for Set imp fields
            # raise osv.except_osv(_('Warning'), fields_types_to_save)
        if st:
            arch = arch.replace(end, st+end)
            self.pool.get('ir.ui.view').write(cr, 1, imp_form_id, {'arch': arch})

        return True
Beispiel #17
0
    def postprocess_and_fields(self, cr, user, model, node, view_id, context=None):
        """ Return an architecture and a description of all the fields.

        The field description combines the result of fields_get() and
        postprocess().

        :param node: the architecture as as an etree
        :return: a tuple (arch, fields) where arch is the given node as a
            string and fields is the description of all the fields.

        """
        fields = {}
        Model = self.pool.get(model)
        if not Model:
            self.raise_view_error(cr, user, _("Model not found: %(model)s") % dict(model=model), view_id, context)

        if node.tag == "diagram":
            if node.getchildren()[0].tag == "node":
                node_model = self.pool[node.getchildren()[0].get("object")]
                node_fields = node_model.fields_get(cr, user, None, context)
                fields.update(node_fields)
                if not node.get("create") and not node_model.check_access_rights(
                    cr, user, "create", raise_exception=False
                ):
                    node.set("create", "false")
            if node.getchildren()[1].tag == "arrow":
                arrow_fields = self.pool[node.getchildren()[1].get("object")].fields_get(cr, user, None, context)
                fields.update(arrow_fields)
        else:
            fields = Model.fields_get(cr, user, None, context)

        fields_def = self.postprocess(cr, user, model, node, view_id, False, fields, context=context)
        node = self._disable_workflow_buttons(cr, user, model, node)
        if node.tag in ("kanban", "tree", "form", "gantt"):
            for action, operation in (("create", "create"), ("delete", "unlink"), ("edit", "write")):
                if not node.get(action) and not Model.check_access_rights(cr, user, operation, raise_exception=False):
                    node.set(action, "false")
        if node.tag in ("kanban"):
            group_by_field = node.get("default_group_by")
            if group_by_field and Model._all_columns.get(group_by_field):
                group_by_column = Model._all_columns[group_by_field].column
                if group_by_column._type == "many2one":
                    group_by_model = Model.pool.get(group_by_column._obj)
                    for action, operation in (
                        ("group_create", "create"),
                        ("group_delete", "unlink"),
                        ("group_edit", "write"),
                    ):
                        if not node.get(action) and not group_by_model.check_access_rights(
                            cr, user, operation, raise_exception=False
                        ):
                            node.set(action, "false")

        arch = etree.tostring(node, encoding="utf-8").replace("\t", "")
        for k in fields.keys():
            if k not in fields_def:
                del fields[k]
        for field in fields_def:
            if field == "id":
                # sometime, the view may contain the (invisible) field 'id' needed for a domain (when 2 objects have cross references)
                fields["id"] = {"readonly": True, "type": "integer", "string": "ID"}
            elif field in fields:
                fields[field].update(fields_def[field])
            else:
                message = _("Field `%(field_name)s` does not exist") % dict(field_name=field)
                self.raise_view_error(cr, user, message, view_id, context)
        return arch, fields