[tryton-commits] changeset in weblate:default Late update

2022-04-19 Thread Weblate
changeset dc9c1c71d10e in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset=dc9c1c71d10e
description:
Late update
diffstat:

 templates/account_es_sii.pot |  4 ++--
 templates/user_role.pot  |  4 
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r b3e04b13360e -r dc9c1c71d10e templates/account_es_sii.pot
--- a/templates/account_es_sii.pot  Mon Apr 18 20:08:42 2022 +
+++ b/templates/account_es_sii.pot  Tue Apr 19 23:44:03 2022 +0200
@@ -84,7 +84,7 @@
 msgstr ""
 
 msgctxt "help:account.period,es_sii_send_invoices:"
-msgid "Check to create SII records for the invoices of in the period."
+msgid "Check to create SII records for the invoices in the period."
 msgstr ""
 
 msgctxt "model:account.credential.sii,name:"
@@ -137,7 +137,7 @@
 
 msgctxt "model:ir.message,text:msg_missing_sii_url"
 msgid ""
-"To send invoice to SII service, you need to set an URL on the account "
+"To send invoices to SII service, you need to set an URL on the account "
 "configuration."
 msgstr ""
 
diff -r b3e04b13360e -r dc9c1c71d10e templates/user_role.pot
--- a/templates/user_role.pot   Mon Apr 18 20:08:42 2022 +
+++ b/templates/user_role.pot   Tue Apr 19 23:44:03 2022 +0200
@@ -61,3 +61,7 @@
 msgctxt "selection:ir.cron,method:"
 msgid "Synchronize Users Roles"
 msgstr ""
+
+msgctxt "view:res.user.role:"
+msgid "Time"
+msgstr ""



[tryton-commits] changeset in sao:default Use for...in to iterate over field name...

2022-04-19 Thread Cédric Krier
changeset 94df93f62ead in sao:default
details: https://hg.tryton.org/sao?cmd=changeset=94df93f62ead
description:
Use for...in to iterate over field names from the list of values

The elements of list of values are objects.
Also we can use a Set instead of an object to build the unique list of 
field
names.

issue11415
review407291002
diffstat:

 src/model.js |  10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (29 lines):

