Skip to content

Commit 7abeace

Browse files
committed
[MERGE] forward port branch saas-11 up to 5c4744c
2 parents 8efd51a + 5c4744c commit 7abeace

File tree

7 files changed

+47
-23
lines changed

7 files changed

+47
-23
lines changed

addons/l10n_fr_fec/wizard/account_fr_fec.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,17 @@ def generate_fec(self):
185185
unaffected_earnings_amount = float(unaffected_earnings_results[11].replace(',', '.')) - float(unaffected_earnings_results[12].replace(',', '.'))
186186
listrow_amount = current_amount + unaffected_earnings_amount
187187
if listrow_amount > 0:
188-
listrow[11] = str(listrow_amount)
189-
listrow[12] = '0.00'
188+
listrow[11] = str(listrow_amount).replace('.', ',')
189+
listrow[12] = '0,00'
190190
else:
191-
listrow[11] = '0.00'
192-
listrow[12] = str(listrow_amount)
191+
listrow[11] = '0,00'
192+
listrow[12] = str(-listrow_amount).replace('.', ',')
193193
w.writerow([s.encode("utf-8") for s in listrow])
194194
#if the unaffected earnings account wasn't in the selection yet: add it manually
195-
if not unaffected_earnings_line and unaffected_earnings_results and unaffected_earnings_results[11] != '0,00' and unaffected_earnings_results[12] != '0,00':
195+
if (not unaffected_earnings_line
196+
and unaffected_earnings_results
197+
and (unaffected_earnings_results[11] != '0,00'
198+
or unaffected_earnings_results[12] != '0,00')):
196199
#search an unaffected earnings account
197200
unaffected_earnings_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_unaffected_earnings').id)], limit=1)
198201
if unaffected_earnings_account:

addons/website/controllers/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,12 @@ def create_sitemap(url, content):
191191
'name': "/sitemap-%d.xml" % current_website.id,
192192
})
193193
else:
194+
# TODO: in master/saas-15, move current_website_id in template directly
195+
pages_with_website = map(lambda p: "%d-%d" % (current_website.id, p), range(1, pages + 1))
196+
194197
# Sitemaps must be split in several smaller files with a sitemap index
195198
content = View.render_template('website.sitemap_index_xml', {
196-
'pages': range(1, pages + 1),
199+
'pages': pages_with_website,
197200
'url_root': request.httprequest.url_root,
198201
})
199202
create_sitemap('/sitemap-%d.xml' % current_website.id, content)

addons/website_portal_sale/controllers/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def account(self, **kw):
2929
invoice_count = Invoice.search_count([
3030
('type', 'in', ['out_invoice', 'out_refund']),
3131
('message_partner_ids', 'child_of', [partner.commercial_partner_id.id]),
32-
('state', 'in', ['open', 'paid', 'cancelled'])
32+
('state', 'in', ['open', 'paid', 'cancel'])
3333
])
3434

3535
response.qcontext.update({

doc/cla/individual/igallart.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Spain, 2017-02-27
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+
Isaac Gallart Bochons igallart@puntsistemes.es https://github.com/igallart

odoo/addons/base/ir/ir_cron.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,20 @@ def _acquire_job(cls, db_name):
182182
"""
183183
db = odoo.sql_db.db_connect(db_name)
184184
threading.current_thread().dbname = db_name
185-
cr = db.cursor()
186185
jobs = []
187186
try:
188-
# Make sure the database we poll has the same version as the code of base
189-
cr.execute("SELECT 1 FROM ir_module_module WHERE name=%s AND latest_version=%s", ('base', BASE_VERSION))
190-
if cr.fetchone():
191-
# Careful to compare timestamps with 'UTC' - everything is UTC as of v6.1.
192-
cr.execute("""SELECT * FROM ir_cron
193-
WHERE numbercall != 0
194-
AND active AND nextcall <= (now() at time zone 'UTC')
195-
ORDER BY priority""")
196-
jobs = cr.dictfetchall()
197-
else:
198-
_logger.warning('Skipping database %s as its base version is not %s.', db_name, BASE_VERSION)
187+
with db.cursor() as cr:
188+
# Make sure the database we poll has the same version as the code of base
189+
cr.execute("SELECT 1 FROM ir_module_module WHERE name=%s AND latest_version=%s", ('base', BASE_VERSION))
190+
if cr.fetchone():
191+
# Careful to compare timestamps with 'UTC' - everything is UTC as of v6.1.
192+
cr.execute("""SELECT * FROM ir_cron
193+
WHERE numbercall != 0
194+
AND active AND nextcall <= (now() at time zone 'UTC')
195+
ORDER BY priority""")
196+
jobs = cr.dictfetchall()
197+
else:
198+
_logger.warning('Skipping database %s as its base version is not %s.', db_name, BASE_VERSION)
199199
except psycopg2.ProgrammingError, e:
200200
if e.pgcode == '42P01':
201201
# Class 42 — Syntax Error or Access Rule Violation; 42P01: undefined_table
@@ -205,8 +205,6 @@ def _acquire_job(cls, db_name):
205205
raise
206206
except Exception:
207207
_logger.warning('Exception in cron:', exc_info=True)
208-
finally:
209-
cr.close()
210208

211209
for job in jobs:
212210
lock_cr = db.cursor()

odoo/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,6 +2854,11 @@ def _setup_fields(self, partial):
28542854
if field.compute:
28552855
cls._field_computed[field] = group = groups[field.compute]
28562856
group.append(field)
2857+
for fields in groups.itervalues():
2858+
compute_sudo = fields[0].compute_sudo
2859+
if not all(field.compute_sudo == compute_sudo for field in fields):
2860+
_logger.warning("%s: inconsistent 'compute_sudo' for computed fields: %s",
2861+
self._name, ", ".join(field.name for field in fields))
28572862

28582863
@api.model
28592864
def _setup_complete(self):

odoo/service/server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,12 @@ def cron_thread(self, number):
217217
_logger.debug('cron%d polling for jobs', number)
218218
for db_name, registry in registries.iteritems():
219219
while registry.ready:
220-
acquired = odoo.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name)
221-
if not acquired:
220+
try:
221+
acquired = odoo.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name)
222+
if not acquired:
223+
break
224+
except Exception:
225+
_logger.warning('cron%d encountered an Exception:', number, exc_info=True)
222226
break
223227

224228
def cron_spawn(self):

0 commit comments

Comments
 (0)