diff --git a/addons/account/tests/test_account_move_closed_period.py b/addons/account/tests/test_account_move_closed_period.py
index 68ad8788476..4e88994f2d2 100644
--- a/addons/account/tests/test_account_move_closed_period.py
+++ b/addons/account/tests/test_account_move_closed_period.py
@@ -14,21 +14,21 @@ class TestPeriodState(TransactionCase):
self.wizard_period_close = self.registry('account.period.close')
self.wizard_period_close_id = self.wizard_period_close.create(cr, uid, {'sure': 1})
_, self.sale_journal_id = self.registry("ir.model.data").get_object_reference(cr, uid, "account", "sales_journal")
- _, self.period_9_id = self.registry("ir.model.data").get_object_reference(cr, uid, "account", "period_9")
+ _, self.period_id = self.registry("ir.model.data").get_object_reference(cr, uid, "account", "period_0")
def test_period_state(self):
cr, uid = self.cr, self.uid
self.wizard_period_close.data_save(cr, uid, [self.wizard_period_close_id], {
'lang': 'en_US',
'active_model': 'account.period',
- 'active_ids': [self.period_9_id],
+ 'active_ids': [self.period_id],
'tz': False,
- 'active_id': self.period_9_id
+ 'active_id': self.period_id
})
with self.assertRaises(except_orm):
self.registry('account.move').create(cr, uid, {
'name': '/',
- 'period_id': self.period_9_id,
+ 'period_id': self.period_id,
'journal_id': self.sale_journal_id,
'date': date.today(),
'line_id': [(0, 0, {
diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py
index b71af0b5279..ab2303091ea 100644
--- a/addons/google_calendar/google_calendar.py
+++ b/addons/google_calendar/google_calendar.py
@@ -259,6 +259,10 @@ class google_calendar(osv.AbstractModel):
if not self.get_need_synchro_attendee(cr, uid, context=context):
data.pop("attendees")
+ if isCreating:
+ other_google_ids = [other_att.google_internal_event_id for other_att in event.attendee_ids if other_att.google_internal_event_id]
+ if other_google_ids:
+ data["id"] = other_google_ids[0]
return data
def create_an_event(self, cr, uid, event, context=None):
@@ -428,7 +432,7 @@ class google_calendar(osv.AbstractModel):
if type == "write":
for oe_attendee in event['attendee_ids']:
if oe_attendee.email == partner_email:
- calendar_attendee_obj.write(cr, uid, [oe_attendee.id], {'state': google_attendee['responseStatus'], 'google_internal_event_id': single_event_dict.get('id')}, context=context)
+ calendar_attendee_obj.write(cr, uid, [oe_attendee.id], {'state': google_attendee['responseStatus']}, context=context)
google_attendee['found'] = True
continue
@@ -447,7 +451,6 @@ class google_calendar(osv.AbstractModel):
partner_record.append((4, attendee.get('id')))
attendee['partner_id'] = attendee.pop('id')
attendee['state'] = google_attendee['responseStatus']
- attendee['google_internal_event_id'] = single_event_dict.get('id')
attendee_record.append((0, 0, attendee))
for google_alarm in single_event_dict.get('reminders', {}).get('overrides', []):
alarm_id = calendar_alarm_obj.search(
@@ -626,17 +629,23 @@ class google_calendar(osv.AbstractModel):
('event_id.final_date', '>', self.get_minTime(cr, uid, context=context).strftime(DEFAULT_SERVER_DATETIME_FORMAT)),
], context=context_norecurrent)
for att in att_obj.browse(cr, uid, my_att_ids, context=context):
- if not att.event_id.recurrent_id or att.event_id.recurrent_id == 0:
- st, response, ask_time = self.create_an_event(cr, uid, att.event_id, context=context)
- if status_response(st):
- update_date = datetime.strptime(response['updated'], "%Y-%m-%dT%H:%M:%S.%fz")
- ev_obj.write(cr, uid, att.event_id.id, {'oe_update_date': update_date})
- new_ids.append(response['id'])
- att_obj.write(cr, uid, [att.id for att in att.event_id.attendee_ids], {'google_internal_event_id': response['id'], 'oe_synchro_date': update_date})
- cr.commit()
- else:
- _logger.warning("Impossible to create event %s. [%s] Enable DEBUG for response detail.", att.event_id.id, st)
- _logger.debug("Response : %s" % response)
+ other_google_ids = [other_att.google_internal_event_id for other_att in att.event_id.attendee_ids if other_att.google_internal_event_id and other_att.id != att.id]
+ for other_google_id in other_google_ids:
+ if self.get_one_event_synchro(cr, uid, other_google_id, context=context):
+ att_obj.write(cr, uid, [att.id], {'google_internal_event_id': other_google_id})
+ break
+ else:
+ if not att.event_id.recurrent_id or att.event_id.recurrent_id == 0:
+ st, response, ask_time = self.create_an_event(cr, uid, att.event_id, context=context)
+ if status_response(st):
+ update_date = datetime.strptime(response['updated'], "%Y-%m-%dT%H:%M:%S.%fz")
+ ev_obj.write(cr, uid, att.event_id.id, {'oe_update_date': update_date})
+ new_ids.append(response['id'])
+ att_obj.write(cr, uid, [att.id], {'google_internal_event_id': response['id'], 'oe_synchro_date': update_date})
+ cr.commit()
+ else:
+ _logger.warning("Impossible to create event %s. [%s] Enable DEBUG for response detail.", att.event_id.id, st)
+ _logger.debug("Response : %s" % response)
return new_ids
def get_context_no_virtual(self, context):
diff --git a/addons/portal_sale/portal_sale_view.xml b/addons/portal_sale/portal_sale_view.xml
index 1dd8db4e51c..b9b18507389 100644
--- a/addons/portal_sale/portal_sale_view.xml
+++ b/addons/portal_sale/portal_sale_view.xml
@@ -54,7 +54,8 @@
ir.actions.act_window
sale.order
tree,form
- {"search_default_draft":1}
+ [('state','in',('draft','sent','cancel'))]
+ {}
We haven't sent you any quotation.
@@ -65,7 +66,8 @@
sale.order
tree,form
- {"search_default_sales":1}
+ [('state', 'not in', ('draft', 'sent', 'cancel'))]
+ {}
We haven't sent you any sales order.
diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py
index 8677b705f36..4a42e909665 100644
--- a/addons/product_expiry/product_expiry.py
+++ b/addons/product_expiry/product_expiry.py
@@ -21,6 +21,7 @@
import datetime
import openerp
+from openerp import api, models
from openerp.osv import fields, osv
class stock_production_lot(osv.osv):
@@ -75,6 +76,19 @@ class stock_production_lot(osv.osv):
}
+# Onchange added in new api to avoid having to change views
+class StockProductionLot(models.Model):
+ _inherit = 'stock.production.lot'
+
+ @api.onchange('product_id')
+ def _onchange_product(self):
+ defaults = self.with_context(
+ product_id=self.product_id.id).default_get(
+ ['life_date', 'use_date', 'removal_date', 'alert_date'])
+ for field, value in defaults.items():
+ setattr(self, field, value)
+
+
class stock_quant(osv.osv):
_inherit = 'stock.quant'
diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py
index 2b12106af38..63c4a542e16 100644
--- a/addons/stock_account/stock_account.py
+++ b/addons/stock_account/stock_account.py
@@ -285,7 +285,7 @@ class stock_move(osv.osv):
average_valuation_price += q.qty * q.cost
average_valuation_price = average_valuation_price / move.product_qty
# Write the standard price, as SUPERUSER_ID because a warehouse manager may not have the right to write on products
- ctx = dict(context, force_company=move.company_id.id)
+ ctx = dict(context or {}, force_company=move.company_id.id)
product_obj.write(cr, SUPERUSER_ID, [move.product_id.id], {'standard_price': average_valuation_price}, context=ctx)
self.write(cr, uid, [move.id], {'price_unit': average_valuation_price}, context=context)