diff -r 2089f4eda8cc -r 94df93f62ead src/model.js
--- a/src/model.js  Tue Apr 19 23:17:51 2022 +0200
+++ b/src/model.js  Tue Apr 19 23:40:08 2022 +0200
@@ -2107,20 +2107,20 @@
 }
 if (mode == 'list values') {
 var context = this.get_context(record);
-var field_names = {};
+let field_names = new Set();
 for (const val of value) {
-for (var fieldname of val) {
+for (const fieldname in val) {
 if (!(fieldname in group.model.fields) &&
 (!~fieldname.indexOf('.'))) {
-field_names[fieldname] = true;
+field_names.add(fieldname);
 }
 }
 }
-if (!jQuery.isEmptyObject(field_names)) {
+if (field_names.size) {
 var args = {
 'method': 'model.' + this.description.relation +
 '.fields_get',
-'params': [Object.keys(field_names), context]
+'params': [Array.from(field_names), context]
 };
 var fields;
 try {



[tryton-commits] changeset in modules/account_asset:default Clear revisions when ...

2022-04-19 Thread Adrià Tarroja Caubet
changeset 136f549bbc50 in modules/account_asset:default
details: 
https://hg.tryton.org/modules/account_asset?cmd=changeset=136f549bbc50
description:
Clear revisions when duplicating asset

issue11274
review380401002
diffstat:

 asset.py |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 2d59fd720798 -r 136f549bbc50 asset.py
--- a/asset.py  Tue Apr 19 23:24:03 2022 +0200
+++ b/asset.py  Tue Apr 19 23:24:18 2022 +0200
@@ -695,6 +695,7 @@
 default.setdefault('number', None)
 default.setdefault('supplier_invoice_line', None)
 default.setdefault('move')
+default.setdefault('revisions', [])
 return super(Asset, cls).copy(assets, default=default)
 
 @classmethod



[tryton-commits] changeset in modules/account_asset:default Clear update moves wh...

2022-04-19 Thread Adrià Tarroja Caubet
changeset 2d59fd720798 in modules/account_asset:default
details: 
https://hg.tryton.org/modules/account_asset?cmd=changeset=2d59fd720798
description:
Clear update moves when duplicating asset

issue11274
review386121002
diffstat:

 asset.py |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 23d4d364904b -r 2d59fd720798 asset.py
--- a/asset.py  Mon Apr 18 19:28:34 2022 +0200
+++ b/asset.py  Tue Apr 19 23:24:03 2022 +0200
@@ -691,6 +691,7 @@
 else:
 default = default.copy()
 default.setdefault('lines', [])
+default.setdefault('update_moves', [])
 default.setdefault('number', None)
 default.setdefault('supplier_invoice_line', None)
 default.setdefault('move')



[tryton-commits] changeset in tryton:default Do not request model notifications i...

2022-04-19 Thread Cédric Krier
changeset 014e162a39b1 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=014e162a39b1
description:
Do not request model notifications if they are already empty

issue11411
review388371002
diffstat:

 tryton/common/common.py |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r fdfcec280ed6 -r 014e162a39b1 tryton/common/common.py
--- a/tryton/common/common.py   Tue Apr 19 18:20:56 2022 +0200
+++ b/tryton/common/common.py   Tue Apr 19 23:17:51 2022 +0200
@@ -287,7 +287,7 @@
 
 
 class ModelNotification:
-_depends = {}
+_depends = None
 
 def load_names(self):
 try:
@@ -297,7 +297,7 @@
 pass
 
 def get(self, model):
-if not self._depends:
+if self._depends is None:
 self.load_names()
 return self._depends.get(model, [])
 



[tryton-commits] changeset in sao:default Do not request model notifications if t...

2022-04-19 Thread Cédric Krier
changeset 2089f4eda8cc in sao:default
details: https://hg.tryton.org/sao?cmd=changeset=2089f4eda8cc
description:
Do not request model notifications if they are already empty

issue11411
review388371002
diffstat:

 src/common.js |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 1a7b8019712f -r 2089f4eda8cc src/common.js
--- a/src/common.js Tue Apr 19 18:06:14 2022 +0200
+++ b/src/common.js Tue Apr 19 23:17:51 2022 +0200
@@ -555,7 +555,7 @@
 
 Sao.common.ModelNotification = Sao.class_(Object, {
 init: function() {
-this._depends = {};
+this._depends = null;
 },
 load_names: function() {
 this._depends = Sao.rpc({
@@ -564,7 +564,7 @@
 }, Sao.Session.current_session, false);
 },
 get: function(model) {
-if (jQuery.isEmptyObject(this._depends)) {
+if (!this._depends) {
 this.load_names();
 }
 return this._depends[model] || [];



[tryton-commits] changeset in weblate:default Translated using Weblate (French)

2022-04-19 Thread Cédric Krier
changeset b3e04b13360e in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset=b3e04b13360e
description:
Translated using Weblate (French)

Currently translated at 100.0% (20 of 20 strings)

Translation: Tryton/sale_invoice_date
Translate-URL: 
https://translate.tryton.org/projects/tryton/sale_invoice_date/fr/
diffstat:

 modules/sale_invoice_date/locale/fr.po |  55 ++---
 1 files changed, 36 insertions(+), 19 deletions(-)

diffs (121 lines):

diff -r 6d2e0ebde7d0 -r b3e04b13360e modules/sale_invoice_date/locale/fr.po
--- a/modules/sale_invoice_date/locale/fr.poTue Apr 19 12:16:56 2022 +
+++ b/modules/sale_invoice_date/locale/fr.poMon Apr 18 20:08:42 2022 +
@@ -1,81 +1,98 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2022-04-19 21:08+\n"
+"PO-Revision-Date: 2022-04-19 21:08+\n"
+"Last-Translator: Cédric Krier \n"
+"Language-Team: LANGUAGE \n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n > 1;\n"
+"X-Generator: Weblate 4.11.2\n"
+
 msgctxt "field:party.party,sale_invoice_term:"
 msgid "Sale Invoice Term"
-msgstr ""
+msgstr "Condition de facturation de vente"
 
 msgctxt "field:party.party.sale_method,sale_invoice_term:"
 msgid "Sale Invoice Term"
-msgstr ""
+msgstr "Condition de facturation de vente"
 
 msgctxt "field:sale.configuration,sale_invoice_term:"
 msgid "Sale Invoice Term"
-msgstr ""
+msgstr "Condition de facturation de vente"
 
 msgctxt "field:sale.configuration.sale_method,sale_invoice_term:"
 msgid "Sale Invoice Term"
-msgstr ""
+msgstr "Condition de facturation de vente"
 
 msgctxt "field:sale.invoice.term,name:"
 msgid "Name"
-msgstr ""
+msgstr "Nom"
 
 msgctxt "field:sale.invoice.term,relative_deltas:"
 msgid "Deltas"
-msgstr ""
+msgstr "Deltas"
 
 msgctxt "field:sale.invoice.term.relative_delta,day:"
 msgid "Day of Month"
-msgstr ""
+msgstr "Jour du mois"
 
 msgctxt "field:sale.invoice.term.relative_delta,days:"
 msgid "Number of Days"
-msgstr ""
+msgstr "Nombre de jours"
 
 msgctxt "field:sale.invoice.term.relative_delta,month:"
 msgid "Month"
-msgstr ""
+msgstr "Mois"
 
 msgctxt "field:sale.invoice.term.relative_delta,months:"
 msgid "Number of Months"
-msgstr ""
+msgstr "Nombre de mois"
 
 msgctxt "field:sale.invoice.term.relative_delta,term:"
 msgid "Invoice Term"
-msgstr ""
+msgstr "Condition de facturation"
 
 msgctxt "field:sale.invoice.term.relative_delta,weekday:"
 msgid "Day of Week"
-msgstr ""
+msgstr "Jour de la semaine"
 
 msgctxt "field:sale.invoice.term.relative_delta,weeks:"
 msgid "Number of Weeks"
-msgstr ""
+msgstr "Nombre de semaines"
 
 msgctxt "field:sale.sale,invoice_term:"
 msgid "Invoice Term"
-msgstr ""
+msgstr "Condition de facturation"
 
 msgctxt "help:party.party,sale_invoice_term:"
 msgid ""
 "The default sale invoice term for the customer.\n"
 "Leave empty to use the default value from the configuration."
 msgstr ""
+"La condition de facturation de vente par défaut pour le client.\n"
+"Laissez vide pour utiliser la valeur par défaut de la configuration."
 
 msgctxt "help:sale.invoice.term,name:"
 msgid "The main identifier of the invoice term."
-msgstr ""
+msgstr "L'identifiant principal de la condition de facturation."
 
 msgctxt "model:ir.action,name:act_invoice_term_form"
 msgid "Invoice Terms"
-msgstr ""
+msgstr "Conditions de facturation"
 
 msgctxt "model:ir.ui.menu,name:menu_invoice_term_form"
 msgid "Invoice Terms"
-msgstr ""
+msgstr "Conditions de facturation"
 
 msgctxt "model:sale.invoice.term,name:"
 msgid "Invoice Term"
-msgstr ""
+msgstr "Condition de facturation"
 
 msgctxt "model:sale.invoice.term.relative_delta,name:"
 msgid "Invoice Term Delta"
-msgstr ""
+msgstr "Delta de condition de facturation"



[tryton-commits] changeset in weblate:default Translated using Weblate (Dutch)

2022-04-19 Thread EdbO
changeset 6d2e0ebde7d0 in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset=6d2e0ebde7d0
description:
Translated using Weblate (Dutch)

Currently translated at 100.0% (41 of 41 strings)

Translation: Tryton/web_user
Translate-URL: https://translate.tryton.org/projects/tryton/web_user/nl/
diffstat:

 modules/web_user/locale/nl.po |  14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r 2d4c4a6ffdf6 -r 6d2e0ebde7d0 modules/web_user/locale/nl.po
--- a/modules/web_user/locale/nl.po Tue Apr 19 20:04:33 2022 +
+++ b/modules/web_user/locale/nl.po Tue Apr 19 12:16:56 2022 +
@@ -1,7 +1,7 @@
 #
 msgid ""
 msgstr ""
-"PO-Revision-Date: 2022-04-15 15:09+\n"
+"PO-Revision-Date: 2022-04-19 21:08+\n"
 "Last-Translator: EdbO \n"
 "Language: nl\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -27,7 +27,7 @@
 
 msgctxt "field:web.user,password:"
 msgid "Password"
-msgstr "Paswoord"
+msgstr "Wachtwoord"
 
 msgctxt "field:web.user,password_hash:"
 msgid "Password Hash"
@@ -67,7 +67,7 @@
 
 msgctxt "field:web.user.authenticate.attempt,login:"
 msgid "Login"
-msgstr "Inlognaam"
+msgstr "Loginnaam"
 
 msgctxt "field:web.user.session,key:"
 msgid "Key"
@@ -123,7 +123,7 @@
 
 msgctxt "model:web.user.authenticate.attempt,name:"
 msgid "Web User Authenticate Attempt"
-msgstr "Poging tot authenticatie van webgebruikers"
+msgstr "Inlog poging webgebruikers"
 
 msgctxt "model:web.user.session,name:"
 msgid "Web User Session"
@@ -135,7 +135,7 @@
 
 msgctxt "report:web.user.email_reset_password:"
 msgid "If you didn't make this request, you can ignore this email."
-msgstr "Als je dit verzoek niet hebt gedaan, kun je deze e-mail negeren."
+msgstr "Indien u dit verzoek niet hebt gedaan, kunt u deze e-mail negeren."
 
 msgctxt "report:web.user.email_reset_password:"
 msgid "Reset Password"
@@ -157,11 +157,11 @@
 
 msgctxt "report:web.user.email_validation:"
 msgid "If you received this email by mistake, just ignore it."
-msgstr "Als je deze e-mail per ongeluk hebt ontvangen, negeer deze dan gewoon."
+msgstr "Negeer deze email, als u deze per ongeluk hebt ontvangen."
 
 msgctxt "report:web.user.email_validation:"
 msgid "Just one more step.."
-msgstr "Nog maar een stap.."
+msgstr "Nog maar één stap.."
 
 msgctxt "report:web.user.email_validation:"
 msgid "Validate"



[tryton-commits] changeset in weblate:default Translated using Weblate (French)

2022-04-19 Thread Cédric Krier
changeset 2d4c4a6ffdf6 in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset=2d4c4a6ffdf6
description:
Translated using Weblate (French)

Currently translated at 100.0% (32 of 32 strings)

Translation: Tryton/product_measurements
Translate-URL: 
https://translate.tryton.org/projects/tryton/product_measurements/fr/
diffstat:

 modules/product_measurements/locale/fr.po |  43 ++
 1 files changed, 20 insertions(+), 23 deletions(-)

diffs (160 lines):

diff -r 2f15a0d24556 -r 2d4c4a6ffdf6 modules/product_measurements/locale/fr.po
--- a/modules/product_measurements/locale/fr.po Tue Apr 19 20:05:28 2022 +
+++ b/modules/product_measurements/locale/fr.po Tue Apr 19 20:04:33 2022 +
@@ -1,12 +1,18 @@
 #
 msgid ""
-msgstr "Content-Type: text/plain; charset=UTF-8\n"
+msgstr ""
+"PO-Revision-Date: 2022-04-19 21:08+\n"
+"Last-Translator: Cédric Krier \n"
+"Language: fr\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n > 1;\n"
+"X-Generator: Weblate 4.11.2\n"
 
 msgctxt "field:product.product,height:"
 msgid "Height"
 msgstr "Hauteur"
 
-#, fuzzy
 msgctxt "field:product.product,height_uom:"
 msgid "Height UOM"
 msgstr "UDM de hauteur"
@@ -15,7 +21,6 @@
 msgid "Length"
 msgstr "Longueur"
 
-#, fuzzy
 msgctxt "field:product.product,length_uom:"
 msgid "Length UOM"
 msgstr "UDM de longueur"
@@ -24,7 +29,6 @@
 msgid "Volume"
 msgstr "Volume"
 
-#, fuzzy
 msgctxt "field:product.product,volume_uom:"
 msgid "Volume UOM"
 msgstr "UDM de volume"
@@ -33,7 +37,6 @@
 msgid "Weight"
 msgstr "Poids"
 
-#, fuzzy
 msgctxt "field:product.product,weight_uom:"
 msgid "Weight UOM"
 msgstr "UDM de poids"
@@ -42,7 +45,6 @@
 msgid "Width"
 msgstr "Largeur"
 
-#, fuzzy
 msgctxt "field:product.product,width_uom:"
 msgid "Width UOM"
 msgstr "UDM de largeur"
@@ -51,7 +53,6 @@
 msgid "Height"
 msgstr "Hauteur"
 
-#, fuzzy
 msgctxt "field:product.template,height_uom:"
 msgid "Height UOM"
 msgstr "UDM de hauteur"
@@ -60,7 +61,6 @@
 msgid "Length"
 msgstr "Longueur"
 
-#, fuzzy
 msgctxt "field:product.template,length_uom:"
 msgid "Length UOM"
 msgstr "UDM de longueur"
@@ -69,16 +69,14 @@
 msgid "Volume"
 msgstr "Volume"
 
-#, fuzzy
 msgctxt "field:product.template,volume_uom:"
 msgid "Volume UOM"
-msgstr "UDM du volume"
+msgstr "UDM de volume"
 
 msgctxt "field:product.template,weight:"
 msgid "Weight"
 msgstr "Poids"
 
-#, fuzzy
 msgctxt "field:product.template,weight_uom:"
 msgid "Weight UOM"
 msgstr "UDM de poids"
@@ -87,50 +85,49 @@
 msgid "Width"
 msgstr "Largeur"
 
-#, fuzzy
 msgctxt "field:product.template,width_uom:"
 msgid "Width UOM"
 msgstr "UDM de largeur"
 
 msgctxt "help:product.product,height:"
 msgid "Height for 1 default UOM."
-msgstr ""
+msgstr "Hauteur pour 1 UDM par défaut."
 
 msgctxt "help:product.product,length:"
 msgid "Length for 1 default UOM."
-msgstr ""
+msgstr "Longueur pour 1 UDM par défaut."
 
 msgctxt "help:product.product,volume:"
 msgid "Volume for 1 default UOM."
-msgstr ""
+msgstr "Volume pour 1 UDM par défaut."
 
 msgctxt "help:product.product,weight:"
 msgid "Weight for 1 default UOM."
-msgstr ""
+msgstr "Poids pour 1 UDM par défaut."
 
 msgctxt "help:product.product,width:"
 msgid "Width for 1 default UOM."
-msgstr ""
+msgstr "Largeur pour 1 UDM par défaut."
 
 msgctxt "help:product.template,height:"
 msgid "Height for 1 default UOM."
-msgstr ""
+msgstr "Hauteur pour 1 UDM par défaut."
 
 msgctxt "help:product.template,length:"
 msgid "Length for 1 default UOM."
-msgstr ""
+msgstr "Longueur pour 1 UDM par défaut."
 
 msgctxt "help:product.template,volume:"
 msgid "Volume for 1 default UOM."
-msgstr ""
+msgstr "Volume pour 1 UDM par défaut."
 
 msgctxt "help:product.template,weight:"
 msgid "Weight for 1 default UOM."
-msgstr ""
+msgstr "Poids pour 1 UDM par défaut."
 
 msgctxt "help:product.template,width:"
 msgid "Width for 1 default UOM."
-msgstr ""
+msgstr "Largeur pour 1 UDM par défaut."
 
 msgctxt "view:product.template:"
 msgid "Measurements"
@@ -138,7 +135,7 @@
 
 msgctxt "view:product.template:"
 msgid "Measurements for 1 default UOM."
-msgstr ""
+msgstr "Mesures pour 1 UDM par défaut."
 
 #~ msgctxt "field:product.product,height_digits:"
 #~ msgid "Height Digits"



[tryton-commits] changeset in weblate:default Translated using Weblate (French)

2022-04-19 Thread Cédric Krier
changeset 2f15a0d24556 in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset=2f15a0d24556
description:
Translated using Weblate (French)

Currently translated at 100.0% (16 of 16 strings)

Translation: Tryton/carrier_weight
Translate-URL: 
https://translate.tryton.org/projects/tryton/carrier_weight/fr/
diffstat:

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

diffs (34 lines):

diff -r b290e9b6f7ce -r 2f15a0d24556 modules/carrier_weight/locale/fr.po
--- a/modules/carrier_weight/locale/fr.po   Sun Apr 17 16:06:48 2022 +
+++ b/modules/carrier_weight/locale/fr.po   Tue Apr 19 20:05:28 2022 +
@@ -1,13 +1,13 @@
 #
 msgid ""
 msgstr ""
-"PO-Revision-Date: 2021-09-02 15:33+\n"
-"Last-Translator: Cedric Krier \n"
+"PO-Revision-Date: 2022-04-19 21:08+\n"
+"Last-Translator: Cédric Krier \n"
 "Language: fr\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 4.8\n"
+"X-Generator: Weblate 4.11.2\n"
 
 msgctxt "field:carrier,weight_currency:"
 msgid "Currency"
@@ -19,11 +19,11 @@
 
 msgctxt "field:carrier,weight_uom:"
 msgid "Weight Uom"
-msgstr "Unité de poids"
+msgstr "UDM de poids"
 
 msgctxt "field:carrier,weight_uom_digits:"
 msgid "Weight Uom Digits"
-msgstr "Décimales de l'unité de poids"
+msgstr "Décimales de l'UDM de poids"
 
 msgctxt "field:carrier.weight_price_list,carrier:"
 msgid "Carrier"



[tryton-commits] changeset in tryton:default Use ListBox model to retrieve select...

2022-04-19 Thread Cédric Krier
changeset fdfcec280ed6 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=fdfcec280ed6
description:
Use ListBox model to retrieve selected records

The group attribute on the view may be different then the one currently 
used by
the ListBox model.

issue11350
review388341002
diffstat:

 tryton/gui/window/view_form/view/list_form.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 519b84cdeecd -r fdfcec280ed6 
tryton/gui/window/view_form/view/list_form.py
--- a/tryton/gui/window/view_form/view/list_form.py Mon Apr 18 19:32:26 
2022 +0200
+++ b/tryton/gui/window/view_form/view/list_form.py Tue Apr 19 18:20:56 
2022 +0200
@@ -112,7 +112,8 @@
 @property
 def selected_records(self):
 selected_rows = self.listbox.get_selected_rows()
-return [self.group[r.get_index()] for r in selected_rows]
+return [
+self._model.get_item(r.get_index()).record for r in selected_rows]
 
 def group_list_changed(self, group, action, *args):
 if action == 'record-added':
@@ -133,7 +134,7 @@
 def _row_selected(self, listbox, row):
 if not row:
 return
-self.record = self.group[row.get_index()]
+self.record = self._model.get_item(row.get_index()).record
 
 @common.idle_add
 def _select_show_row(self, index):



[tryton-commits] changeset in sao:default Use JavaScript logical NOT when parsing...

2022-04-19 Thread Cédric Krier
changeset 1a7b8019712f in sao:default
details: https://hg.tryton.org/sao?cmd=changeset=1a7b8019712f
description:
Use JavaScript logical NOT when parsing time

The jQuery isEmptyObject is not true on empty string.

issue11189
review356351002
diffstat:

 src/common.js |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 35a2da4a20d8 -r 1a7b8019712f src/common.js
--- a/src/common.js Tue Apr 19 13:24:43 2022 +0200
+++ b/src/common.js Tue Apr 19 18:06:14 2022 +0200
@@ -242,7 +242,7 @@
 };
 
 Sao.common.parse_time = function(format, value) {
-if (jQuery.isEmptyObject(value)) {
+if (!value) {
 return null;
 }
 var getNumber = function(pattern) {



[tryton-commits] changeset in sao:default Always combine Time when setting DateTi...

2022-04-19 Thread Cédric Krier
changeset 35a2da4a20d8 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset=35a2da4a20d8
description:
Always combine Time when setting DateTime with a Date

issue11346
review368381008
diffstat:

 src/model.js |  6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (16 lines):

diff -r d81e632a687c -r 35a2da4a20d8 src/model.js
--- a/src/model.js  Mon Apr 18 19:42:08 2022 +0200
+++ b/src/model.js  Tue Apr 19 13:24:43 2022 +0200
@@ -1775,10 +1775,8 @@
 value = null;
 }
 } else if (value.isDate) {
-current_value = this.get(record);
-if (current_value) {
-value = Sao.DateTime.combine(value, current_value);
-}
+current_value = this.get(record) || Sao.Time();
+value = Sao.DateTime.combine(value, current_value);
 }
 }
 Sao.field.DateTime._super.set_client.call(this, record, value,



[tryton-commits] changeset in trytond:default Initialize the pool before running ...

2022-04-19 Thread Cédric Krier
changeset b52363a1d962 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=b52363a1d962
description:
Initialize the pool before running queue or cron tasks

issue11400
review384981002
diffstat:

 trytond/cron.py   |   5 +
 trytond/worker.py |  28 ++--
 2 files changed, 23 insertions(+), 10 deletions(-)

diffs (94 lines):

diff -r db29f8a10314 -r b52363a1d962 trytond/cron.py
--- a/trytond/cron.py   Mon Apr 18 19:40:01 2022 +0200
+++ b/trytond/cron.py   Tue Apr 19 13:21:42 2022 +0200
@@ -5,6 +5,7 @@
 import time
 
 from trytond.pool import Pool
+from trytond.transaction import Transaction
 
 __all__ = ['run']
 logger = logging.getLogger(__name__)
@@ -27,7 +28,11 @@
 logger.info(
 'skip "%s" as previous cron still running', db_name)
 continue
+database_list = Pool.database_list()
 pool = Pool(db_name)
+if db_name not in database_list:
+with Transaction().start(db_name, 0, readonly=True):
+pool.init()
 Cron = pool.get('ir.cron')
 thread = threading.Thread(
 target=Cron.run,
diff -r db29f8a10314 -r b52363a1d962 trytond/worker.py
--- a/trytond/worker.py Mon Apr 18 19:40:01 2022 +0200
+++ b/trytond/worker.py Tue Apr 19 13:21:42 2022 +0200
@@ -23,19 +23,22 @@
 
 
 class Queue(object):
-def __init__(self, pool, mpool):
-self.database = backend.Database(pool.database_name).connect()
+def __init__(self, database_name, mpool):
+self.database = backend.Database(database_name).connect()
 self.connection = self.database.get_connection(autocommit=True)
-self.pool = pool
 self.mpool = mpool
 
 def pull(self, name=None):
-Queue = self.pool.get('ir.queue')
+database_list = Pool.database_list()
+pool = Pool(self.database.name)
+if self.database.name not in database_list:
+with Transaction().start(self.database.name, 0, readonly=True):
+pool.init()
+Queue = pool.get('ir.queue')
 return Queue.pull(self.database, self.connection, name=name)
 
 def run(self, task_id):
-return self.mpool.apply_async(
-run_task, (self.pool.database_name, task_id))
+return self.mpool.apply_async(run_task, (self.database.name, task_id))
 
 
 class TaskList(list):
@@ -56,8 +59,9 @@
 processes = 1
 logger.info("start %d workers", processes)
 mpool = MPool(
-processes, initializer, (options,), options.maxtasksperchild)
-queues = [Queue(pool, mpool) for pool in initializer(options, False)]
+processes, initializer, (options.database_names,),
+options.maxtasksperchild)
+queues = [Queue(name, mpool) for name in options.database_names]
 
 tasks = TaskList()
 timeout = options.timeout
@@ -87,12 +91,12 @@
 selector.close()
 
 
-def initializer(options, worker=True):
+def initializer(database_names, worker=True):
 if worker:
 signal.signal(signal.SIGINT, signal.SIG_IGN)
 pools = []
 database_list = Pool.database_list()
-for database_name in options.database_names:
+for database_name in database_names:
 pool = Pool(database_name)
 if database_name not in database_list:
 with Transaction().start(database_name, 0, readonly=True):
@@ -103,7 +107,11 @@
 
 def run_task(pool, task_id):
 if not isinstance(pool, Pool):
+database_list = Pool.database_list()
 pool = Pool(pool)
+if pool.database_name not in database_list:
+with Transaction().start(pool.database_name, 0, readonly=True):
+pool.init()
 Queue = pool.get('ir.queue')
 Error = pool.get('ir.error')
 name = '' % (task_id, pool.database_name)



[tryton-commits] changeset in modules/user_role:default Use datetime for role pla...

2022-04-19 Thread Cédric Krier
changeset 626670b9e7c5 in modules/user_role:default
details: https://hg.tryton.org/modules/user_role?cmd=changeset=626670b9e7c5
description:
Use datetime for role planning

datetime does not depend on the timezone.

issue11028
review391981002
diffstat:

 CHANGELOG|   1 +
 res.py   |  14 ++
 tests/scenario_user_role.rst |  10 +-
 view/user_role_list.xml  |   6 --
 4 files changed, 16 insertions(+), 15 deletions(-)

diffs (112 lines):

diff -r bd7b5ce421f9 -r 626670b9e7c5 CHANGELOG
--- a/CHANGELOG Sat Apr 16 18:30:20 2022 +0200
+++ b/CHANGELOG Tue Apr 19 13:18:10 2022 +0200
@@ -1,3 +1,4 @@
+* Use datetime for role planning
 * Add support for Python 3.10
 * Remove support for Python 3.6
 
diff -r bd7b5ce421f9 -r 626670b9e7c5 res.py
--- a/res.pySat Apr 16 18:30:20 2022 +0200
+++ b/res.pyTue Apr 19 13:18:10 2022 +0200
@@ -1,6 +1,6 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
-import datetime
+import datetime as dt
 
 from trytond.model import ModelSQL, ModelView, fields
 from trytond.pool import Pool, PoolMeta
@@ -63,10 +63,8 @@
 
 @classmethod
 def sync_roles(cls, users=None, date=None):
-pool = Pool()
-Date = pool.get('ir.date')
 if date is None:
-date = Date.today()
+date = dt.datetime.now()
 if users is None:
 users = cls.search([])
 to_write = []
@@ -92,14 +90,14 @@
 user = fields.Many2One(
 'res.user', "User", ondelete='CASCADE', select=True, required=True)
 role = fields.Many2One('res.role', "Role", required=True)
-from_date = fields.Date(
+from_date = fields.DateTime(
 "From Date",
 domain=[
 If(Eval('from_date') & Eval('to_date'),
 ('from_date', '<=', Eval('to_date', None)),
 ()),
 ])
-to_date = fields.Date(
+to_date = fields.DateTime(
 "To Date",
 domain=[
 If(Eval('from_date') & Eval('to_date'),
@@ -114,6 +112,6 @@
 cls._order.insert(1, ('to_date', 'ASC NULLS FIRST'))
 
 def valid(self, date):
-from_date = self.from_date or datetime.date.min
-to_date = self.to_date or datetime.date.max
+from_date = self.from_date or dt.datetime.min
+to_date = self.to_date or dt.datetime.max
 return from_date <= date <= to_date
diff -r bd7b5ce421f9 -r 626670b9e7c5 tests/scenario_user_role.rst
--- a/tests/scenario_user_role.rst  Sat Apr 16 18:30:20 2022 +0200
+++ b/tests/scenario_user_role.rst  Tue Apr 19 13:18:10 2022 +0200
@@ -4,7 +4,7 @@
 
 Imports::
 
->>> import datetime
+>>> import datetime as dt
 >>> from proteus import Model, Wizard
 >>> from trytond.tests.tools import activate_modules
 
@@ -51,7 +51,7 @@
 Start the role in the future::
 
 >>> user_role, = user.roles
->>> user_role.from_date = datetime.date.today() + 
datetime.timedelta(days=1)
+>>> user_role.from_date = dt.datetime.now() + dt.timedelta(days=1)
 >>> user_role.to_date = None
 >>> user.save()
 
@@ -62,7 +62,7 @@
 
 >>> user_role, = user.roles
 >>> user_role.from_date = None
->>> user_role.to_date = datetime.date.today() - datetime.timedelta(days=1)
+>>> user_role.to_date = dt.datetime.now() - dt.timedelta(days=1)
 >>> user.save()
 
 >>> len(user.groups)
@@ -71,8 +71,8 @@
 Start the role in the past and end in the future::
 
 >>> user_role, = user.roles
->>> user_role.from_date = datetime.date.today() - 
datetime.timedelta(days=1)
->>> user_role.to_date = datetime.date.today() + datetime.timedelta(days=1)
+>>> user_role.from_date = dt.datetime.now() - dt.timedelta(days=1)
+>>> user_role.to_date = dt.datetime.now() + dt.timedelta(days=1)
 >>> user.save()
 
 >>> len(user.groups)
diff -r bd7b5ce421f9 -r 626670b9e7c5 view/user_role_list.xml
--- a/view/user_role_list.xml   Sat Apr 16 18:30:20 2022 +0200
+++ b/view/user_role_list.xml   Tue Apr 19 13:18:10 2022 +0200
@@ -4,6 +4,8 @@
 
 
 
-
-
+
+
+
+