~openerp-usertesting/openobject-server/trunk-muilti_address-rmu

« back to all changes in this revision

Viewing changes to openerp/osv/orm.py

  • Committer: Randhir Mayatra(OpenERP)
  • Date: 2013-04-05 11:40:31 UTC
  • mfrom: (4815.1.35 trunk)
  • Revision ID: rma@tinyerp.com-20130405114031-a1711m8sz1w5cmzs
[MERGE] merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
482
482
        except KeyError, e:
483
483
            import sys
484
484
            exc_info = sys.exc_info()
485
 
            raise AttributeError, "Got %r while trying to get attribute `%s`." % (e, name), exc_info[2]
 
485
            raise AttributeError, "Got %r while trying to get attribute %s on a %s record." % (e, name, self._table._name), exc_info[2]
486
486
 
487
487
    def __contains__(self, name):
488
488
        return (name in self._table._columns) or (name in self._table._inherit_fields) or hasattr(self._table, name)
1028
1028
                'required': bool(field['required']),
1029
1029
                'readonly': bool(field['readonly']),
1030
1030
                'domain': eval(field['domain']) if field['domain'] else None,
1031
 
                'size': field['size'],
 
1031
                'size': field['size'] or None,
1032
1032
                'ondelete': field['on_delete'],
1033
1033
                'translate': (field['translate']),
1034
1034
                'manual': True,
4451
4451
            upd1 += ",%s,(now() at time zone 'UTC'),%s,(now() at time zone 'UTC')"
4452
4452
            upd2.extend((user, user))
4453
4453
        cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
4454
 
        self.check_access_rule(cr, user, [id_new], 'create', context=context)
4455
4454
        upd_todo.sort(lambda x, y: self._columns[x].priority-self._columns[y].priority)
4456
4455
 
4457
4456
        if self._parent_store and not context.get('defer_parent_store_computation'):
4504
4503
                self.name_get(cr, user, [id_new], context=context)[0][1] + \
4505
4504
                "' " + _("created.")
4506
4505
            self.log(cr, user, id_new, message, True, context=context)
 
4506
        self.check_access_rule(cr, user, [id_new], 'create', context=context)
4507
4507
        self.create_workflow(cr, user, [id_new], context=context)
4508
4508
        return id_new
4509
4509
 
5155
5155
    get_xml_id = get_external_id
5156
5156
    _get_xml_ids = _get_external_ids
5157
5157
 
 
5158
    def print_report(self, cr, uid, ids, name, data, context=None):
 
5159
        """
 
5160
        Render the report `name` for the given IDs. The report must be defined
 
5161
        for this model, not another.
 
5162
        """
 
5163
        report = self.pool['ir.actions.report.xml']._lookup_report(cr, name)
 
5164
        assert self._name == report.table
 
5165
        return report.create(cr, uid, ids, data, context)
 
5166
 
5158
5167
    # Transience
5159
5168
    def is_transient(self):
5160
5169
        """ Return whether the model is transient.