[tryton-commits] changeset in trytond:5.0 Search also for inactive foreign key

2021-10-12 Thread Cédric Krier
changeset 8086934fb5b2 in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset=8086934fb5b2
description:
Search also for inactive foreign key

issue10782
review367581002
(grafted from 2bfee772d30473132e426e18fb1ac25d96f14dda)
diffstat:

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

diffs (13 lines):

diff -r 7a2333cc627a -r 8086934fb5b2 trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Sat Oct 02 00:21:41 2021 +0200
+++ b/trytond/model/modelsql.py Sun Oct 03 00:31:21 2021 +0200
@@ -1106,7 +1106,8 @@
 Model.delete(records)
 
 for Model, field_name in foreign_keys_tocheck:
-with Transaction().set_context(_check_access=False):
+with Transaction().set_context(
+_check_access=False, active_test=False):
 if Model.search([
 (field_name, 'in', sub_ids),
 ], order=[]):



[tryton-commits] changeset in trytond:5.8 Search also for inactive foreign key

2021-10-12 Thread Cédric Krier
changeset 1fa28b6b9cde in trytond:5.8
details: https://hg.tryton.org/trytond?cmd=changeset=1fa28b6b9cde
description:
Search also for inactive foreign key

issue10782
review367581002
(grafted from 2bfee772d30473132e426e18fb1ac25d96f14dda)
diffstat:

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

diffs (13 lines):

diff -r d850846606be -r 1fa28b6b9cde trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Sat Oct 02 00:21:06 2021 +0200
+++ b/trytond/model/modelsql.py Sun Oct 03 00:31:21 2021 +0200
@@ -1142,7 +1142,8 @@
 Model.delete(records)
 
 for Model, field_name in foreign_keys_tocheck:
-with Transaction().set_context(_check_access=False):
+with Transaction().set_context(
+_check_access=False, active_test=False):
 if Model.search([
 (field_name, 'in', sub_ids),
 ], order=[]):



[tryton-commits] changeset in trytond:6.0 Search also for inactive foreign key

2021-10-12 Thread Cédric Krier
changeset 67fd0a851ba5 in trytond:6.0
details: https://hg.tryton.org/trytond?cmd=changeset=67fd0a851ba5
description:
Search also for inactive foreign key

issue10782
review367581002
(grafted from 2bfee772d30473132e426e18fb1ac25d96f14dda)
diffstat:

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

diffs (13 lines):

diff -r 53ea9c223105 -r 67fd0a851ba5 trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Sat Oct 02 00:20:24 2021 +0200
+++ b/trytond/model/modelsql.py Sun Oct 03 00:31:21 2021 +0200
@@ -1152,7 +1152,8 @@
 Model.delete(records)
 
 for Model, field_name in foreign_keys_tocheck:
-with Transaction().set_context(_check_access=False):
+with Transaction().set_context(
+_check_access=False, active_test=False):
 if Model.search([
 (field_name, 'in', sub_ids),
 ], order=[]):



[tryton-commits] changeset in tryton:5.0 Loop over children iter after expanded t...

2021-10-12 Thread Cédric Krier
changeset 671f837cec98 in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset=671f837cec98
description:
Loop over children iter after expanded the autodetected parent

issue10813
review375641003
(grafted from 81f7ed3823caa12346156a1d37f55aa67775bd40)
diffstat:

 tryton/gui/window/win_import.py |  7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r c9399513bdeb -r 671f837cec98 tryton/gui/window/win_import.py
--- a/tryton/gui/window/win_import.py   Fri Oct 08 19:10:46 2021 +0200
+++ b/tryton/gui/window/win_import.py   Fri Oct 08 19:12:56 2021 +0200
@@ -125,9 +125,12 @@
 (prefix + parent):
 self.on_row_expanded(self.view1, iter,
 self.model1.get_path(iter))
+iter = self.model1.iter_children(iter)
+prefix = parent + '/'
 break
-iter = self.model1.iter_next(iter)
-prefix = parent + '/'
+else:
+iter = self.model1.iter_next(iter)
+
 if word in self.fields_invert:
 name = word
 field = self.fields_invert[word]



[tryton-commits] changeset in tryton:5.8 Loop over children iter after expanded t...

2021-10-12 Thread Cédric Krier
changeset 9073c5a62ca1 in tryton:5.8
details: https://hg.tryton.org/tryton?cmd=changeset=9073c5a62ca1
description:
Loop over children iter after expanded the autodetected parent

issue10813
review375641003
(grafted from 81f7ed3823caa12346156a1d37f55aa67775bd40)
diffstat:

 tryton/gui/window/win_import.py |  7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r fd08030f52a1 -r 9073c5a62ca1 tryton/gui/window/win_import.py
--- a/tryton/gui/window/win_import.py   Fri Oct 08 19:10:46 2021 +0200
+++ b/tryton/gui/window/win_import.py   Fri Oct 08 19:12:56 2021 +0200
@@ -133,9 +133,12 @@
 (prefix + parent):
 self.on_row_expanded(self.view1, iter,
 self.model1.get_path(iter))
+iter = self.model1.iter_children(iter)
+prefix = parent + '/'
 break
-iter = self.model1.iter_next(iter)
-prefix = parent + '/'
+else:
+iter = self.model1.iter_next(iter)
+
 if word in self.fields_invert:
 name = word
 field = self.fields_invert[word]



[tryton-commits] changeset in tryton:6.0 Loop over children iter after expanded t...

2021-10-12 Thread Cédric Krier
changeset 6ff1d3fcd68a in tryton:6.0
details: https://hg.tryton.org/tryton?cmd=changeset=6ff1d3fcd68a
description:
Loop over children iter after expanded the autodetected parent

issue10813
review375641003
(grafted from 81f7ed3823caa12346156a1d37f55aa67775bd40)
diffstat:

 tryton/gui/window/win_import.py |  7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r d6f2e85f8ef0 -r 6ff1d3fcd68a tryton/gui/window/win_import.py
--- a/tryton/gui/window/win_import.py   Fri Oct 08 19:10:46 2021 +0200
+++ b/tryton/gui/window/win_import.py   Fri Oct 08 19:12:56 2021 +0200
@@ -133,9 +133,12 @@
 (prefix + parent):
 self.on_row_expanded(self.view1, iter,
 self.model1.get_path(iter))
+iter = self.model1.iter_children(iter)
+prefix = parent + '/'
 break
-iter = self.model1.iter_next(iter)
-prefix = parent + '/'
+else:
+iter = self.model1.iter_next(iter)
+
 if word in self.fields_invert:
 name = word
 field = self.fields_invert[word]



[tryton-commits] changeset in tryton:5.0 Use field context to edit record

2021-10-12 Thread Cédric Krier
changeset c9399513bdeb in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset=c9399513bdeb
description:
Use field context to edit record

issue10806
review364101002
(grafted from 2f3df8d1ed05086b85c2f4218693ee58d44766e5)
diffstat:

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

diffs (13 lines):

diff -r bed92134f0bb -r c9399513bdeb tryton/common/popup_menu.py
--- a/tryton/common/popup_menu.py   Thu Sep 16 23:42:49 2021 +0200
+++ b/tryton/common/popup_menu.py   Fri Oct 08 19:10:46 2021 +0200
@@ -65,7 +65,8 @@
 view_ids=field.attrs.get('view_ids', '').split(','),
 res_id=id_(record),
 mode=['form'],
-name=field.attrs.get('string'))
+name=field.attrs.get('string'),
+context=context)
 
 if title:
 if len(menu):



[tryton-commits] changeset in tryton:5.8 Use field context to edit record

2021-10-12 Thread Cédric Krier
changeset fd08030f52a1 in tryton:5.8
details: https://hg.tryton.org/tryton?cmd=changeset=fd08030f52a1
description:
Use field context to edit record

issue10806
review364101002
(grafted from 2f3df8d1ed05086b85c2f4218693ee58d44766e5)
diffstat:

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

diffs (13 lines):

diff -r b45884060d06 -r fd08030f52a1 tryton/common/popup_menu.py
--- a/tryton/common/popup_menu.py   Sat Oct 02 00:22:54 2021 +0200
+++ b/tryton/common/popup_menu.py   Fri Oct 08 19:10:46 2021 +0200
@@ -82,7 +82,8 @@
 view_ids=field.attrs.get('view_ids', '').split(','),
 res_id=id_(record),
 mode=['form'],
-name=field.attrs.get('string'))
+name=field.attrs.get('string'),
+context=context)
 
 if title:
 if len(menu):



[tryton-commits] changeset in tryton:6.0 Use field context to edit record

2021-10-12 Thread Cédric Krier
changeset d6f2e85f8ef0 in tryton:6.0
details: https://hg.tryton.org/tryton?cmd=changeset=d6f2e85f8ef0
description:
Use field context to edit record

issue10806
review364101002
(grafted from 2f3df8d1ed05086b85c2f4218693ee58d44766e5)
diffstat:

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

diffs (13 lines):

diff -r e98b0970c5e9 -r d6f2e85f8ef0 tryton/common/popup_menu.py
--- a/tryton/common/popup_menu.py   Sat Oct 02 00:22:27 2021 +0200
+++ b/tryton/common/popup_menu.py   Fri Oct 08 19:10:46 2021 +0200
@@ -82,7 +82,8 @@
 view_ids=field.attrs.get('view_ids', '').split(','),
 res_id=id_(record),
 mode=['form'],
-name=field.attrs.get('string'))
+name=field.attrs.get('string'),
+context=context)
 
 if title:
 if len(menu):



[tryton-commits] changeset in sao:5.0 Use field context to edit record

2021-10-12 Thread Cédric Krier
changeset d3665d8e08a6 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset=d3665d8e08a6
description:
Use field context to edit record

issue10806
review364101002
(grafted from 1249931768127750f3c905256aa435285a9a00fc)
diffstat:

 src/view/form.js |  1 +
 src/view/tree.js |  1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r 5f5d1fea93f7 -r d3665d8e08a6 src/view/form.js
--- a/src/view/form.js  Thu Sep 16 23:44:18 2021 +0200
+++ b/src/view/form.js  Fri Oct 08 19:10:46 2021 +0200
@@ -2365,6 +2365,7 @@
 params.res_id = m2o_id;
 params.mode = ['form'];
 params.name = this.attributes.string;
+params.context = this.field.get_context(this.record);
 Sao.Tab.create(params);
 return;
 }
diff -r 5f5d1fea93f7 -r d3665d8e08a6 src/view/tree.js
--- a/src/view/tree.js  Thu Sep 16 23:44:18 2021 +0200
+++ b/src/view/tree.js  Fri Oct 08 19:10:46 2021 +0200
@@ -1674,6 +1674,7 @@
 params.res_id = this.field.get(record);
 params.mode = ['form'];
 params.name = this.attributes.string;
