[MERGE] forward port branch saas-14 up to cdb0c08cb9
This commit is contained in:
@@ -115,7 +115,11 @@ Best Regards,'''))
|
||||
last_month = self.fiscalyear_last_month
|
||||
last_day = self.fiscalyear_last_day
|
||||
if (date.month < last_month or (date.month == last_month and date.day <= last_day)):
|
||||
date = date.replace(month=last_month, day=last_day)
|
||||
# FORWARD-PORT UP TO v11
|
||||
if last_month == 2 and last_day == 29 and date.year % 4 != 0:
|
||||
date = date.replace(month=last_month, day=28)
|
||||
else:
|
||||
date = date.replace(month=last_month, day=last_day)
|
||||
else:
|
||||
if last_month == 2 and last_day == 29 and (date.year + 1) % 4 != 0:
|
||||
date = date.replace(month=last_month, day=28, year=date.year + 1)
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
<field name="name">hr.holidays.tree</field>
|
||||
<field name="model">hr.holidays</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree decoration-danger="state == 'refuse'" decoration-info="state == ' draft'" string="Leave Requests"
|
||||
<tree decoration-danger="state == 'refuse'" decoration-info="state == 'draft'" string="Leave Requests"
|
||||
decoration-bf="message_needaction == True">
|
||||
<field name="employee_id"/>
|
||||
<field name="holiday_type" string="Mode" groups="base.group_no_one"/>
|
||||
|
||||
@@ -299,6 +299,7 @@ class PurchaseOrder(models.Model):
|
||||
'default_use_template': bool(template_id),
|
||||
'default_template_id': template_id,
|
||||
'default_composition_mode': 'comment',
|
||||
'purchase_mark_rfq_sent': True,
|
||||
'custom_layout': "purchase.mail_template_data_notification_email_purchase_order"
|
||||
})
|
||||
return {
|
||||
@@ -1182,7 +1183,7 @@ class MailComposeMessage(models.TransientModel):
|
||||
|
||||
@api.multi
|
||||
def mail_purchase_order_on_send(self):
|
||||
if not self.filtered('subtype_id.internal'):
|
||||
if self._context.get('purchase_mark_rfq_sent'):
|
||||
order = self.env['purchase.order'].browse(self._context['default_res_id'])
|
||||
if order.state == 'draft':
|
||||
order.state = 'sent'
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Estonia, 23 OCT 2018
|
||||
|
||||
Brainbean Apps OU agrees to the terms of the Odoo Corporate Contributor License
|
||||
Agreement v1.0.
|
||||
|
||||
I declare that I am authorized and able to make this agreement and sign this
|
||||
declaration.
|
||||
|
||||
Signed,
|
||||
|
||||
Oleksii Pelykh <alexey@brainbeanapps.com> https://github.com/alexey-pelykh
|
||||
|
||||
List of contributors:
|
||||
|
||||
Alexey Pelykh <alexey@brainbeanapps.com> https://github.com/alexey-pelykh
|
||||
@@ -0,0 +1,18 @@
|
||||
Spain, 2019-01-07
|
||||
|
||||
Penedestic Solucions, SLP agrees to the terms of the Odoo Corporate Contributor License
|
||||
Agreement v1.0.
|
||||
|
||||
I declare that I am authorized and able to make this agreement and sign this
|
||||
declaration.
|
||||
|
||||
Signed,
|
||||
|
||||
Francisco Fernández ffernandez@planetatic.com https://github.com/FFernandez-PlanetaTIC
|
||||
|
||||
List of contributors:
|
||||
|
||||
Àngel Manonelles amanonelles@planetatic.com https://github.com/AManonelles-PlanetaTIC
|
||||
Francisco Fernández ffernandez@planetatic.com https://github.com/FFernandez-PlanetaTIC
|
||||
Lluís Rovira Olivé lrovira@planetatic.com https://github.com/LRovira-PlanetaTIC
|
||||
Marc Poch mpoch@planetatic.com https://github.com/MPoch-PlanetaTIC
|
||||
@@ -358,6 +358,31 @@ class TestAPI(common.TransactionCase):
|
||||
same_prefetch(empty, empty.bank_ids)
|
||||
same_prefetch(empty, empty.category_id)
|
||||
|
||||
@mute_logger('odoo.models')
|
||||
def test_60_prefetch_read(self):
|
||||
""" Check that reading a field computes it on self only. """
|
||||
Partner = self.env['res.partner']
|
||||
field = type(Partner).company_type
|
||||
self.assertTrue(field.compute and not field.store)
|
||||
|
||||
partner1 = Partner.create({'name': 'Foo'})
|
||||
partner2 = Partner.create({'name': 'Bar', 'parent_id': partner1.id})
|
||||
self.assertEqual(partner1.child_ids, partner2)
|
||||
|
||||
# reading partner1 should not prefetch 'company_type' on partner2
|
||||
self.env.clear()
|
||||
partner1 = partner1.with_prefetch()
|
||||
partner1.read(['company_type'])
|
||||
self.assertIn('company_type', partner1._cache)
|
||||
self.assertNotIn('company_type', partner2._cache)
|
||||
|
||||
# reading partner1 should not prefetch 'company_type' on partner2
|
||||
self.env.clear()
|
||||
partner1 = partner1.with_prefetch()
|
||||
partner1.read(['child_ids', 'company_type'])
|
||||
self.assertIn('company_type', partner1._cache)
|
||||
self.assertNotIn('company_type', partner2._cache)
|
||||
|
||||
@mute_logger('odoo.models')
|
||||
def test_70_one(self):
|
||||
""" Check method one(). """
|
||||
|
||||
+12
-10
@@ -2516,17 +2516,19 @@ class BaseModel(object):
|
||||
|
||||
# retrieve results from records; this takes values from the cache and
|
||||
# computes remaining fields
|
||||
result = []
|
||||
name_fields = [(name, self._fields[name]) for name in (stored + inherited + computed)]
|
||||
data = {record: {'id': record.id} for record in self}
|
||||
missing = set()
|
||||
use_name_get = (load == '_classic_read')
|
||||
for record in self:
|
||||
try:
|
||||
values = {'id': record.id}
|
||||
for name, field in name_fields:
|
||||
values[name] = field.convert_to_read(record[name], record, use_name_get)
|
||||
result.append(values)
|
||||
except MissingError:
|
||||
pass
|
||||
for name in (stored + inherited + computed):
|
||||
convert = self._fields[name].convert_to_read
|
||||
# read every field with prefetching limited to self; this avoids
|
||||
# computing fields on a larger recordset than self
|
||||
for record in self.with_prefetch():
|
||||
try:
|
||||
data[record][name] = convert(record[name], record, use_name_get)
|
||||
except MissingError:
|
||||
missing.add(record)
|
||||
result = [data[record] for record in self if record not in missing]
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user