Skip to content

Commit 0acd63d

Browse files
committed
[MERGE] forward port branch saas-12 up to 27dc061
2 parents a357a81 + 27dc061 commit 0acd63d

File tree

11 files changed

+44
-23
lines changed

11 files changed

+44
-23
lines changed

addons/account/models/account.py

+7
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ def write(self, vals):
178178
for account in self:
179179
if (account.company_id.id <> vals['company_id']) and move_lines:
180180
raise UserError(_('You cannot change the owner company of an account that already contains journal items.'))
181+
# If user change the reconcile flag, all aml should be recomputed for that account and this is very costly.
182+
# So to prevent some bugs we add a constraint saying that you cannot change the reconcile field if there is any aml existing
183+
# for that account.
184+
if vals.get('reconcile'):
185+
move_lines = self.env['account.move.line'].search([('account_id', 'in', self.ids)], limit=1)
186+
if len(move_lines):
187+
raise UserError(_('You cannot change the value of the reconciliation on this account as it already has some moves'))
181188
return super(AccountAccount, self).write(vals)
182189

183190
@api.multi

addons/account/report/account_aged_partner_balance.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
9292
for partial_line in line.matched_credit_ids:
9393
if partial_line.create_date[:10] <= date_from:
9494
line_amount -= partial_line.amount
95-
undue_amounts[partner_id] += line_amount
96-
lines[partner_id].append({
97-
'line': line,
98-
'amount': line_amount,
99-
'period': 6,
95+
if not self.env.user.company_id.currency_id.is_zero(line_amount):
96+
undue_amounts[partner_id] += line_amount
97+
lines[partner_id].append({
98+
'line': line,
99+
'amount': line_amount,
100+
'period': 6,
100101
})
101102

102103
# Use one query per period and store results in history (a list variable)
@@ -144,12 +145,13 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
144145
if partial_line.create_date[:10] <= date_from:
145146
line_amount -= partial_line.amount
146147

147-
partners_amount[partner_id] += line_amount
148-
lines[partner_id].append({
149-
'line': line,
150-
'amount': line_amount,
151-
'period': i + 1,
152-
})
148+
if not self.env.user.company_id.currency_id.is_zero(line_amount):
149+
partners_amount[partner_id] += line_amount
150+
lines[partner_id].append({
151+
'line': line,
152+
'amount': line_amount,
153+
'period': i + 1,
154+
})
153155
history.append(partners_amount)
154156

155157
for partner in partners:

addons/hr_expense/models/hr_expense.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ def message_new(self, msg_dict, custom_values=None):
339339
'product_id': product.id,
340340
'product_uom_id': product.uom_id.id,
341341
'quantity': 1,
342-
'unit_amount': price
342+
'unit_amount': price,
343+
'company_id': employee.company_id.id,
343344
})
344345
return super(HrExpense, self).message_new(msg_dict, custom_values)
345346

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ exports.Order = Backbone.Model.extend({
19241924
},
19251925

19261926
initialize_validation_date: function () {
1927-
this.validation_date = this.validation_date || new Date();
1927+
this.validation_date = new Date();
19281928
},
19291929

19301930
set_tip: function(tip) {

addons/purchase_requisition/views/purchase_requisition_views.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>

addons/sale_margin/views/sale_margin_view.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<field name="inherit_id" ref="sale.view_order_form"/>
2121
<field name="arch" type="xml">
2222
<xpath expr="//field[@name='order_line']/form//field[@name='price_unit']" position="after">
23-
<field name="purchase_price" groups="base.group_user" invisible="True"/>
23+
<field name="purchase_price" groups="base.group_user"/>
2424
</xpath>
2525
</field>
2626
</record>

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:`~odoo.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
``__manifest__.py``

odoo/addons/base/ir/ir_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ def unlink_if_refcount(to_unlink):
12761276

12771277
self._cr.commit()
12781278

1279-
self.unlink()
1279+
datas.unlink()
12801280

12811281
@api.model
12821282
def _process_end(self, modules):

odoo/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ def _read_group_prepare(self, orderby, aggregated_fields, annotated_groupbys, qu
17281728
for order_part in orderby.split(','):
17291729
order_split = order_part.split()
17301730
order_field = order_split[0]
1731-
if order_field in groupby_fields:
1731+
if order_field == 'id' or order_field in groupby_fields:
17321732

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

odoo/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)