[MERGE] forward port branch 10.0 up to 80a11ca27d

This commit is contained in:
Christophe Simonis
2018-11-30 11:58:25 +01:00
4 changed files with 13 additions and 4 deletions
@@ -36,7 +36,7 @@ class ReportIntrastat(models.Model):
intrastat.id as intrastat_id,
upper(inv_country.code) as code,
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
end) as value,
sum(
+5 -3
View File
@@ -50,9 +50,9 @@ class Property(models.Model):
@api.multi
def _update_values(self, values):
value = values.pop('value', None)
if not value:
if 'value' not in values:
return values
value = values.pop('value')
prop = None
type_ = values.get('type')
@@ -68,7 +68,9 @@ class Property(models.Model):
raise UserError(_('Invalid type'))
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)
elif isinstance(value, (int, long)):
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(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
company_record = self.env['test_new_api.company'].create({'foo': 'ABC'})
attribute_record = self.env['test_new_api.company.attr'].create({
+1
View File
@@ -893,6 +893,7 @@ class BaseModel(object):
# avoid broken transaction) and keep going
cr.execute('ROLLBACK TO SAVEPOINT model_load_save')
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)))
moreinfo = _('Resolve other errors first')
messages.append(dict(info, type='error', message=message, moreinfo=moreinfo))