[tryton-commits] changeset in trytond:6.2 Do not store in global cache Function f...

2021-11-14 Thread Cédric Krier
changeset 9a06b013733b in trytond:6.2
details: https://hg.tryton.org/trytond?cmd=changeset=9a06b013733b
description:
Do not store in global cache Function field

issue10936
review364331002
(grafted from 055efc4c622fa5bbec91135f8422aaa6997e18c4)
diffstat:

 CHANGELOG |  2 +-
 trytond/model/modelsql.py |  2 --
 trytond/model/modelstorage.py |  3 +--
 3 files changed, 2 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 577e51fc0ee3 -r 9a06b013733b CHANGELOG
--- a/CHANGELOG Sat Nov 13 01:43:55 2021 +0100
+++ b/CHANGELOG Sun Nov 14 23:54:52 2021 +0100
@@ -3,7 +3,7 @@
 * Allow to cast to date with timezone
 * Support create/delete attribute in view
 * Skip default values when copying records
-* Use global cache for Function fields in readonly transactions
+* Use local cache for relation fields in readonly transactions
 * Add format method to DictSchemaMixin
 * Allow modify record name on the reports
 * Add methods to format number and symbol on Lang
diff -r 577e51fc0ee3 -r 9a06b013733b trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Sat Nov 13 01:43:55 2021 +0100
+++ b/trytond/model/modelsql.py Sun Nov 14 23:54:52 2021 +0100
@@ -895,8 +895,6 @@
 for row in sub_results:
 if row['id'] in sub_ids:
 row[fname] = getter_result[row['id']]
-if transaction.readonly:
-cache[row['id']][fname] = row[fname]
 
 def read_related(field, Target, rows, fields):
 name = field.name
diff -r 577e51fc0ee3 -r 9a06b013733b trytond/model/modelstorage.py
--- a/trytond/model/modelstorage.py Sat Nov 13 01:43:55 2021 +0100
+++ b/trytond/model/modelstorage.py Sun Nov 14 23:54:52 2021 +0100
@@ -1720,8 +1720,7 @@
 if (field._type in no_local_cache
 or field.context
 or getattr(field, 'datetime_field', None)
-or (isinstance(field, fields.Function)
-and not transaction.readonly)):
+or isinstance(field, fields.Function)):
 to_delete.add(fname)
 self._cache[id_]._update(
 **{k: v for k, v in data.items() if k not in to_delete})



[tryton-commits] changeset in trytond:6.2 Remove unbreakable spaces around colon

2021-11-14 Thread Cédric Krier
changeset 577e51fc0ee3 in trytond:6.2
details: https://hg.tryton.org/trytond?cmd=changeset=577e51fc0ee3
description:
Remove unbreakable spaces around colon

issue10933
review351011002
(grafted from 04b2ad1412141cff57b20d41d8430589069bb7e9)
diffstat:

 trytond/res/locale/fr.po |  10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (20 lines):

diff -r 3925b109f1a4 -r 577e51fc0ee3 trytond/res/locale/fr.po
--- a/trytond/res/locale/fr.po  Sat Nov 13 01:38:59 2021 +0100
+++ b/trytond/res/locale/fr.po  Sat Nov 13 01:43:55 2021 +0100
@@ -557,11 +557,11 @@
 "[6:tryton://%(host)s/%(database)s][7:]\n"
 "[8:%(http_host)s/#%(database)s]"
 msgstr ""
-"Le mot de passe de votre compte, [1 :%(login)s], a été réinitialisé.[2 :]\n"
-"Vous devez en définir un nouveau dans les préférences de 
l'utilisateur.[3 :]\n"
-"Vous pouvez vous connecter avec ce mot de passe temporaire [4 
:%(password)s] à [5 :]\n"
-"[6 : tryton ://%(host)s/%(database)s][7 :]\n"
-"[8 :%(http_host)s/#%(database)s]"
+"Le mot de passe de votre compte, [1:%(login)s], a été réinitialisé.[2:]\n"
+"Vous devez en définir un nouveau dans les préférences de 
l'utilisateur.[3:]\n"
+"Vous pouvez vous connecter avec ce mot de passe temporaire 
[4:%(password)s] à [5:]\n"
+"[6:tryton://%(host)s/%(database)s][7:]\n"
+"[8:%(http_host)s/#%(database)s]"
 
 msgctxt "report:res.user.email_reset_password:"
 msgid "The password will expire at [1:%(datetime)s UTC]."

[tryton-commits] changeset in trytond:6.0 Include action report name on report na...

2021-11-14 Thread Adrià Tarroja Caubet
changeset 7c28ddc99210 in trytond:6.0
details: https://hg.tryton.org/trytond?cmd=changeset=7c28ddc99210
description:
Include action report name on report name max length

