Skip to content

Commit a73cd57

Browse files
committed
[MERGE] forward port branch 9.0 up to 6faf232
2 parents a8e1595 + 6faf232 commit a73cd57

File tree

9 files changed

+30
-12
lines changed

9 files changed

+30
-12
lines changed

addons/account/models/account.py

+7
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ def write(self, vals):
160160
for account in self:
161161
if (account.company_id.id <> vals['company_id']) and move_lines:
162162
raise UserError(_('You cannot change the owner company of an account that already contains journal items.'))
163+
# If user change the reconcile flag, all aml should be recomputed for that account and this is very costly.
164+
# So to prevent some bugs we add a constraint saying that you cannot change the reconcile field if there is any aml existing
165+
# for that account.
166+
if vals.get('reconcile'):
167+
move_lines = self.env['account.move.line'].search([('account_id', 'in', self.ids)], limit=1)
168+
if len(move_lines):
169+
raise UserError(_('You cannot change the value of the reconciliation on this account as it already has some moves'))
163170
return super(AccountAccount, self).write(vals)
164171

165172
@api.multi

addons/account/models/account_journal_dashboard.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def open_action(self):
314314
})
315315
ir_model_obj = self.pool['ir.model.data']
316316
model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name)
317-
action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context)
317+
action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0]
318318
action['context'] = ctx
319319
action['domain'] = self._context.get('use_domain', [])
320320
return action
@@ -357,7 +357,7 @@ def open_action_with_context(self):
357357
ctx.pop('group_by', None)
358358
ir_model_obj = self.pool['ir.model.data']
359359
model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name)
360-
action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context)
360+
action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0]
361361
action['context'] = ctx
362362
if ctx.get('use_domain', False):
363363
action['domain'] = ['|', ('journal_id', '=', self.id), ('journal_id', '=', False)]

addons/account_bank_statement_import/account_journal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def import_statement(self):
1414
action_name = 'action_account_bank_statement_import'
1515
ir_model_obj = self.pool['ir.model.data']
1616
model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account_bank_statement_import', action_name)
17-
action = self.pool[model].read(self._cr, self._uid, action_id, context=self.env.context)
17+
action = self.pool[model].read(self._cr, self._uid, [action_id], context=self.env.context)[0]
1818
# Note: this drops action['context'], which is a dict stored as a string, which is not easy to update
1919
action.update({'context': (u"{'journal_id': " + str(self.id) + u"}")})
2020
return action

addons/point_of_sale/static/src/js/models.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ exports.Order = Backbone.Model.extend({
18101810
},
18111811

18121812
initialize_validation_date: function () {
1813-
this.validation_date = this.validation_date || new Date();
1813+
this.validation_date = new Date();
18141814
},
18151815

18161816
set_tip: function(tip) {

addons/purchase_requisition/purchase_requisition_view.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
<field name="ordering_date" attrs="{'readonly': [('state','not in',('draft','in_progress','open'))]}"/>
140140
<field name="schedule_date" attrs="{'readonly': [('state','not in',('draft','in_progress','open'))]}"/>
141141
<field name="origin" placeholder="e.g. PO0025" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
142-
<field name="picking_type_id" widget="selection" groups="stock.group_stock_adv_location" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
142+
<field name="picking_type_id" widget="selection" groups="stock.group_adv_location" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
143143
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" attrs="{'readonly': [('state','not in',('draft'))]}"/>
144144
</group>
145145
</group>

doc/cla/individual/tiangolo.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Colombia, 2016-10-04
2+
3+
I hereby agree to the terms of the Odoo Individual Contributor License
4+
Agreement v1.0.
5+
6+
I declare that I am authorized and able to make this agreement and sign this
7+
declaration.
8+
9+
Signed,
10+
11+
Sebastián Ramírez [email protected] https://github.com/tiangolo

doc/howtos/backend.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ overridden by setting :attr:`~openerp.models.Model._rec_name`.
211211

212212
.. only:: solutions
213213

214-
Edit the file ``openacademy/models.py`` to include a *Course* class.
214+
Edit the file ``openacademy/models/models.py`` to include a *Course* class.
215215

216216
.. patch::
217217

@@ -255,7 +255,7 @@ be declared in the ``'data'`` list (always loaded) or in the ``'demo'`` list
255255

256256
.. only:: solutions
257257

258-
Edit the file ``openacademy/demo.xml`` to include some data.
258+
Edit the file ``openacademy/demo/demo.xml`` to include some data.
259259

260260
.. patch::
261261

@@ -484,7 +484,7 @@ client data; it is also related to its sale order line records.
484484

485485
.. only:: solutions
486486

487-
#. Create the class *Session* in ``openacademy/models.py``.
487+
#. Create the class *Session* in ``openacademy/models/models.py``.
488488
#. Add access to the session object in ``openacademy/view/openacademy.xml``.
489489

490490
.. patch::
@@ -684,7 +684,7 @@ instead of a single view its ``arch`` field is composed of any number of
684684
inspect the view, find its external ID and the place to put the
685685
new field.
686686

687-
#. Create a file ``openacademy/partner.py`` and import it in
687+
#. Create a file ``openacademy/models/partner.py`` and import it in
688688
``__init__.py``
689689
#. Create a file ``openacademy/views/partner.xml`` and add it to
690690
``__openerp__.py``

openerp/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ def _read_group_prepare(self, orderby, aggregated_fields, annotated_groupbys, qu
20222022
for order_part in orderby.split(','):
20232023
order_split = order_part.split()
20242024
order_field = order_split[0]
2025-
if order_field in groupby_fields:
2025+
if order_field == 'id' or order_field in groupby_fields:
20262026

20272027
if self._fields[order_field.split(':')[0]].type == 'many2one':
20282028
order_clause = self._generate_order_by(order_part, query).replace('ORDER BY ', '')

openerp/tools/misc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,13 @@ def visit(n):
340340
# add some sanitizations to respect the excel sheet name restrictions
341341
# as the sheet name is often translatable, can not control the input
342342
class PatchedWorkbook(xlwt.Workbook):
343-
def add_sheet(self, name):
343+
def add_sheet(self, name, cell_overwrite_ok=False):
344344
# invalid Excel character: []:*?/\
345345
name = re.sub(r'[\[\]:*?/\\]', '', name)
346346

347347
# maximum size is 31 characters
348348
name = name[:31]
349-
return super(PatchedWorkbook, self).add_sheet(name)
349+
return super(PatchedWorkbook, self).add_sheet(name, cell_overwrite_ok=cell_overwrite_ok)
350350

351351
xlwt.Workbook = PatchedWorkbook
352352

0 commit comments

Comments
 (0)