[MERGE] forward port branch 10.0 up to 80a11ca27d
This commit is contained in:
@@ -36,7 +36,7 @@ class ReportIntrastat(models.Model):
|
|||||||
intrastat.id as intrastat_id,
|
intrastat.id as intrastat_id,
|
||||||
upper(inv_country.code) as code,
|
upper(inv_country.code) as code,
|
||||||
sum(case when inv_line.price_unit is not null
|
sum(case when inv_line.price_unit is not null
|
||||||
then inv_line.price_unit * inv_line.quantity
|
then inv_line.price_unit * (1.0 - coalesce(inv_line.discount, 0.0) / 100.0) * inv_line.quantity
|
||||||
else 0
|
else 0
|
||||||
end) as value,
|
end) as value,
|
||||||
sum(
|
sum(
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ class Property(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _update_values(self, values):
|
def _update_values(self, values):
|
||||||
value = values.pop('value', None)
|
if 'value' not in values:
|
||||||
if not value:
|
|
||||||
return values
|
return values
|
||||||
|
value = values.pop('value')
|
||||||
|
|
||||||
prop = None
|
prop = None
|
||||||
type_ = values.get('type')
|
type_ = values.get('type')
|
||||||
@@ -68,7 +68,9 @@ class Property(models.Model):
|
|||||||
raise UserError(_('Invalid type'))
|
raise UserError(_('Invalid type'))
|
||||||
|
|
||||||
if field == 'value_reference':
|
if field == 'value_reference':
|
||||||
if isinstance(value, models.BaseModel):
|
if not value:
|
||||||
|
value = False
|
||||||
|
elif isinstance(value, models.BaseModel):
|
||||||
value = '%s,%d' % (value._name, value.id)
|
value = '%s,%d' % (value._name, value.id)
|
||||||
elif isinstance(value, (int, long)):
|
elif isinstance(value, (int, long)):
|
||||||
field_id = values.get('fields_id')
|
field_id = values.get('fields_id')
|
||||||
|
|||||||
@@ -585,6 +585,12 @@ class TestFields(common.TransactionCase):
|
|||||||
self.assertEqual(record.sudo(user1).foo, 'alpha')
|
self.assertEqual(record.sudo(user1).foo, 'alpha')
|
||||||
self.assertEqual(record.sudo(user2).foo, 'default')
|
self.assertEqual(record.sudo(user2).foo, 'default')
|
||||||
|
|
||||||
|
record.sudo(user1).foo = False
|
||||||
|
record.invalidate_cache()
|
||||||
|
self.assertEqual(record.sudo(user0).foo, 'main')
|
||||||
|
self.assertEqual(record.sudo(user1).foo, False)
|
||||||
|
self.assertEqual(record.sudo(user2).foo, 'default')
|
||||||
|
|
||||||
# create company record and attribute
|
# create company record and attribute
|
||||||
company_record = self.env['test_new_api.company'].create({'foo': 'ABC'})
|
company_record = self.env['test_new_api.company'].create({'foo': 'ABC'})
|
||||||
attribute_record = self.env['test_new_api.company.attr'].create({
|
attribute_record = self.env['test_new_api.company.attr'].create({
|
||||||
|
|||||||
@@ -893,6 +893,7 @@ class BaseModel(object):
|
|||||||
# avoid broken transaction) and keep going
|
# avoid broken transaction) and keep going
|
||||||
cr.execute('ROLLBACK TO SAVEPOINT model_load_save')
|
cr.execute('ROLLBACK TO SAVEPOINT model_load_save')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
_logger.exception("Error while loading record")
|
||||||
message = (_('Unknown error during import:') + ' %s: %s' % (type(e), unicode(e.message or e.name)))
|
message = (_('Unknown error during import:') + ' %s: %s' % (type(e), unicode(e.message or e.name)))
|
||||||
moreinfo = _('Resolve other errors first')
|
moreinfo = _('Resolve other errors first')
|
||||||
messages.append(dict(info, type='error', message=message, moreinfo=moreinfo))
|
messages.append(dict(info, type='error', message=message, moreinfo=moreinfo))
|
||||||
|
|||||||
Reference in New Issue
Block a user