issue10946
review374151002
(grafted from 90517aa1addf77b9a1d8ac5cb65506f7828d6b11)
diffstat:

 trytond/report/report.py |  20 ++--
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 812c69084e51 -r 7c28ddc99210 trytond/report/report.py
--- a/trytond/report/report.py  Fri Nov 05 00:01:42 2021 +0100
+++ b/trytond/report/report.py  Sat Nov 13 01:38:59 2021 +0100
@@ -154,11 +154,13 @@
 else:
 action_report = ActionReport(action_id)
 
-def report_name(records):
+def report_name(records, reserved_length=0):
 names = []
 name_length = 0
 record_count = len(records)
-max_length = REPORT_NAME_MAX_LENGTH - len(str(record_count)) - 2
+max_length = (REPORT_NAME_MAX_LENGTH
+- reserved_length
+- len(str(record_count)) - 2)
 for record in records[:5]:
 record_name = record.rec_name
 name_length += len(record_name) + 1
@@ -190,6 +192,7 @@
 headers.append(dict(key))
 
 n = len(groups)
+join_string = '-'
 if n > 1:
 padding = math.ceil(math.log10(n))
 content = BytesIO()
@@ -198,9 +201,10 @@
 zip(headers, groups), 1):
 oext, rcontent = cls._execute(
 group_records, header, data, action_report)
-filename = report_name(group_records)
 number = str(i).zfill(padding)
-filename = slugify('%s-%s' % (number, filename))
+filename = report_name(
+group_records, len(number) + len(join_string))
+filename = slugify(join_string.join([number, filename]))
 rfilename = '%s.%s' % (filename, oext)
 content_zip.writestr(rfilename, rcontent)
 content = content.getvalue()
@@ -210,8 +214,12 @@
 groups[0], headers[0], data, action_report)
 if not isinstance(content, str):
 content = bytearray(content) if bytes == str else bytes(content)
-filename = '-'.join(
-filter(None, [action_report.name, report_name(records)]))
+action_report_name = action_report.name[:REPORT_NAME_MAX_LENGTH]
+filename = join_string.join(
+filter(None, [
+action_report_name,
+report_name(
+records, len(action_report_name) + len(join_string))]))
 return (oext, content, action_report.direct_print, filename)
 
 @classmethod



[tryton-commits] changeset in trytond:6.2 Include action report name on report na...

2021-11-14 Thread Adrià Tarroja Caubet
changeset 3925b109f1a4 in trytond:6.2
details: https://hg.tryton.org/trytond?cmd=changeset=3925b109f1a4
description:
Include action report name on report name max length

issue10946
review374151002
(grafted from 90517aa1addf77b9a1d8ac5cb65506f7828d6b11)
diffstat:

 trytond/report/report.py |  22 +++---
 1 files changed, 15 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 63897357cc7d -r 3925b109f1a4 trytond/report/report.py
--- a/trytond/report/report.py  Mon Nov 01 16:57:57 2021 +0100
+++ b/trytond/report/report.py  Sat Nov 13 01:38:59 2021 +0100
@@ -157,11 +157,13 @@
 else:
 action_report = ActionReport(action_id)
 
-def report_name(records):
+def report_name(records, reserved_length=0):
 names = []
 name_length = 0
 record_count = len(records)
-max_length = REPORT_NAME_MAX_LENGTH - len(str(record_count)) - 2
+max_length = (REPORT_NAME_MAX_LENGTH
+- reserved_length
+- len(str(record_count)) - 2)
 if action_report.record_name:
 template = TextTemplate(action_report.record_name)
 else:
@@ -200,6 +202,7 @@
 headers.append(dict(key))
 
 n = len(groups)
+join_string = '-'
 if n > 1:
 padding = math.ceil(math.log10(n))
 content = BytesIO()
@@ -208,9 +211,10 @@
 zip(headers, groups), 1):
 oext, rcontent = cls._execute(
 group_records, header, data, action_report)
-filename = report_name(group_records)
 number = str(i).zfill(padding)
-filename = slugify('%s-%s' % (number, filename))
+filename = report_name(
+group_records, len(number) + len(join_string))
+filename = slugify(join_string.join([number, filename]))
 rfilename = '%s.%s' % (filename, oext)
 content_zip.writestr(rfilename, rcontent)
 content = content.getvalue()
@@ -220,11 +224,15 @@
 groups[0], headers[0], data, action_report)
 if not isinstance(content, str):
 content = bytearray(content) if bytes == str else bytes(content)