+params.context = this.field.get_context(record);
 Sao.Tab.create(params);
 }.bind(this));
 }



[tryton-commits] changeset in sao:5.8 Use field context to edit record

2021-10-12 Thread Cédric Krier
changeset da32b751934c in sao:5.8
details: https://hg.tryton.org/sao?cmd=changeset=da32b751934c
description:
Use field context to edit record

issue10806
review364101002
(grafted from 1249931768127750f3c905256aa435285a9a00fc)
diffstat:

 src/view/form.js |  1 +
 src/view/tree.js |  1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r 8fe179bba402 -r da32b751934c src/view/form.js
--- a/src/view/form.js  Sun Oct 03 00:40:18 2021 +0200
+++ b/src/view/form.js  Fri Oct 08 19:10:46 2021 +0200
@@ -2484,6 +2484,7 @@
 params.res_id = m2o_id;
 params.mode = ['form'];
 params.name = this.attributes.string;
+params.context = this.field.get_context(this.record);
 Sao.Tab.create(params);
 return;
 }
diff -r 8fe179bba402 -r da32b751934c src/view/tree.js
--- a/src/view/tree.js  Sun Oct 03 00:40:18 2021 +0200
+++ b/src/view/tree.js  Fri Oct 08 19:10:46 2021 +0200
@@ -2195,6 +2195,7 @@
 params.res_id = this.field.get(record);
 params.mode = ['form'];
 params.name = this.attributes.string;
+params.context = this.field.get_context(record);
 Sao.Tab.create(params);
 }.bind(this));
 }



[tryton-commits] changeset in sao:6.0 Use field context to edit record

2021-10-12 Thread Cédric Krier
changeset 3fb3bc4a8ed5 in sao:6.0
details: https://hg.tryton.org/sao?cmd=changeset=3fb3bc4a8ed5
description:
Use field context to edit record

issue10806
review364101002
(grafted from 1249931768127750f3c905256aa435285a9a00fc)
diffstat:

 src/view/form.js |  1 +
 src/view/tree.js |  1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r 87fa740648e9 -r 3fb3bc4a8ed5 src/view/form.js
--- a/src/view/form.js  Sun Oct 03 00:40:18 2021 +0200
+++ b/src/view/form.js  Fri Oct 08 19:10:46 2021 +0200
@@ -2560,6 +2560,7 @@
 params.res_id = m2o_id;
 params.mode = ['form'];
 params.name = this.attributes.string;
+params.context = this.field.get_context(this.record);
 Sao.Tab.create(params);
 return;
 }
diff -r 87fa740648e9 -r 3fb3bc4a8ed5 src/view/tree.js
--- a/src/view/tree.js  Sun Oct 03 00:40:18 2021 +0200
+++ b/src/view/tree.js  Fri Oct 08 19:10:46 2021 +0200
@@ -2267,6 +2267,7 @@
 params.res_id = this.field.get(record);
 params.mode = ['form'];
 params.name = this.attributes.string;
+params.context = this.field.get_context(record);
 Sao.Tab.create(params);
 }.bind(this));
 }



[tryton-commits] changeset in sao:5.8 Create toolbar synchronously

2021-10-12 Thread Cédric Krier
changeset 8fe179bba402 in sao:5.8
details: https://hg.tryton.org/sao?cmd=changeset=8fe179bba402
description:
Create toolbar synchronously

The record_message function needs that all the buttons are created when 
it is
triggered. So we can not delay the creation with an asynchronous call.

issue10783
review360151002
(grafted from a6315854511588fef77cc83c5e37d13b31c55727)
diffstat:

 src/tab.js |  200 ++--
 1 files changed, 99 insertions(+), 101 deletions(-)

diffs (255 lines):

diff -r 06f45da30c10 -r 8fe179bba402 src/tab.js
--- a/src/tab.jsSun Oct 03 00:21:06 2021 +0200
+++ b/src/tab.jsSun Oct 03 00:40:18 2021 +0200
@@ -500,21 +500,20 @@
 create_toolbar: function() {
 var toolbar = Sao.Tab.Form._super.create_toolbar.call(this);
 var screen = this.screen;
-var prm = screen.model.execute('view_toolbar_get', [],
-screen.context);
-prm.done(function(toolbars) {
-[
+var toolbars = screen.model.execute(
+'view_toolbar_get', [], screen.context, false);
+[
 ['action', 'tryton-launch',
 Sao.i18n.gettext('Launch action')],
 ['relate', 'tryton-link',
- Sao.i18n.gettext('Open related records')],
+Sao.i18n.gettext('Open related records')],
 ['print', 'tryton-print',
- Sao.i18n.gettext('Print report')]
-].forEach(function(menu_action) {
-var dropdown = jQuery('', {
-'class': 'btn-group dropdown',
-'role': 'group'
-})
+Sao.i18n.gettext('Print report')]
+].forEach(function(menu_action) {
+var dropdown = jQuery('', {
+'class': 'btn-group dropdown',
+'role': 'group'
+})
 .append(jQuery('', {
 'type': 'button',
 'class': 'btn btn-default navbar-btn dropdown-toggle',
@@ -537,39 +536,39 @@
 'aria-labelledby': menu_action[0]
 }))
 .insertBefore(toolbar.find('button#email'));
-var button = dropdown.find('button');
-this.buttons[menu_action[0]] = button;
-dropdown
-.on('show.bs.dropdown', function() {
-jQuery(this).parents('.btn-group').removeClass(
-'hidden-xs');
-}).on('hide.bs.dropdown', function() {
-jQuery(this).parents('.btn-group').addClass(
-'hidden-xs');
+var button = dropdown.find('button');
+this.buttons[menu_action[0]] = button;
+dropdown
+.on('show.bs.dropdown', function() {
+jQuery(this).parents('.btn-group').removeClass(
+'hidden-xs');
+}).on('hide.bs.dropdown', function() {
+jQuery(this).parents('.btn-group').addClass(
+'hidden-xs');
+});
+var menu = dropdown.find('.dropdown-menu');
+button.click(function() {
+menu.find([
+'.' + menu_action[0] + '_button',
+'.divider-button',
+'.' + menu_action[0] + '_plugin',
+'.divider-plugin'].join(',')).remove();
+var buttons = screen.get_buttons().filter(
+function(button) {
+return menu_action[0] == (
+button.attributes.keyword || 'action');
 });
-var menu = dropdown.find('.dropdown-menu');
-button.click(function() {
-menu.find([
-'.' + menu_action[0] + '_button',
-'.divider-button',
-'.' + menu_action[0] + '_plugin',
-'.divider-plugin'].join(',')).remove();
-var buttons = screen.get_buttons().filter(
-function(button) {
-return menu_action[0] == (
-button.attributes.keyword || 'action');
-});
-if (buttons.length) {
-menu.append(jQuery('', {
-'role': 'separator',
-'class': 'divider divider-button',
-

[tryton-commits] changeset in sao:6.0 Create toolbar synchronously

2021-10-12 Thread Cédric Krier
changeset 87fa740648e9 in sao:6.0
details: https://hg.tryton.org/sao?cmd=changeset=87fa740648e9
description:
Create toolbar synchronously

The record_message function needs that all the buttons are created when 
it is
triggered. So we can not delay the creation with an asynchronous call.

issue10783
review360151002
(grafted from a6315854511588fef77cc83c5e37d13b31c55727)
diffstat:

 src/tab.js |  200 ++--
 1 files changed, 99 insertions(+), 101 deletions(-)

diffs (255 lines):

diff -r f5737e258468 -r 87fa740648e9 src/tab.js
--- a/src/tab.jsSun Oct 03 00:21:06 2021 +0200
+++ b/src/tab.jsSun Oct 03 00:40:18 2021 +0200
@@ -513,21 +513,20 @@
 create_toolbar: function() {
 var toolbar = Sao.Tab.Form._super.create_toolbar.call(this);
 var screen = this.screen;
-var prm = screen.model.execute('view_toolbar_get', [],
-screen.context);
-prm.done(function(toolbars) {
-[
+var toolbars = screen.model.execute(
+'view_toolbar_get', [], screen.context, false);
+[
 ['action', 'tryton-launch',
 Sao.i18n.gettext('Launch action')],
 ['relate', 'tryton-link',
- Sao.i18n.gettext('Open related records')],
+Sao.i18n.gettext('Open related records')],
 ['print', 'tryton-print',
- Sao.i18n.gettext('Print report')]
-].forEach(function(menu_action) {
-var dropdown = jQuery('', {
-'class': 'btn-group dropdown',
-'role': 'group'
-})
+Sao.i18n.gettext('Print report')]
+].forEach(function(menu_action) {
+var dropdown = jQuery('', {
+'class': 'btn-group dropdown',
+'role': 'group'
+})
 .append(jQuery('', {
 'type': 'button',
 'class': 'btn btn-default navbar-btn dropdown-toggle',
@@ -550,39 +549,39 @@
 'aria-labelledby': menu_action[0]
 }))
 .insertBefore(toolbar.find('button#email'));
-var button = dropdown.find('button');
-this.buttons[menu_action[0]] = button;
-dropdown
-.on('show.bs.dropdown', function() {
-jQuery(this).parents('.btn-group').removeClass(
-'hidden-xs');
-}).on('hide.bs.dropdown', function() {
-jQuery(this).parents('.btn-group').addClass(
-'hidden-xs');
+var button = dropdown.find('button');
+this.buttons[menu_action[0]] = button;
+dropdown
+.on('show.bs.dropdown', function() {
+jQuery(this).parents('.btn-group').removeClass(
+'hidden-xs');
+}).on('hide.bs.dropdown', function() {
+jQuery(this).parents('.btn-group').addClass(
+'hidden-xs');
+});
+var menu = dropdown.find('.dropdown-menu');
+button.click(function() {
+menu.find([
+'.' + menu_action[0] + '_button',
+'.divider-button',
+'.' + menu_action[0] + '_plugin',
+'.divider-plugin'].join(',')).remove();
+var buttons = screen.get_buttons().filter(
+function(button) {
+return menu_action[0] == (
+button.attributes.keyword || 'action');
 });
-var menu = dropdown.find('.dropdown-menu');
-button.click(function() {
-menu.find([
-'.' + menu_action[0] + '_button',
-'.divider-button',
-'.' + menu_action[0] + '_plugin',
-'.divider-plugin'].join(',')).remove();
-var buttons = screen.get_buttons().filter(
-function(button) {
-return menu_action[0] == (
-button.attributes.keyword || 'action');
-});
-if (buttons.length) {
-menu.append(jQuery('', {
-'role': 'separator',
-'class': 'divider divider-button',
-

[tryton-commits] changeset in sao:5.8 Add margin on button in horizontal group

2021-10-12 Thread Cédric Krier
changeset 06f45da30c10 in sao:5.8
details: https://hg.tryton.org/sao?cmd=changeset=06f45da30c10
description:
Add margin on button in horizontal group

It is needed to display correctly the box-shadow of the theme.

issue10771
review367571002
(grafted from 924b5e5a9c9313110add9f510526a13c200474c4)
diffstat:

 src/sao.less |  5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r d325febb2730 -r 06f45da30c10 src/sao.less
--- a/src/sao.less  Sat Oct 02 00:24:12 2021 +0200
+++ b/src/sao.less  Sun Oct 03 00:21:06 2021 +0200
@@ -507,6 +507,11 @@
 table.form-hcontainer > tbody > tr > td {
 padding-top: 0px;
 padding-bottom: 0px;
+
+> .btn {
+margin-top: 2px;
+margin-bottom: 2px;
+}
 }
 table.form-vcontainer > tbody > tr > td {
 padding-left: 0px;



[tryton-commits] changeset in sao:6.0 Add margin on button in horizontal group

2021-10-12 Thread Cédric Krier
changeset f5737e258468 in sao:6.0
details: https://hg.tryton.org/sao?cmd=changeset=f5737e258468
description:
Add margin on button in horizontal group

It is needed to display correctly the box-shadow of the theme.

issue10771
review367571002
(grafted from 924b5e5a9c9313110add9f510526a13c200474c4)
diffstat:

 src/sao.less |  5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r bb196c4e4050 -r f5737e258468 src/sao.less
--- a/src/sao.less  Sat Oct 02 00:23:38 2021 +0200
+++ b/src/sao.less  Sun Oct 03 00:21:06 2021 +0200
@@ -542,6 +542,11 @@
 table.form-hcontainer > tbody > tr > td {
 padding-top: 0px;
 padding-bottom: 0px;
+
+> .btn {
+margin-top: 2px;
+margin-bottom: 2px;
+}
 }
 table.form-vcontainer > tbody > tr > td {
 padding-left: 0px;



[tryton-commits] changeset in modules/stock_assign_manual:5.8 Restore initial val...

2021-10-12 Thread Cédric Krier
changeset 692c1477bcd5 in modules/stock_assign_manual:5.8
details: 
https://hg.tryton.org/modules/stock_assign_manual?cmd=changeset=692c1477bcd5
description:
Restore initial values if assign_try is partial

The assign_try method may have saved the move with the modification 
applied by
the key. So we must restore the initial values for the unassigned 
quantity.

issue10729
review379081002
(grafted from babb936c3f84b93ead038a1e587d988b22a20ccd)
diffstat:

 stock.py |  22 --
 1 files changed, 16 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r a43f559bd67f -r 692c1477bcd5 stock.py
--- a/stock.py  Fri Jan 01 16:39:31 2021 +0100
+++ b/stock.py  Sun Oct 03 00:29:16 2021 +0200
@@ -262,18 +262,28 @@
 self.move.save()
 Move.copy([self.move], {'quantity': remainder})
 key = json.loads(self.place)
-self._apply(key, grouping)
+values = self._apply(key, grouping)
 quantity = self.move.quantity
 Move.assign_try([self.move], with_childs=False, grouping=grouping)
-if self.move.state != 'assigned' and self.move.quantity == quantity:
-raise UserError(gettext(
-'stock_assign_manual.msg_assign_failed',
-move=self.move.rec_name,
-place=self.place_string))
+if self.move.state != 'assigned':
+# Restore initial values as assign_try may have saved the move
+for field, value in values.items():
+setattr(self.move, field, value)
+self.move.save()
+if self.move.quantity == quantity:
+raise UserError(gettext(
+'stock_assign_manual.msg_assign_failed',
+move=self.move.rec_name,
+place=self.place_string))
 
 def _apply(self, key, grouping):
+"""Update the move according to the key
+and return a dictionary with the initial values."""
+values = {'from_location': self.move.from_location.id}
 location_id = key[0]
 self.move.from_location = location_id
 for field, value in zip(grouping, key[1:]):
 if value is not None and '.' not in field:
+values[field] = getattr(self.move, field)
 setattr(self.move, field, value)
+return values



[tryton-commits] changeset in modules/stock_assign_manual:6.0 Restore initial val...

2021-10-12 Thread Cédric Krier
changeset 755cf0466657 in modules/stock_assign_manual:6.0
details: 
https://hg.tryton.org/modules/stock_assign_manual?cmd=changeset=755cf0466657
description:
Restore initial values if assign_try is partial

The assign_try method may have saved the move with the modification 
applied by
the key. So we must restore the initial values for the unassigned 
quantity.

issue10729
review379081002
(grafted from babb936c3f84b93ead038a1e587d988b22a20ccd)
diffstat:

 stock.py |  22 --
 1 files changed, 16 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r 579c3050afa4 -r 755cf0466657 stock.py
--- a/stock.py  Mon May 03 15:48:32 2021 +0200
+++ b/stock.py  Sun Oct 03 00:29:16 2021 +0200
@@ -297,21 +297,31 @@
 self.move.save()
 Move.copy([self.move], {'quantity': remainder})
 key = json.loads(self.place)
-self._apply(key, grouping)
+values = self._apply(key, grouping)
 quantity = self.move.quantity
 Move.assign_try([self.move], with_childs=False, grouping=grouping)
-if self.move.state != 'assigned' and self.move.quantity == quantity:
-raise UserError(gettext(
-'stock_assign_manual.msg_assign_failed',
-move=self.move.rec_name,
-place=self.place_string))
+if self.move.state != 'assigned':
+# Restore initial values as assign_try may have saved the move
+for field, value in values.items():
+setattr(self.move, field, value)
+self.move.save()
+if self.move.quantity == quantity:
+raise UserError(gettext(
+'stock_assign_manual.msg_assign_failed',
+move=self.move.rec_name,
+place=self.place_string))
 
 def _apply(self, key, grouping):
+"""Update the move according to the key
+and return a dictionary with the initial values."""
+values = {'from_location': self.move.from_location.id}
 location_id = key[0]
 self.move.from_location = location_id
 for field, value in zip(grouping, key[1:]):
 if value is not None and '.' not in field:
+values[field] = getattr(self.move, field)
 setattr(self.move, field, value)
+return values
 
 
 class ShipmentUnassignManual(Wizard):



[tryton-commits] changeset in modules/sale_supply_drop_shipment:6.0 Replace domai...

2021-10-12 Thread Cédric Krier
changeset 8523650ccbf9 in modules/sale_supply_drop_shipment:6.0
details: 
https://hg.tryton.org/modules/sale_supply_drop_shipment?cmd=changeset=8523650ccbf9
description:
Replace domain against code by sequence type

issue10795
review373661003
(grafted from 4e0c709a11362f53f93b11c06344ac43872c84f1)
diffstat:

 stock.py |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r d7e2bc895344 -r 8523650ccbf9 stock.py
--- a/stock.py  Mon May 03 16:05:56 2021 +0200
+++ b/stock.py  Sun Oct 03 13:45:11 2021 +0200
@@ -54,7 +54,9 @@
 'ir.sequence', "Drop Shipment Sequence", required=True,
 domain=[
 ('company', 'in', [Eval('company', -1), None]),
-('code', '=', 'stock.shipment.drop'),
+('sequence_type', '=',
+Id('sale_supply_drop_shipment',
+'sequence_type_shipment_drop')),
 ],
 depends=['company'])
 



[tryton-commits] changeset in modules/sale_shipment_cost:6.0 Invoice shipment cos...

2021-10-12 Thread Maxime Richez
changeset faf5c243e44b in modules/sale_shipment_cost:6.0
details: 
https://hg.tryton.org/modules/sale_shipment_cost?cmd=changeset=faf5c243e44b
description:
Invoice shipment cost without cost

issue10798
review372051002
(grafted from 5f9eb01ead9117e860bc940f92951a81a37d984c)
diffstat:

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

diffs (11 lines):

diff -r 313477c3de88 -r faf5c243e44b sale.py
--- a/sale.py   Wed Sep 01 22:55:31 2021 +0200
+++ b/sale.py   Wed Sep 29 10:42:56 2021 +0200
@@ -311,7 +311,6 @@
 for shipment in shipments:
 if (shipment.state == 'done'
 and shipment.carrier
-and shipment.cost
 and not shipment.cost_invoice_line):
 invoice_line = shipment.get_cost_invoice_line(invoice)
 if not invoice_line:



[tryton-commits] changeset in modules/sale_advance_payment:5.0 Set sale currency ...

2021-10-12 Thread Sergi Almacellas Abellana
changeset 2f5f93c8be46 in modules/sale_advance_payment:5.0
details: 
https://hg.tryton.org/modules/sale_advance_payment?cmd=changeset=2f5f93c8be46
description:
Set sale currency on invoice line currency

issue10812
review372111002
(grafted from 8628bac68afc55118b295c0218b06d7a1dd6f544)
diffstat:

 sale.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 4fe3fb4da2af -r 2f5f93c8be46 sale.py
--- a/sale.py   Thu Jun 17 22:04:33 2021 +0200
+++ b/sale.py   Thu Oct 07 15:28:21 2021 +0200
@@ -251,7 +251,6 @@
 
 invoice_line = InvoiceLine()
 invoice_line.invoice = invoice
-invoice_line.company = invoice.company
 invoice_line.type = 'line'
 invoice_line.quantity = 1
 invoice_line.account = self.account
@@ -259,6 +258,7 @@
 invoice_line.description = self.description
 invoice_line.origin = self
 invoice_line.company = self.sale.company
+invoice_line.currency = self.sale.currency
 # Set taxes
 invoice_line.on_change_account()
 return [invoice_line]



[tryton-commits] changeset in modules/sale_advance_payment:5.8 Set sale currency ...

2021-10-12 Thread Sergi Almacellas Abellana
changeset 058a001f9580 in modules/sale_advance_payment:5.8
details: 
https://hg.tryton.org/modules/sale_advance_payment?cmd=changeset=058a001f9580
description:
Set sale currency on invoice line currency

issue10812
review372111002
(grafted from 8628bac68afc55118b295c0218b06d7a1dd6f544)
diffstat:

 sale.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 2b9dd2500be4 -r 058a001f9580 sale.py
--- a/sale.py   Fri Feb 19 21:26:47 2021 +0100
+++ b/sale.py   Thu Oct 07 15:28:21 2021 +0200
@@ -240,7 +240,6 @@
 
 invoice_line = InvoiceLine()
 invoice_line.invoice = invoice
-invoice_line.company = invoice.company
 invoice_line.type = 'line'
 invoice_line.quantity = 1
 invoice_line.account = self.account
@@ -248,6 +247,7 @@
 invoice_line.description = self.description
 invoice_line.origin = self
 invoice_line.company = self.sale.company
+invoice_line.currency = self.sale.currency
 # Set taxes
 invoice_line.on_change_account()
 return [invoice_line]



[tryton-commits] changeset in modules/sale_advance_payment:6.0 Set sale currency ...

2021-10-12 Thread Sergi Almacellas Abellana
changeset ab00f5b194bf in modules/sale_advance_payment:6.0
details: 
https://hg.tryton.org/modules/sale_advance_payment?cmd=changeset=ab00f5b194bf
description:
Set sale currency on invoice line currency

issue10812
review372111002
(grafted from 8628bac68afc55118b295c0218b06d7a1dd6f544)
diffstat:

 sale.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r ddb4157fae4e -r ab00f5b194bf sale.py
--- a/sale.py   Mon May 03 16:04:52 2021 +0200
+++ b/sale.py   Thu Oct 07 15:28:21 2021 +0200
@@ -245,7 +245,6 @@
 
 invoice_line = InvoiceLine()
 invoice_line.invoice = invoice
-invoice_line.company = invoice.company
 invoice_line.type = 'line'
 invoice_line.quantity = 1
 invoice_line.account = self.account
@@ -253,6 +252,7 @@
 invoice_line.description = self.description
 invoice_line.origin = self
 invoice_line.company = self.sale.company
+invoice_line.currency = self.sale.currency
 # Set taxes
 invoice_line.on_change_account()
 return [invoice_line]



[tryton-commits] changeset in modules/product_kit:6.0 Convert invoiced quantity i...

2021-10-12 Thread Cédric Krier
changeset 93db8103bcc4 in modules/product_kit:6.0
details: 
https://hg.tryton.org/modules/product_kit?cmd=changeset=93db8103bcc4
description:
Convert invoiced quantity into the order line unit

And only after applying the price ratio, we can convert from the price 
from the
component unit to the move unit.

issue10800
review375611002
(grafted from f4a92834bdb5a213cdacf6f53b28beea6612fc35)
diffstat:

 stock.py|  5 +++--
 tests/scenario_product_kit_purchase.rst |  7 +++
 tests/scenario_product_kit_sale.rst |  7 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r 645d2334fc0c -r 93db8103bcc4 stock.py
--- a/stock.py  Thu Sep 16 23:48:41 2021 +0200
+++ b/stock.py  Sat Oct 02 15:29:44 2021 +0200
@@ -22,11 +22,12 @@
 with Transaction().set_context(date=self.effective_date):
 amount += Currency.compute(
 line.invoice.currency, line.amount, self.currency)
-quantity = UoM.compute_qty(
-line.unit, line.quantity, self.uom)
+quantity += UoM.compute_qty(
+line.unit, line.quantity, self.origin.line.unit)
 amount *= self.origin.price_ratio
 if quantity:
 unit_price = round_price(amount / Decimal(str(quantity)))
+unit_price = UoM.compute_price(self.origin.unit, unit_price, self.uom)
 return unit_price
 
 
diff -r 645d2334fc0c -r 93db8103bcc4 tests/scenario_product_kit_purchase.rst
--- a/tests/scenario_product_kit_purchase.rst   Thu Sep 16 23:48:41 2021 +0200
+++ b/tests/scenario_product_kit_purchase.rst   Sat Oct 02 15:29:44 2021 +0200
@@ -248,6 +248,13 @@
 >>> invoice.state
 'posted'
 
+Check unit price of moves::
+
+>>> shipment.reload()
+>>> invoice.reload()
+>>> sorted([m.unit_price for m in shipment.incoming_moves])
+[Decimal('5.'), Decimal('5.'), Decimal('7.0909'), 
Decimal('18.9091')]
+
 Check backorder moves::
 
 >>> len(purchase.moves)
diff -r 645d2334fc0c -r 93db8103bcc4 tests/scenario_product_kit_sale.rst
--- a/tests/scenario_product_kit_sale.rst   Thu Sep 16 23:48:41 2021 +0200
+++ b/tests/scenario_product_kit_sale.rst   Sat Oct 02 15:29:44 2021 +0200
@@ -231,6 +231,13 @@
 >>> invoice.state
 'posted'
 
+Check unit price of moves::
+
+>>> shipment.reload()
+>>> invoice.reload()
+>>> sorted([m.unit_price for m in shipment.outgoing_moves])
+[Decimal('10.'), Decimal('10.'), Decimal('15.'), 
Decimal('25.')]
+
 Check backorder::
 
 >>> _, backorder = sale.shipments



[tryton-commits] changeset in modules/account_payment_sepa:5.0 Rename getter of h...

2021-10-12 Thread Cédric Krier
changeset 21c174473c58 in modules/account_payment_sepa:5.0
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=21c174473c58
description:
Rename getter of has_payments to avoid name collision

issue10810
review339021002
(grafted from 99a864afc2b93a87550b32f4bcd4a45796b91f93)
diffstat:

 payment.py |  8 
 tests/test_account_payment_sepa.py |  2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r dc1b65008782 -r 21c174473c58 payment.py
--- a/payment.pyThu Jun 17 21:48:23 2021 +0200
+++ b/payment.pySun Oct 03 13:48:43 2021 +0200
@@ -405,7 +405,7 @@
 ], 'State', readonly=True)
 payments = fields.One2Many('account.payment', 'sepa_mandate', 'Payments')
 has_payments = fields.Function(fields.Boolean('Has Payments'),
-'has_payments')
+'get_has_payments')
 
 @classmethod
 def __setup__(cls):
@@ -550,10 +550,10 @@
 return 'RCUR'
 
 @classmethod
-def has_payments(cls, mandates, name):
+def get_has_payments(cls, mandates, name):
 pool = Pool()
 Payment = pool.get('account.payment')
-payment = Payment.__table__
+payment = Payment.__table__()
 cursor = Transaction().connection.cursor()
 
 has_payments = dict.fromkeys([m.id for m in mandates], False)
@@ -564,7 +564,7 @@
 group_by=payment.sepa_mandate))
 has_payments.update(cursor.fetchall())
 
-return {'has_payments': has_payments}
+return has_payments
 
 @classmethod
 @ModelView.button
diff -r dc1b65008782 -r 21c174473c58 tests/test_account_payment_sepa.py
--- a/tests/test_account_payment_sepa.pyThu Jun 17 21:48:23 2021 +0200
+++ b/tests/test_account_payment_sepa.pySun Oct 03 13:48:43 2021 +0200
@@ -341,6 +341,7 @@
 journal = setup_journal('pain.008.001.02', 'receivable',
 company, company_account)
 
+self.assertFalse(mandate.has_payments)
 self.assertEqual(mandate.sequence_type, 'FRST')
 mandate.sequence_type_rcur = True
 self.assertEqual(mandate.sequence_type, 'RCUR')
@@ -363,6 +364,7 @@
 _, data = process_payment.do_process(None)
 
 self.assertEqual(payment.sepa_mandate_sequence_type, 'FRST')
+self.assertTrue(payment.sepa_mandate.has_payments)
 
 payments = Payment.create([{
 'company': company,



[tryton-commits] changeset in modules/account_payment_sepa:5.8 Rename getter of h...

2021-10-12 Thread Cédric Krier
changeset e2385ef1d1c7 in modules/account_payment_sepa:5.8
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=e2385ef1d1c7
description:
Rename getter of has_payments to avoid name collision

issue10810
review339021002
(grafted from 99a864afc2b93a87550b32f4bcd4a45796b91f93)
diffstat:

 payment.py |  8 
 tests/test_account_payment_sepa.py |  2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r 29ea041d21d3 -r e2385ef1d1c7 payment.py
--- a/payment.pyFri Jan 01 16:21:18 2021 +0100
+++ b/payment.pySun Oct 03 13:48:43 2021 +0200
@@ -476,7 +476,7 @@
 ], 'State', readonly=True)
 payments = fields.One2Many('account.payment', 'sepa_mandate', 'Payments')
 has_payments = fields.Function(fields.Boolean('Has Payments'),
-'has_payments')
+'get_has_payments')
 
 @classmethod
 def __setup__(cls):
@@ -638,10 +638,10 @@
 return 'RCUR'
 
 @classmethod
-def has_payments(cls, mandates, name):
+def get_has_payments(cls, mandates, name):
 pool = Pool()
 Payment = pool.get('account.payment')
-payment = Payment.__table__
+payment = Payment.__table__()
 cursor = Transaction().connection.cursor()
 
 has_payments = dict.fromkeys([m.id for m in mandates], False)
@@ -652,7 +652,7 @@
 group_by=payment.sepa_mandate))
 has_payments.update(cursor.fetchall())
 
-return {'has_payments': has_payments}
+return has_payments
 
 @classmethod
 @ModelView.button
diff -r 29ea041d21d3 -r e2385ef1d1c7 tests/test_account_payment_sepa.py
--- a/tests/test_account_payment_sepa.pyFri Jan 01 16:21:18 2021 +0100
+++ b/tests/test_account_payment_sepa.pySun Oct 03 13:48:43 2021 +0200
@@ -295,6 +295,7 @@
 journal = setup_journal('pain.008.001.02', 'receivable',
 company, company_account)
 
+self.assertFalse(mandate.has_payments)
 self.assertEqual(mandate.sequence_type, 'FRST')
 mandate.sequence_type_rcur = True
 self.assertEqual(mandate.sequence_type, 'RCUR')
@@ -318,6 +319,7 @@
 _, data = process_payment.do_process(None)
 
 self.assertEqual(payment.sepa_mandate_sequence_type, 'FRST')
+self.assertTrue(payment.sepa_mandate.has_payments)
 
 payments = Payment.create([{
 'company': company,



[tryton-commits] changeset in modules/account_payment_sepa:6.0 Rename getter of h...

2021-10-12 Thread Cédric Krier
changeset 21ba112d0513 in modules/account_payment_sepa:6.0
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=21ba112d0513
description:
Rename getter of has_payments to avoid name collision

issue10810
review339021002
(grafted from 99a864afc2b93a87550b32f4bcd4a45796b91f93)
diffstat:

 payment.py |  8 
 tests/test_account_payment_sepa.py |  2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r 6ba30812b116 -r 21ba112d0513 payment.py
--- a/payment.pyThu Sep 16 23:50:29 2021 +0200
+++ b/payment.pySun Oct 03 13:48:43 2021 +0200
@@ -482,7 +482,7 @@
 ], 'State', readonly=True)
 payments = fields.One2Many('account.payment', 'sepa_mandate', 'Payments')
 has_payments = fields.Function(fields.Boolean('Has Payments'),
-'has_payments')
+'get_has_payments')
 
 @classmethod
 def __setup__(cls):
@@ -650,10 +650,10 @@
 return 'RCUR'
 
 @classmethod
-def has_payments(cls, mandates, name):
+def get_has_payments(cls, mandates, name):
 pool = Pool()
 Payment = pool.get('account.payment')
-payment = Payment.__table__
+payment = Payment.__table__()
 cursor = Transaction().connection.cursor()
 
 has_payments = dict.fromkeys([m.id for m in mandates], False)
@@ -664,7 +664,7 @@
 group_by=payment.sepa_mandate))
 has_payments.update(cursor)
 
-return {'has_payments': has_payments}
+return has_payments
 
 @classmethod
 @ModelView.button
diff -r 6ba30812b116 -r 21ba112d0513 tests/test_account_payment_sepa.py
--- a/tests/test_account_payment_sepa.pyThu Sep 16 23:50:29 2021 +0200
+++ b/tests/test_account_payment_sepa.pySun Oct 03 13:48:43 2021 +0200
@@ -299,6 +299,7 @@
 journal = setup_journal('pain.008.001.02', 'receivable',
 company, company_account)
 
+self.assertFalse(mandate.has_payments)
 self.assertEqual(mandate.sequence_type, 'FRST')
 mandate.sequence_type_rcur = True
 self.assertEqual(mandate.sequence_type, 'RCUR')
@@ -322,6 +323,7 @@
 _, data = process_payment.do_process(None)
 
 self.assertEqual(payment.sepa_mandate_sequence_type, 'FRST')
+self.assertTrue(payment.sepa_mandate.has_payments)
 
 payments = Payment.create([{
 'company': company,



[tryton-commits] changeset in modules/account_fr_chorus:5.0 Convert payload base6...

2021-10-12 Thread Cédric Krier
changeset 1a92afbd4b30 in modules/account_fr_chorus:5.0
details: 
https://hg.tryton.org/modules/account_fr_chorus?cmd=changeset=1a92afbd4b30
description:
Convert payload base64 bytes into ASCII string

issue10780
review364141002
(grafted from 1d7367f5a6f09ab0508622ef973b61f3649bd69d)
diffstat:

 account.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r ae28d8e0c62d -r 1a92afbd4b30 account.py
--- a/account.pyThu Jun 17 21:46:02 2021 +0200
+++ b/account.pyFri Oct 08 19:14:03 2021 +0200
@@ -225,7 +225,7 @@
 filename = EDOC2FILENAME[self.syntax] % self.invoice.number
 filename = filename.replace('/', '-')
 return {
-'fichierFlux': base64.b64encode(data),
+'fichierFlux': base64.b64encode(data).decode('ascii'),
 'nomFichier': filename,
 'syntaxeFlux': EDOC2SYNTAX[self.syntax],
 'avecSignature': False,



[tryton-commits] changeset in modules/account_fr_chorus:5.8 Convert payload base6...

2021-10-12 Thread Cédric Krier
changeset fd29bee54e44 in modules/account_fr_chorus:5.8
details: 
https://hg.tryton.org/modules/account_fr_chorus?cmd=changeset=fd29bee54e44
description:
Convert payload base64 bytes into ASCII string

issue10780
review364141002
(grafted from 1d7367f5a6f09ab0508622ef973b61f3649bd69d)
diffstat:

 account.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r aad27667b973 -r fd29bee54e44 account.py
--- a/account.pySat Oct 02 00:31:27 2021 +0200
+++ b/account.pyFri Oct 08 19:14:03 2021 +0200
@@ -228,7 +228,7 @@
 filename = EDOC2FILENAME[self.syntax] % self.invoice.number
 filename = filename.replace('/', '-')
 return {
-'fichierFlux': base64.b64encode(data),
+'fichierFlux': base64.b64encode(data).decode('ascii'),
 'nomFichier': filename,
 'syntaxeFlux': EDOC2SYNTAX[self.syntax],
 'avecSignature': False,



[tryton-commits] changeset in modules/account_fr_chorus:6.0 Convert payload base6...

2021-10-12 Thread Cédric Krier
changeset a33a3767c9b9 in modules/account_fr_chorus:6.0
details: 
https://hg.tryton.org/modules/account_fr_chorus?cmd=changeset=a33a3767c9b9
description:
Convert payload base64 bytes into ASCII string

issue10780
review364141002
(grafted from 1d7367f5a6f09ab0508622ef973b61f3649bd69d)
diffstat:

 account.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 7a4bb956db8c -r a33a3767c9b9 account.py
--- a/account.pySat Oct 02 00:31:06 2021 +0200
+++ b/account.pyFri Oct 08 19:14:03 2021 +0200
@@ -226,7 +226,7 @@
 filename = EDOC2FILENAME[self.syntax] % self.invoice.number
 filename = filename.replace('/', '-')
 return {
-'fichierFlux': base64.b64encode(data),
+'fichierFlux': base64.b64encode(data).decode('ascii'),
 'nomFichier': filename,
 'syntaxeFlux': EDOC2SYNTAX[self.syntax],
 'avecSignature': False,



[tryton-commits] changeset in weblate:default Prepare release 6.2

2021-10-12 Thread Weblate
changeset ee68243374f0 in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset=ee68243374f0
description:
Prepare release 6.2
diffstat:

 templates/account.pot   |4 +
 templates/account_asset.pot |   52 +-
 templates/account_move_line_grouping.pot|  150 ++
 templates/account_payment.pot   |   77 +++
 templates/account_payment_braintree.pot |   25 +
 templates/account_payment_sepa.pot  |   51 +-
 templates/account_payment_stripe.pot|   39 +
 templates/account_product.pot   |4 +
 templates/account_rule.pot  |   79 +++
 templates/commission.pot|   10 +
 templates/currency_ro.pot   |7 +
 templates/currency_rs.pot   |   23 +
 templates/customs.pot   |8 +
 templates/ir.pot|   24 +
 templates/party.pot |6 +
 templates/product_attribute.pot |8 +
 templates/product_image_attribute.pot   |4 +
 templates/product_measurements.pot  |   40 -
 templates/project.pot   |   12 +-
 templates/purchase.pot  |3 +-
 templates/purchase_secondary_unit.pot   |   12 +
 templates/sale.pot  |   44 +
 templates/sale_gift_card.pot|   72 +++
 templates/sale_point.pot|  660 
 templates/sale_secondary_unit.pot   |   12 +
 templates/sale_shipment_cost.pot|   26 +
 templates/sale_subscription.pot |   44 +
 templates/sao.pot   |2 +-
 templates/stock.pot |   61 ++-
 templates/stock_package.pot |   12 -
 templates/stock_package_shipping.pot|   16 +
 templates/stock_package_shipping_mygls.pot  |  225 +
 templates/stock_quantity_early_planning.pot |4 +
 templates/stock_quantity_issue.pot  |4 +
 templates/web_shop.pot  |   12 +
 templates/web_shop_shopify.pot  |  282 +++
 36 files changed, 2009 insertions(+), 105 deletions(-)

diffs (2939 lines):

diff -r cd63f691492a -r ee68243374f0 templates/account.pot
--- a/templates/account.pot Tue Oct 12 10:25:47 2021 +0200
+++ b/templates/account.pot Tue Oct 12 13:18:39 2021 +0200
@@ -3630,6 +3630,10 @@
 msgid "Account Administration"
 msgstr ""
 
+msgctxt "model:res.group,name:group_account_party"
+msgid "Accounting Party"
+msgstr ""
+
 msgctxt "report:account.account.type.statement:"
 msgid "/"
 msgstr ""
diff -r cd63f691492a -r ee68243374f0 templates/account_asset.pot
--- a/templates/account_asset.pot   Tue Oct 12 10:25:47 2021 +0200
+++ b/templates/account_asset.pot   Tue Oct 12 13:18:39 2021 +0200
@@ -78,6 +78,10 @@
 msgid "Residual Value"
 msgstr ""
 
+msgctxt "field:account.asset,revisions:"
+msgid "Revisions"
+msgstr ""
+
 msgctxt "field:account.asset,start_date:"
 msgid "Start Date"
 msgstr ""
@@ -158,6 +162,34 @@
 msgid "Start Date"
 msgstr ""
 
+msgctxt "field:account.asset.revision,asset:"
+msgid "Asset"
+msgstr ""
+
+msgctxt "field:account.asset.revision,currency:"
+msgid "Currency"
+msgstr ""
+
+msgctxt "field:account.asset.revision,description:"
+msgid "Description"
+msgstr ""
+
+msgctxt "field:account.asset.revision,end_date:"
+msgid "End Date"
+msgstr ""
+
+msgctxt "field:account.asset.revision,origin:"
+msgid "Origin"
+msgstr ""
+
+msgctxt "field:account.asset.revision,residual_value:"
+msgid "Residual Value"
+msgstr ""
+
+msgctxt "field:account.asset.revision,value:"
+msgid "Asset Value"
+msgstr ""
+
 msgctxt "field:account.asset.update.show_depreciation,amount:"
 msgid "Amount"
 msgstr ""
@@ -182,18 +214,6 @@
 msgid "Next Depreciation Date"
 msgstr ""
 
-msgctxt "field:account.asset.update.start,end_date:"
-msgid "End Date"
-msgstr ""
-
-msgctxt "field:account.asset.update.start,residual_value:"
-msgid "Residual Value"
-msgstr ""
-
-msgctxt "field:account.asset.update.start,value:"
-msgid "Asset Value"
-msgstr ""
-
 msgctxt "field:account.configuration,asset_bymonth:"
 msgid "Month"
 msgstr ""
@@ -348,14 +368,14 @@
 msgid "Asset Depreciation Table Start"
 msgstr ""
 
+msgctxt "model:account.asset.revision,name:"
+msgid "Asset Revision"
+msgstr ""
+
 msgctxt "model:account.asset.update.show_depreciation,name:"
 msgid "Update Asset Show Depreciation"
 msgstr ""
 
-msgctxt "model:account.asset.update.start,name:"
-msgid "Update Asset Start"
-msgstr ""
-
 msgctxt "model:account.configuration.asset_date,name:"
 msgid "Account Configuration Asset Date"
 msgstr ""
diff -r cd63f691492a -r ee68243374f0 templates/account_move_line_grouping.pot
--- a/templates/account_move_line_grouping.pot  Tue Oct 12 10:25:47 2021 +0200
+++ b/templates/account_move_line_grouping.pot  Tue Oct 12 13:18:39 2021 +0200
@@ -0,0 +1,150 @@
+#
+msgid ""
+msgstr "Content-Type: text/plain; charset=utf-8\n"
+

[tryton-commits] changeset in modules/account:default Computes GeneralLedger time...

2021-10-12 Thread Nicolas Évrard
changeset 9f6bf9d17129 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset=9f6bf9d17129
description:
Computes GeneralLedger timespan on either dates or period (scenario 
patch)

issue10249
review351991002
diffstat:

 tests/scenario_reports.rst |  77 +++--
 1 files changed, 66 insertions(+), 11 deletions(-)

diffs (132 lines):

diff -r 1b3d9d7a758f -r 9f6bf9d17129 tests/scenario_reports.rst
--- a/tests/scenario_reports.rstTue Oct 12 11:29:34 2021 +0200
+++ b/tests/scenario_reports.rstTue Oct 12 11:32:48 2021 +0200
@@ -28,7 +28,8 @@
 
 >>> fiscalyear = create_fiscalyear(company)
 >>> fiscalyear.click('create_period')
->>> period = fiscalyear.periods[0]
+>>> periods = fiscalyear.periods
+>>> period_1, period_3, period_5 = periods[0], periods[2], periods[4]
 
 Create chart of accounts::
 
@@ -56,9 +57,9 @@
 ... ('code', '=', 'CASH'),
 ... ])
 >>> move = Move()
->>> move.period = period
+>>> move.period = period_3
 >>> move.journal = journal_revenue
->>> move.date = period.start_date
+>>> move.date = period_3.start_date
 >>> line = move.lines.new()
 >>> line.account = revenue
 >>> line.credit = Decimal(10)
@@ -69,9 +70,9 @@
 >>> move.save()
 
 >>> move = Move()
->>> move.period = period
+>>> move.period = period_5
 >>> move.journal = journal_cash
->>> move.date = period.start_date
+>>> move.date = period_5.start_date
 >>> line = move.lines.new()
 >>> line.account = cash
 >>> line.debit = Decimal(10)
@@ -128,8 +129,8 @@
 >>> context = {
 ... 'company': company.id,
 ... 'fiscalyear': fiscalyear.id,
-... 'from_date': fiscalyear.periods[0].start_date,
-... 'to_date': fiscalyear.periods[1].end_date,
+... 'from_date': period_1.start_date,
+... 'to_date': period_3.end_date,
 ... }
 >>> with config.set_context(context):
 ... gl_revenue, = GeneralLedgerAccount.find([
@@ -150,16 +151,70 @@
 >>> glp_receivable.start_balance
 Decimal('0.00')
 >>> glp_receivable.credit
-Decimal('10.00')
+Decimal('0.00')
 >>> glp_receivable.debit
 Decimal('10.00')
 >>> glp_receivable.end_balance
+Decimal('10.00')
+
+>>> context = {
+... 'company': company.id,
+... 'fiscalyear': fiscalyear.id,
+... 'start_period': period_3.id,
+... }
+>>> with config.set_context(context):
+... gl_revenue, = GeneralLedgerAccount.find([
+...   ('account', '=', revenue.id),
+...   ])
+>>> gl_revenue.start_balance
 Decimal('0.00')
+>>> gl_revenue.credit
+Decimal('10.00')
+>>> gl_revenue.debit
+Decimal('0.00')
+>>> gl_revenue.end_balance
+Decimal('-10.00')
 
 >>> context = {
 ... 'company': company.id,
 ... 'fiscalyear': fiscalyear.id,
-... 'start_period': fiscalyear.periods[1].id,
+... 'start_period': period_5.id,
+... }
+>>> with config.set_context(context):
+... gl_revenue, = GeneralLedgerAccount.find([
+...   ('account', '=', revenue.id),
+...   ])
+>>> gl_revenue.start_balance
+Decimal('-10.00')
+>>> gl_revenue.credit
+Decimal('0.00')
+>>> gl_revenue.debit
+Decimal('0.00')
+>>> gl_revenue.end_balance
+Decimal('-10.00')
+
+>>> context = {
+... 'company': company.id,
+... 'fiscalyear': fiscalyear.id,
+... 'from_date': period_3.start_date,
+... }
+>>> with config.set_context(context):
+... gl_revenue, = GeneralLedgerAccount.find([
+...   ('account', '=', revenue.id),
+...   ])
+>>> gl_revenue.start_balance
+Decimal('0.00')
+>>> gl_revenue.credit
+Decimal('10.00')
+>>> gl_revenue.debit
+Decimal('0.00')
+>>> gl_revenue.end_balance
+Decimal('-10.00')
+
+>>> context = {
+... 'company': company.id,
+... 'fiscalyear': fiscalyear.id,
+... 'from_date': period_5.start_date,
 ... }
 >>> with config.set_context(context):
 ... gl_revenue, = GeneralLedgerAccount.find([
@@ -204,8 +259,8 @@
 >>> _ = general_journal.execute(Move.find([]))
 
 >>> with config.set_context(
-... start_date=period.start_date,
-... end_date=period.end_date):
+... start_date=period_5.start_date,
+... end_date=period_5.end_date):
 ... journal_cash = Journal(journal_cash.id)
 >>> journal_cash.credit
 Decimal('0.00')



[tryton-commits] changeset in modules/account:default Computes GeneralLedger time...

2021-10-12 Thread Nicolas Évrard
changeset 1b3d9d7a758f in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset=1b3d9d7a758f
description:
Computes GeneralLedger timespan on either dates or period

issue10249
review351991002
diffstat:

 account.py |  49 ++---
 1 files changed, 42 insertions(+), 7 deletions(-)

diffs (97 lines):

diff -r 9f4fabb78e30 -r 1b3d9d7a758f account.py
--- a/account.pyMon Oct 11 23:21:55 2021 +0200
+++ b/account.pyTue Oct 12 11:29:34 2021 +0200
@@ -1059,7 +1059,7 @@
 values[name][account.id] += getattr(deferral, name)
 else:
 with Transaction().set_context(fiscalyear=fiscalyear.id,
-date=None, periods=None):
+date=None, periods=None, from_date=None, to_date=None):
 previous_result = func(accounts, names)
 for name in names:
 vals = values[name]
@@ -1680,8 +1680,16 @@
 def get_account(cls, records, name):
 Account = cls._get_account()
 
-period_ids = cls.get_period_ids(name)
-from_date, to_date = cls.get_dates(name)
+period_ids, from_date, to_date = None, None, None
+context_keys = Transaction().context.keys()
+if context_keys & {'start_period', 'end_period'}:
+period_ids = cls.get_period_ids(name)
+elif context_keys & {'from_date', 'end_date'}:
+from_date, to_date = cls.get_dates(name)
+else:
+if name.startswith('start_'):
+period_ids = []
+
 with Transaction().set_context(
 periods=period_ids,
 from_date=from_date, to_date=to_date):
@@ -1797,27 +1805,42 @@
 domain=[
 ('fiscalyear', '=', Eval('fiscalyear')),
 ('start_date', '<=', (Eval('end_period'), 'start_date')),
-], depends=['fiscalyear', 'end_period'])
+],
+states={
+'invisible': Eval('from_date', False) | Eval('to_date', False),
+},
+depends=['fiscalyear', 'end_period', 'from_date', 'to_date'])
 end_period = fields.Many2One('account.period', 'End Period',
 domain=[
 ('fiscalyear', '=', Eval('fiscalyear')),
 ('start_date', '>=', (Eval('start_period'), 'start_date'))
 ],
-depends=['fiscalyear', 'start_period'])
+states={
+'invisible': Eval('from_date', False) | Eval('to_date', False),
+},
+depends=['fiscalyear', 'start_period', 'from_date', 'to_date'])
 from_date = fields.Date("From Date",
 domain=[
 If(Eval('to_date') & Eval('from_date'),
 ('from_date', '<=', Eval('to_date')),
 ()),
 ],
-depends=['to_date'])
+states={
+'invisible': (Eval('start_period', 'False')
+| Eval('end_period', False)),
+},
+depends=['to_date', 'start_period', 'end_period'])
 to_date = fields.Date("To Date",
 domain=[
 If(Eval('from_date') & Eval('to_date'),
 ('to_date', '>=', Eval('from_date')),
 ()),
 ],
-depends=['from_date'])
+states={
+'invisible': (Eval('start_period', 'False')
+| Eval('end_period', False)),
+},
+depends=['from_date', 'start_period', 'end_period'])
 company = fields.Many2One('company.company', 'Company', required=True)
 posted = fields.Boolean('Posted Move', help="Only include posted moves.")
 journal = fields.Many2One(
@@ -1874,6 +1897,18 @@
 and self.end_period.fiscalyear != self.fiscalyear):
 self.end_period = None
 
+def on_change_start_period(self):
+self.from_date = self.to_date = None
+
+def on_change_end_period(self):
+self.from_date = self.to_date = None
+
+def on_change_from_date(self):
+self.start_period = self.end_period = None
+
+def on_change_to_date(self):
+self.start_period = self.end_period = None
+
 
 class GeneralLedgerAccountParty(_GeneralLedgerAccount):
 "General Ledger Account Party"



[tryton-commits] changeset in modules/web_shop_shopify:default Correctly define t...

2021-10-12 Thread Cédric Krier
changeset c58de41014f9 in modules/web_shop_shopify:default
details: 
https://hg.tryton.org/modules/web_shop_shopify?cmd=changeset=c58de41014f9
description:
Correctly define the test dependency to trytond_sale_shipment_cost
diffstat:

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

diffs (12 lines):

diff -r 19fb3fbe1865 -r c58de41014f9 setup.py
--- a/setup.py  Tue Oct 12 10:15:55 2021 +0200
+++ b/setup.py  Tue Oct 12 11:18:05 2021 +0200
@@ -73,7 +73,7 @@
 get_require_version('trytond_product_measurements'),
 get_require_version('trytond_product_image'),
 get_require_version('trytond_sale_discount'),
-get_require_version('trytond_shipment_cost'),
+get_require_version('trytond_sale_shipment_cost'),
 get_require_version('trytond_sale_secondary_unit'),
 ]
 dependency_links = []



[tryton-commits] changeset in modules/customs:default Support empty list price on...

2021-10-12 Thread Cédric Krier
changeset 277353eb1142 in modules/customs:default
details: https://hg.tryton.org/modules/customs?cmd=changeset=277353eb1142
description:
Support empty list price on product

issue10244
diffstat:

 tests/test_customs.py |  1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diffs (11 lines):

diff -r 117f556e4c23 -r 277353eb1142 tests/test_customs.py
--- a/tests/test_customs.py Tue Oct 12 10:08:42 2021 +0200
+++ b/tests/test_customs.py Tue Oct 12 10:31:17 2021 +0200
@@ -194,7 +194,6 @@
 
 template = Template(name='Test',
 default_uom=unit,
-list_price=Decimal(0),
 tariff_codes=[
 Product_TariffCode(tariff_code=tariff),
 ])



[tryton-commits] changeset in modules/sale:default Only require shipment_address ...

2021-10-12 Thread Adrià Tarroja Caubet
changeset c25eeed6f1b3 in modules/sale:default
details: https://hg.tryton.org/modules/sale?cmd=changeset=c25eeed6f1b3
description:
Only require shipment_address for not services products

issue10692
review360021002
diffstat:

 sale.py |  13 ++---
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (31 lines):

diff -r dd06c21bc0a6 -r c25eeed6f1b3 sale.py
--- a/sale.py   Mon Oct 11 22:40:54 2021 +0200
+++ b/sale.py   Tue Oct 12 10:28:17 2021 +0200
@@ -158,8 +158,6 @@
 ],
 states={
 'readonly': Eval('state') != 'draft',
-'required': ~Eval('state').in_(
-['draft', 'quotation', 'cancelled']),
 },
 depends=['party', 'shipment_party', 'state'])
 warehouse = fields.Many2One('stock.location', 'Warehouse',
@@ -720,12 +718,13 @@
 raise SaleQuotationError(
 gettext('sale.msg_sale_invoice_address_required_for_quotation',
 sale=self.rec_name))
-if not self.shipment_address:
-raise SaleQuotationError(
-gettext('sale'
-'.msg_sale_shipment_address_required_for_quotation',
-sale=self.rec_name))
 for line in self.lines:
+if (line.product and line.product.type != 'service'
+and not self.shipment_address):
+raise SaleQuotationError(
+gettext('sale'
+'.msg_sale_shipment_address_required_for_quotation',
+sale=self.rec_name))
 if (line.quantity or 0) >= 0:
 location = line.from_location
 else:



[tryton-commits] changeset in weblate:default Add web_shop_shopify module

2021-10-12 Thread Cédric Krier
changeset cd63f691492a in weblate:default
details: https://hg.tryton.org/weblate?cmd=changeset=cd63f691492a
description:
Add web_shop_shopify module

issue10611



[tryton-commits] changeset in readthedocs:default Add web_shop_shopify module

2021-10-12 Thread Cédric Krier
changeset e6610fbd50e6 in readthedocs:default
details: https://hg.tryton.org/readthedocs?cmd=changeset=e6610fbd50e6
description:
Add web_shop_shopify module

issue10611
review362271002
diffstat:

 web.rst |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r 7be2c083dbeb -r e6610fbd50e6 web.rst
--- a/web.rst   Mon Oct 11 23:55:41 2021 +0200
+++ b/web.rst   Tue Oct 12 10:15:55 2021 +0200
@@ -8,6 +8,9 @@
 `Shop `_
 Fundamentals to sale online.
 
+`Shop Shopify `_
+Integration with Shopify.
+
 `Shop Vue Storefront `_
 Integration with Vue Storefront.
 



[tryton-commits] changeset in modules/web_shop:default Add web_shop_shopify module

2021-10-12 Thread Cédric Krier
changeset 8c5cd7b9406c in modules/web_shop:default
details: https://hg.tryton.org/modules/web_shop?cmd=changeset=8c5cd7b9406c
description:
Add web_shop_shopify module

issue10611
review362271002
diffstat:

 __init__.py|   1 +
 product.py |  11 +++
 product.xml|   6 ++
 view/product_template_form.xml |  11 +++
 4 files changed, 29 insertions(+), 0 deletions(-)

diffs (67 lines):

diff -r 32c42e2dc2fe -r 8c5cd7b9406c __init__.py
--- a/__init__.py   Mon Sep 13 23:29:57 2021 +0200
+++ b/__init__.py   Tue Oct 12 10:15:55 2021 +0200
@@ -17,6 +17,7 @@
 web.Shop_Product,
 web.Shop_ProductCategory,
 web.User,
+product.Template,
 product.Product,
 product.Category,
 sale.Sale,
diff -r 32c42e2dc2fe -r 8c5cd7b9406c product.py
--- a/product.pyMon Sep 13 23:29:57 2021 +0200
+++ b/product.pyTue Oct 12 10:15:55 2021 +0200
@@ -1,10 +1,21 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 
+from trytond.config import config
 from trytond.model import fields
 from trytond.pool import PoolMeta
 from trytond.pyson import Eval
 
+if not config.get('html', 'plugins-product.template-web_shop_description'):
+config.set(
+'html', 'plugins-product.template-web_shop_description', 'fullpage')
+
+
+class Template(metaclass=PoolMeta):
+__name__ = 'product.template'
+
+web_shop_description = fields.Text("Web Shop Description", translate=True)
+
 
 class Product(metaclass=PoolMeta):
 __name__ = 'product.product'
diff -r 32c42e2dc2fe -r 8c5cd7b9406c product.xml
--- a/product.xml   Mon Sep 13 23:29:57 2021 +0200
+++ b/product.xml   Tue Oct 12 10:15:55 2021 +0200
@@ -3,6 +3,12 @@
 this repository contains the full copyright notices and license terms. -->
 
 
+
+product.template
+
+product_template_form
+
+
 
 product.product
 
diff -r 32c42e2dc2fe -r 8c5cd7b9406c view/product_template_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/view/product_template_form.xmlTue Oct 12 10:15:55 2021 +0200
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+



[tryton-commits] changeset in modules/sale_secondary_unit:default Add web_shop_sh...

2021-10-12 Thread Cédric Krier
changeset 1391b87ce0d9 in modules/sale_secondary_unit:default
details: 
https://hg.tryton.org/modules/sale_secondary_unit?cmd=changeset=1391b87ce0d9
description:
Add web_shop_shopify module

issue10611
review362271002
diffstat:

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

diffs (31 lines):

diff -r 3f914dbe4a68 -r 1391b87ce0d9 product.py
--- a/product.pyMon Aug 30 00:27:13 2021 +0200
+++ b/product.pyTue Oct 12 10:15:55 2021 +0200
@@ -36,6 +36,10 @@
 depends=['sale_secondary_uom'],
 help="The coefficient for the formula:\n"
 "coefficient (sale unit) = 1 (secondary unit)")
+sale_secondary_uom_category = fields.Function(
+fields.Many2One('product.uom.category', "Sale Secondary UOM Category"),
+'on_change_with_sale_secondary_uom_category',
+searcher='search_sale_secondary_uom_category')
 
 @fields.depends('sale_secondary_uom_factor')
 def on_change_sale_secondary_uom_factor(self):
@@ -53,6 +57,16 @@
 self.sale_secondary_uom_factor = round(
 1. / self.sale_secondary_uom_rate, uom_conversion_digits[1])
 
+@fields.depends('sale_secondary_uom')
+def on_change_with_sale_secondary_uom_category(self, name=None):
+if self.sale_secondary_uom:
+return self.sale_secondary_uom.category.id
+
+@classmethod
+def search_sale_secondary_uom_category(cls, name, clause):
+return [('sale_secondary_uom.category' + clause[0].lstrip(name),)
++ tuple(clause[1:])]
+
 @property
 def sale_secondary_uom_normal_rate(self):
 uom = self.sale_secondary_uom



[tryton-commits] changeset in modules/purchase_secondary_unit:default Add web_sho...

2021-10-12 Thread Cédric Krier
changeset 12e1f54aa7fd in modules/purchase_secondary_unit:default
details: 
https://hg.tryton.org/modules/purchase_secondary_unit?cmd=changeset=12e1f54aa7fd
description:
Add web_shop_shopify module

issue10611
review362271002
diffstat:

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

diffs (32 lines):

diff -r db172fa0ee4b -r 12e1f54aa7fd product.py
--- a/product.pyMon Aug 30 00:27:13 2021 +0200
+++ b/product.pyTue Oct 12 10:15:55 2021 +0200
@@ -36,6 +36,11 @@
 depends=['purchase_secondary_uom'],
 help="The coefficient for the formula:\n"
 "coefficient (purchase unit) = 1 (secondary unit)")
+purchase_secondary_uom_category = fields.Function(
+fields.Many2One(
+'product.uom.category', "Purchase Secondary UOM Category"),
+'on_change_with_purchase_secondary_uom_category',
+searcher='search_purchase_secondary_uom_category')
 
 @fields.depends('purchase_secondary_uom_factor')
 def on_change_purchase_secondary_uom_factor(self):
@@ -55,6 +60,16 @@
 1. / self.purchase_secondary_uom_rate,
 uom_conversion_digits[1])
 
+@fields.depends('purchase_secondary_uom')
+def on_change_with_purchase_secondary_uom_category(self, name=None):
+if self.purchase_secondary_uom:
+return self.purchase_secondary_uom.category.id
+
+@classmethod
+def search_purchase_secondary_uom_category(cls, name, clause):
+return [('purchase_secondary_uom.category' + clause[0].lstrip(name),)
++ tuple(clause[1:])]
+
 @property
 def purchase_secondary_uom_normal_rate(self):
 uom = self.purchase_secondary_uom



[tryton-commits] changeset in modules/product_image_attribute:default Compute att...

2021-10-12 Thread Cédric Krier
changeset d50bbca84559 in modules/product_image_attribute:default
details: 
https://hg.tryton.org/modules/product_image_attribute?cmd=changeset=d50bbca84559
description:
Compute attributes name for variant

issue10844
review362271002
diffstat:

 product.py  |  25 +
 product.xml |   6 ++
 view/image_list.xml |   8 
 3 files changed, 39 insertions(+), 0 deletions(-)

diffs (73 lines):

diff -r 698a2372a798 -r d50bbca84559 product.py
--- a/product.pyThu Sep 30 23:04:46 2021 +0200
+++ b/product.pyTue Oct 12 10:09:51 2021 +0200
@@ -1,5 +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.
+from trytond.i18n import gettext
 from trytond.model import fields
 from trytond.pool import PoolMeta
 from trytond.pyson import Eval
@@ -34,6 +35,13 @@
 'invisible': ~Eval('attribute_set') | Eval('product'),
 },
 depends=['attribute_set', 'product'])
+attributes_name = fields.Function(fields.Char(
+"Attributes Name",
+states={
+'invisible': ~Eval('attribute_set'),
+},
+depends=['attribute_set']),
+'on_change_with_attributes_name')
 
 attribute_set = fields.Function(
 fields.Many2One('product.attribute.set', "Attribute Set"),
@@ -43,3 +51,20 @@
 def on_change_with_attribute_set(self, name=None):
 if self.template and self.template.attribute_set:
 return self.template.attribute_set.id
+
+@fields.depends('attribute_set', 'attributes')
+def on_change_with_attributes_name(self, name=None):
+if not self.attribute_set or not self.attributes:
+return
+
+def key(attribute):
+return getattr(attribute, 'sequence', attribute.name)
+
+values = []
+for attribute in sorted(self.attribute_set.attributes, key=key):
+if attribute.name in self.attributes:
+value = self.attributes[attribute.name]
+values.append(gettext('product_attribute.msg_label_value',
+label=attribute.string,
+value=attribute.format(value)))
+return " | ".join(filter(None, values))
diff -r 698a2372a798 -r d50bbca84559 product.xml
--- a/product.xml   Thu Sep 30 23:04:46 2021 +0200
+++ b/product.xml   Tue Oct 12 10:09:51 2021 +0200
@@ -3,6 +3,12 @@
 this repository contains the full copyright notices and license terms. -->
 
 
+
+product.image
+
+image_list
+
+
 
 product.image
 
diff -r 698a2372a798 -r d50bbca84559 view/image_list.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/view/image_list.xml   Tue Oct 12 10:09:51 2021 +0200
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+



[tryton-commits] changeset in modules/party:default Support replacing party on re...

2021-10-12 Thread Cédric Krier
changeset 97b575fc91e5 in modules/party:default
details: https://hg.tryton.org/modules/party?cmd=changeset=97b575fc91e5
description:
Support replacing party on reference field

issue10611
review362271002
diffstat:

 CHANGELOG |   1 +
 party.py  |  11 +--
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r e75508d267ca -r 97b575fc91e5 CHANGELOG
--- a/CHANGELOG Sun Oct 10 22:18:57 2021 +0200
+++ b/CHANGELOG Tue Oct 12 10:07:14 2021 +0200
@@ -1,3 +1,4 @@
+* Support replacing party on reference field
 * Allow setting a single contact mechanism at party creation
 * Make identifiers deactivatable
 * Replace party on identifier when replacing parties
diff -r e75508d267ca -r 97b575fc91e5 party.py
--- a/party.py  Sun Oct 10 22:18:57 2021 +0200
+++ b/party.py  Tue Oct 12 10:07:14 2021 +0200
@@ -823,9 +823,16 @@
 cursor = transaction.connection.cursor()
 for model_name, field_name in self.fields_to_replace():
 Model = pool.get(model_name)
+field = getattr(Model, field_name)
 table = Model.__table__()
 column = Column(table, field_name)
-where = column == source.id
+if field._type == 'reference':
+source_value = str(source)
+destination_value = str(destination)
+else:
+source_value = source.id
+destination_value = destination.id
+where = column == source_value
 
 if transaction.database.has_returning():
 returning = [table.id]
@@ -836,7 +843,7 @@
 
 cursor.execute(*table.update(
 [column],
-[destination.id],
+[destination_value],
 where=where,
 returning=returning))
 



[tryton-commits] changeset in modules/customs:default Add country of origin

2021-10-12 Thread Cédric Krier
changeset 117f556e4c23 in modules/customs:default
details: https://hg.tryton.org/modules/customs?cmd=changeset=117f556e4c23
description:
Add country of origin

issue10669
review362271002
diffstat:

 CHANGELOG  |   2 ++
 product.py |  36 ++--
 view/template_form.xml |   4 +++-
 3 files changed, 35 insertions(+), 7 deletions(-)

diffs (95 lines):

diff -r d2f6c841e74e -r 117f556e4c23 CHANGELOG
--- a/CHANGELOG Sun Jul 04 17:54:47 2021 +0200
+++ b/CHANGELOG Tue Oct 12 10:08:42 2021 +0200
@@ -1,3 +1,5 @@
+* Add country of origin
+
 Version 6.0.0 - 2021-05-03
 * Bug fixes (see mercurial logs for details)
 
diff -r d2f6c841e74e -r 117f556e4c23 product.py
--- a/product.pySun Jul 04 17:54:47 2021 +0200
+++ b/product.pyTue Oct 12 10:08:42 2021 +0200
@@ -55,13 +55,19 @@
 return self.parent.customs
 return self.customs
 
-def get_tariff_code(self, pattern):
+def get_tariff_codes(self, pattern):
 if not self.tariff_codes_parent:
 for link in self.tariff_codes:
 if link.tariff_code.match(pattern):
-return link.tariff_code
+yield link.tariff_code
 else:
-return self.parent.get_tariff_code(pattern)
+yield from self.parent.get_tariff_codes(pattern)
+
+def get_tariff_code(self, pattern):
+try:
+return next(self.get_tariff_codes(pattern))
+except StopIteration:
+pass
 
 @classmethod
 def view_attributes(cls):
@@ -105,6 +111,12 @@
 | Eval('tariff_codes_category', False)),
 },
 depends=['type', 'tariff_codes_category'])
+country_of_origin = fields.Many2One(
+'country.country', "Country",
+states={
+'invisible': Eval('type') == 'service',
+},
+depends=['type'])
 
 @classmethod
 def __register__(cls, module_name):
@@ -131,13 +143,19 @@
 def default_tariff_codes_category(cls):
 return False
 
-def get_tariff_code(self, pattern):
+def get_tariff_codes(self, pattern):
 if not self.tariff_codes_category:
 for link in self.tariff_codes:
 if link.tariff_code.match(pattern):
-return link.tariff_code
+yield link.tariff_code
 else:
-return self.customs_category.get_tariff_code(pattern)
+yield from self.customs_category.get_tariff_codes(pattern)
+
+def get_tariff_code(self, pattern):
+try:
+return next(self.get_tariff_codes(pattern))
+except StopIteration:
+pass
 
 @classmethod
 def view_attributes(cls):
@@ -182,3 +200,9 @@
 
 class Product(metaclass=PoolMeta):
 __name__ = 'product.product'
+
+def get_tariff_codes(self, pattern):
+yield from self.template.get_tariff_codes(pattern)
+
+def get_tariff_code(self, pattern):
+return self.template.get_tariff_code(pattern)
diff -r d2f6c841e74e -r 117f556e4c23 view/template_form.xml
--- a/view/template_form.xmlSun Jul 04 17:54:47 2021 +0200
+++ b/view/template_form.xmlTue Oct 12 10:08:42 2021 +0200
@@ -6,7 +6,9 @@
 
 
 
-
+
+
+
 
 
 

[tryton-commits] changeset in modules/sale_gift_card:default Prefix test dependen...

2021-10-12 Thread Cédric Krier
changeset 975db7a08f49 in modules/sale_gift_card:default
details: 
https://hg.tryton.org/modules/sale_gift_card?cmd=changeset=975db7a08f49
description:
Prefix test dependency by 'trytond_'
diffstat:

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

diffs (12 lines):

diff -r 749f84d19088 -r 975db7a08f49 setup.py
--- a/setup.py  Tue Oct 12 09:33:39 2021 +0200
+++ b/setup.py  Tue Oct 12 09:43:32 2021 +0200
@@ -68,7 +68,7 @@
 
 tests_require = [
 get_require_version('proteus'),
-get_require_version('sale_point'),
+get_require_version('trytond_sale_point'),
 ]
 dependency_links = []
 if minor_version % 2:



[tryton-commits] changeset in modules/sale_gift_card:default Add missing sale_poi...

2021-10-12 Thread Cédric Krier
changeset 749f84d19088 in modules/sale_gift_card:default
details: 
https://hg.tryton.org/modules/sale_gift_card?cmd=changeset=749f84d19088
description:
Add missing sale_point as test requirements
diffstat:

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

diffs (15 lines):

diff -r db7d7f741246 -r 749f84d19088 setup.py
--- a/setup.py  Mon Oct 11 23:55:17 2021 +0200
+++ b/setup.py  Tue Oct 12 09:33:39 2021 +0200
@@ -66,7 +66,10 @@
 requires.append(get_require_version('trytond_%s' % dep))
 requires.append(get_require_version('trytond'))
 
-tests_require = [get_require_version('proteus')]
+tests_require = [
+get_require_version('proteus'),
+get_require_version('sale_point'),
+]
 dependency_links = []
 if minor_version % 2:
 dependency_links.append(



[tryton-commits] changeset in modules/stock_package_shipping_mygls:default Pass M...

2021-10-12 Thread Cédric Krier
changeset 397df23b1c99 in modules/stock_package_shipping_mygls:default
details: 
https://hg.tryton.org/modules/stock_package_shipping_mygls?cmd=changeset=397df23b1c99
description:
Pass MYGLS environment to tox
diffstat:

 .drone.yml |  2 +-
 tox.ini|  1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r fd752bb0c9b9 -r 397df23b1c99 .drone.yml
--- a/.drone.ymlMon Oct 11 22:29:09 2021 +0200
+++ b/.drone.ymlTue Oct 12 09:22:14 2021 +0200
@@ -12,7 +12,7 @@
 environment:
 - CFLAGS=-O0
 - DB_CACHE=/cache
-- TOX_TESTENV_PASSENV=CFLAGS DB_CACHE CI_BUILD_NUMBER 
CI_JOB_NUMBER CI_JOB_ID
+- TOX_TESTENV_PASSENV=CFLAGS DB_CACHE CI_BUILD_NUMBER 
CI_JOB_NUMBER CI_JOB_ID MYGLS_USERNAME MYGLS_PASSWORD MYGLS_CLIENT_NUMBER
 - POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
 commands:
 - echo "[extensions]" >> /root/.hgrc
diff -r fd752bb0c9b9 -r 397df23b1c99 tox.ini
--- a/tox.ini   Mon Oct 11 22:29:09 2021 +0200
+++ b/tox.ini   Tue Oct 12 09:22:14 2021 +0200
@@ -12,4 +12,5 @@
 postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
 sqlite: DB_NAME={env:SQLITE_NAME::memory:}
 postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
+passenv = MYGLS_USERNAME MYGLS_PASSWORD MYGLS_CLIENT_NUMBER
 install_command = pip install --pre --find-links 
https://trydevpi.tryton.org/?local_version={env:CI_JOB_ID:{env:CI_BUILD_NUMBER:}.{env:CI_JOB_NUMBER:}}
 {opts} {packages}