+action_report_name = action_report.name[:REPORT_NAME_MAX_LENGTH]
 if context.get('with_rec_name', True):
-filename = '-'.join(
-filter(None, [action_report.name, report_name(records)]))
+filename = join_string.join(
+filter(None, [
+action_report_name,
+report_name(
+records, len(action_report_name) + len(join_string))]))
 else:
-filename = action_report.name
+filename = action_report_name
 return (oext, content, action_report.direct_print, filename)
 
 @classmethod



[tryton-commits] changeset in modules/analytic_budget:6.2 Fix author and descript...

2021-11-14 Thread Cédric Krier
changeset e4f6639c597a in modules/analytic_budget:6.2
details: 
https://hg.tryton.org/modules/analytic_budget?cmd=changeset=e4f6639c597a
description:
Fix author and description of package
(grafted from 61f76332c9243035a78434fb07458eb9ae47a6be)
diffstat:

 setup.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (16 lines):

diff -r 1368c30664d7 -r e4f6639c597a setup.py
--- a/setup.py  Mon Nov 01 17:09:48 2021 +0100
+++ b/setup.py  Sat Nov 06 21:19:20 2021 +0100
@@ -76,9 +76,10 @@
 
 setup(name=name,
 version=version,
-description='Tryton module',
+description=(
+'Tryton module that allows creating budgets for analytic accounts'),
 long_description=read('README.rst'),
-author='Tryton module that allows creating budgets for analytic accounts',
+author='Tryton',
 author_email='b...@tryton.org',
 url='http://www.tryton.org/',
 download_url=download_url,



[tryton-commits] changeset in modules/account_budget:6.2 Remove editable on budge...

2021-11-14 Thread Cédric Krier
changeset a9735b32f111 in modules/account_budget:6.2
details: 
https://hg.tryton.org/modules/account_budget?cmd=changeset=a9735b32f111
description:
Remove editable on budget line list

It is not possible to create a new line from the list view as it is 
missing
account and account_type.

issue10930
review375911002
(grafted from dabe732f8b5ca3d21e31201bd5573d1f1eec2b57)
diffstat:

 view/budget_line_list.xml |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 2c71629d1447 -r a9735b32f111 view/budget_line_list.xml
--- a/view/budget_line_list.xml Mon Nov 01 17:06:10 2021 +0100
+++ b/view/budget_line_list.xml Sat Nov 13 01:42:19 2021 +0100
@@ -1,7 +1,7 @@
 
 
-
+
 
 
 



[tryton-commits] changeset in trytond:default Do not store in global cache Functi...

2021-11-14 Thread Cédric Krier
changeset 055efc4c622f in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=055efc4c622f
description:
Do not store in global cache Function field

issue10936
review364331002
diffstat:

 CHANGELOG |  2 +-
 trytond/model/modelsql.py |  2 --
 trytond/model/modelstorage.py |  3 +--
 3 files changed, 2 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 7b8eada9d9ef -r 055efc4c622f CHANGELOG
--- a/CHANGELOG Sat Nov 13 01:49:54 2021 +0100
+++ b/CHANGELOG Sun Nov 14 23:54:52 2021 +0100
@@ -7,7 +7,7 @@
 * Allow to cast to date with timezone
 * Support create/delete attribute in view
 * Skip default values when copying records
-* Use global cache for Function fields in readonly transactions
+* Use local cache for relation fields in readonly transactions
 * Add format method to DictSchemaMixin
 * Allow modify record name on the reports
 * Add methods to format number and symbol on Lang
diff -r 7b8eada9d9ef -r 055efc4c622f trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Sat Nov 13 01:49:54 2021 +0100
+++ b/trytond/model/modelsql.py Sun Nov 14 23:54:52 2021 +0100
@@ -895,8 +895,6 @@
 for row in sub_results:
 if row['id'] in sub_ids:
 row[fname] = getter_result[row['id']]
-if transaction.readonly:
-cache[row['id']][fname] = row[fname]
 
 def read_related(field, Target, rows, fields):
 name = field.name
diff -r 7b8eada9d9ef -r 055efc4c622f trytond/model/modelstorage.py
--- a/trytond/model/modelstorage.py Sat Nov 13 01:49:54 2021 +0100
+++ b/trytond/model/modelstorage.py Sun Nov 14 23:54:52 2021 +0100
@@ -1720,8 +1720,7 @@
 if (field._type in no_local_cache
 or field.context
 or getattr(field, 'datetime_field', None)
-or (isinstance(field, fields.Function)
-and not transaction.readonly)):
+or isinstance(field, fields.Function)):
 to_delete.add(fname)
 self._cache[id_]._update(
 **{k: v for k, v in data.items() if k not in to_delete})