[tryton-commits] changeset in modules/project_plan:default Send only the required...

2022-04-08 Thread Nicolas Évrard
changeset 42142a69aed7 in modules/project_plan:default
details: 
https://hg.tryton.org/modules/project_plan?cmd=changeset=42142a69aed7
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 work.py |  12 +---
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r cabc709f8c93 -r 42142a69aed7 work.py
--- a/work.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/work.py   Fri Apr 08 19:07:13 2022 +0200
@@ -22,21 +22,19 @@
 domain=[
 ('parent', '=', Eval('parent', -1)),
 ('id', '!=', Eval('id', -1)),
-],
-depends=['parent', 'id'])
+])
 successors = fields.Many2Many('project.predecessor_successor',
 'predecessor', 'successor', 'Successors',
 domain=[
 ('parent', '=', Eval('parent', -1)),
 ('id', '!=', Eval('id', -1)),
-],
-depends=['parent', 'id'])
+])
 leveling_delay = fields.Float("Leveling Delay", required=True)
 back_leveling_delay = fields.Float("Back Leveling Delay", required=True)
 allocations = fields.One2Many('project.allocation', 'work', 'Allocations',
 states={
 'invisible': Eval('type') != 'task',
-}, depends=['type'])
+})
 duration = fields.Function(
 fields.TimeDelta('Duration', 'company_work_time'),
 'get_function_fields')
@@ -61,10 +59,10 @@
 actual_finish_date = fields.Function(fields.Date('Actual Finish'),
 'get_function_fields', setter='set_function_fields')
 constraint_start_date = fields.Function(fields.Date('Constraint Start',
-depends=['type']), 'get_function_fields',
+depends={'type'}), 'get_function_fields',
 setter='set_function_fields')
 constraint_finish_date = fields.Function(fields.Date('Constraint Finish',
-depends=['type']), 'get_function_fields',
+depends={'type'}), 'get_function_fields',
 setter='set_function_fields')
 
 @classmethod



[tryton-commits] changeset in modules/project_invoice:default Send only the requi...

2022-04-08 Thread Nicolas Évrard
changeset ecea971a91c9 in modules/project_invoice:default
details: 
https://hg.tryton.org/modules/project_invoice?cmd=changeset=ecea971a91c9
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (12 lines):

diff -r 8e9563231cde -r ecea971a91c9 project.py
--- a/project.pyWed Apr 06 23:37:43 2022 +0200
+++ b/project.pyFri Apr 08 19:07:13 2022 +0200
@@ -232,7 +232,7 @@
 ()),
 ]
 if 'invoice_method' not in cls.product.depends:
-cls.product.depends.append('invoice_method')
+cls.product.depends.add('invoice_method')
 
 @fields.depends('type', 'project_invoice_timesheet_up_to',
 'parent', '_parent_parent.invoice_timesheet_up_to')



[tryton-commits] changeset in modules/stock_lot_sled:default Send only the requir...

2022-04-08 Thread Nicolas Évrard
changeset 18f14b9083f0 in modules/stock_lot_sled:default
details: 
https://hg.tryton.org/modules/stock_lot_sled?cmd=changeset=18f14b9083f0
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 product.py |  2 --
 stock.py   |  6 ++
 2 files changed, 2 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 01d066cbc049 -r 18f14b9083f0 product.py
--- a/product.pyWed Apr 06 23:37:44 2022 +0200
+++ b/product.pyFri Apr 08 19:07:14 2022 +0200
@@ -16,7 +16,6 @@
 states={
 'invisible': Eval('shelf_life_state', 'none') == 'none',
 },
-depends=['shelf_life_state'],
 help='In number of days.')
 expiration_state = fields.Selection(
 DATE_STATE, 'Expiration State', sort=False)
@@ -24,7 +23,6 @@
 states={
 'invisible': Eval('expiration_state', 'none') == 'none',
 },
-depends=['expiration_state'],
 help='In number of days.')
 
 @staticmethod
diff -r 01d066cbc049 -r 18f14b9083f0 stock.py
--- a/stock.py  Wed Apr 06 23:37:44 2022 +0200
+++ b/stock.py  Fri Apr 08 19:07:14 2022 +0200
@@ -52,8 +52,7 @@
 'required': (
 Eval('shelf_life_expiration_state', 'none') == 'required'),
 'invisible': Eval('shelf_life_expiration_state', 'none') == 'none',
-},
-depends=['shelf_life_expiration_state'])
+})
 shelf_life_expiration_state = fields.Function(
 fields.Selection(DATE_STATE, 'Shelf Life Expiration State'),
 'on_change_with_shelf_life_expiration_state')
@@ -61,8 +60,7 @@
 states={
 'required': Eval('expiration_state', 'none') == 'required',
 'invisible': Eval('expiration_state', 'none') == 'none',
-},
-depends=['expiration_state'])
+})
 expiration_state = fields.Function(
 fields.Selection(DATE_STATE, 'Expiration State'),
 'on_change_with_expiration_state')



[tryton-commits] changeset in modules/stock_package_shipping_sendcloud:default Se...

2022-04-08 Thread Nicolas Évrard
changeset b77b97a3eef4 in modules/stock_package_shipping_sendcloud:default
details: 
https://hg.tryton.org/modules/stock_package_shipping_sendcloud?cmd=changeset=b77b97a3eef4
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 carrier.py |  9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (30 lines):

diff -r b6fcc1bf5be4 -r b77b97a3eef4 carrier.py
--- a/carrier.pyWed Apr 06 23:37:44 2022 +0200
+++ b/carrier.pyFri Apr 08 19:07:14 2022 +0200
@@ -60,14 +60,12 @@
 'carrier.sendcloud.address', 'sendcloud', "Addresses",
 states={
 'readonly': ~Eval('id') | (Eval('id', -1) < 0),
-},
-depends=['id'])
+})
 shipping_methods = fields.One2Many(
 'carrier.sendcloud.shipping_method', 'sendcloud', "Methods",
 states={
 'readonly': ~Eval('id') | (Eval('id', -1) < 0),
-},
-depends=['id'])
+})
 
 _addresses_sender_cache = Cache(
 'carrier.credential.sendcloud.addresses_sender',
@@ -252,8 +250,7 @@
 states={
 'invisible': Eval('shipping_service') != 'sendcloud',
 'required': Eval('shipping_service') == 'sendcloud',
-},
-depends=['shipping_service'])
+})
 
 @classmethod
 def __setup__(cls):



[tryton-commits] changeset in modules/stock_product_location:default Send only th...

2022-04-08 Thread Nicolas Évrard
changeset 0606a48d4b33 in modules/stock_product_location:default
details: 
https://hg.tryton.org/modules/stock_product_location?cmd=changeset=0606a48d4b33
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 location.py |  8 +++-
 product.py  |  6 ++
 2 files changed, 5 insertions(+), 9 deletions(-)

diffs (54 lines):

diff -r e35d2fda73f6 -r 0606a48d4b33 location.py
--- a/location.py   Wed Apr 06 23:37:44 2022 +0200
+++ b/location.py   Fri Apr 08 19:07:14 2022 +0200
@@ -19,16 +19,14 @@
 If(Bool(Eval('product')),
 ('products', '=', Eval('product')),
 ()),
-],
-depends=['product'])
+])
 product = fields.Many2One(
 'product.product', "Variant", ondelete='CASCADE', select=True,
 domain=[
 If(Bool(Eval('template')),
 ('template', '=', Eval('template')),
 ()),
-],
-depends=['template'])
+])
 warehouse = fields.Many2One('stock.location', 'Warehouse', required=True,
 domain=[('type', '=', 'warehouse')], ondelete='CASCADE')
 location = fields.Many2One('stock.location', 'Storage Location',
@@ -37,7 +35,7 @@
 ('type', '=', 'storage'),
 ('parent', 'child_of', If(Bool(Eval('warehouse')),
 [Eval('warehouse')], [])),
-], depends=['warehouse'])
+])
 
 @classmethod
 def __register__(cls, module_name):
diff -r e35d2fda73f6 -r 0606a48d4b33 product.py
--- a/product.pyWed Apr 06 23:37:44 2022 +0200
+++ b/product.pyFri Apr 08 19:07:14 2022 +0200
@@ -11,8 +11,7 @@
 "Default Locations",
 states={
 'invisible': ~Eval('type').in_(['goods', 'assets']),
-},
-depends=['type'])
+})
 
 @classmethod
 def copy(cls, templates, default=None):
@@ -48,8 +47,7 @@
 ],
 states={
 'invisible': ~Eval('type').in_(['goods', 'assets']),
-},
-depends=['type', 'template'])
+})
 
 @classmethod
 def copy(cls, products, default=None):



[tryton-commits] changeset in modules/stock_package_shipping_mygls:default Send o...

2022-04-08 Thread Nicolas Évrard
changeset dfb918f9ac8a in modules/stock_package_shipping_mygls:default
details: 
https://hg.tryton.org/modules/stock_package_shipping_mygls?cmd=changeset=dfb918f9ac8a
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 carrier.py |  10 +++---
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r 8a3e96d47a26 -r dfb918f9ac8a carrier.py
--- a/carrier.pyWed Apr 06 23:37:44 2022 +0200
+++ b/carrier.pyFri Apr 08 19:07:14 2022 +0200
@@ -44,8 +44,7 @@
 ], "Type of Printer", sort=False, translate=False,
 states={
 'invisible': Eval('shipping_service') != 'mygls',
-},
-depends=['shipping_service'])
+})
 mygls_print_position = fields.Integer(
 "Print Position",
 domain=[
@@ -58,8 +57,7 @@
 'invisible': (
 (Eval('mygls_type_of_printer') != 'A4_2x2')
 | (Eval('shipping_service') != 'mygls')),
-},
-depends=['mygls_type_of_printer', 'shipping_service'])
+})
 mygls_services = fields.MultiSelection([
 ('24h', "Service guaranteed delivery shipment in 24 Hours"),
 ('AOS', "Addressee Only Service"),
@@ -80,8 +78,7 @@
 ], "Services",
 states={
 'invisible': Eval('shipping_service') != 'mygls',
-},
-depends=['shipping_service'])
+})
 
 mygls_sms = fields.Char(
 "SMS", translate=True,
@@ -89,7 +86,6 @@
 'invisible': Eval('shipping_service') != 'mygls',
 'required': Eval('mygls_services', []).contains('SM1'),
 },
-depends=['shipping_service', 'mygls_services'],
 help="Variables that can be used in the text of the SMS:\n"
 "ParcelNr#, #COD#, #PickupDate#, #From_Name#, #ClientRef#")
 



[tryton-commits] changeset in modules/stock_package_shipping_ups:default Send onl...

2022-04-08 Thread Nicolas Évrard
changeset 4aa328383509 in modules/stock_package_shipping_ups:default
details: 
https://hg.tryton.org/modules/stock_package_shipping_ups?cmd=changeset=4aa328383509
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 carrier.py |  12 
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r efe30bca2b9c -r 4aa328383509 carrier.py
--- a/carrier.pyWed Apr 06 23:37:44 2022 +0200
+++ b/carrier.pyFri Apr 08 19:07:14 2022 +0200
@@ -63,8 +63,7 @@
 states={
 'required': Eval('shipping_service') == 'ups',
 'invisible': Eval('shipping_service') != 'ups',
-},
-depends=['shipping_service'])
+})
 ups_label_image_format = fields.Selection([
 (None, ''),
 ('EPL', 'EPL2'),
@@ -76,8 +75,7 @@
 states={
 'required': Eval('shipping_service') == 'ups',
 'invisible': Eval('shipping_service') != 'ups',
-},
-depends=['shipping_service'])
+})
 ups_label_height = fields.Selection([
 (None, ''),
 ('6', '6'),
@@ -88,8 +86,7 @@
 & (Eval('ups_label_image_format') != 'GIF')),
 'invisible': ((Eval('shipping_service') != 'ups')
 | (Eval('ups_label_image_format') == 'GIF')),
-},
-depends=['shipping_service', 'ups_label_image_format'])
+})
 ups_notifications = fields.MultiSelection([
 ('5', "Quantum View In-transit"),
 ('6', "Quantum View Shop"),
@@ -101,8 +98,7 @@
 ], "Notifications", sort=False,
 states={
 'invisible': Eval('shipping_service') != 'ups',
-},
-depends=['shipping_service'])
+})
 
 @classmethod
 def __setup__(cls):



[tryton-commits] changeset in modules/attendance:default Send only the required f...

2022-04-08 Thread Nicolas Évrard
changeset 44b648a7c4c2 in modules/attendance:default
details: 
https://hg.tryton.org/modules/attendance?cmd=changeset=44b648a7c4c2
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 attendance.py |  10 +++---
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (31 lines):

diff -r adaa15612142 -r 44b648a7c4c2 attendance.py
--- a/attendance.py Wed Apr 06 23:37:42 2022 +0200
+++ b/attendance.py Fri Apr 08 19:07:13 2022 +0200
@@ -48,8 +48,7 @@
 ('end_date', '=', None),
 ('end_date', '>=', Eval('date', None)),
 ],
-],
-depends=['company', 'date'])
+])
 at = fields.DateTime("At", required=True)
 date = fields.Date("Date", required=True)
 type = fields.Selection([
@@ -161,15 +160,12 @@
 _states = {
 'readonly': Eval('state') == 'closed',
 }
-_depends = ['state']
 
 _last_period_cache = Cache('attendance.period', context=False)
 
-ends_at = fields.DateTime("Ends at", required=True, states=_states,
-depends=_depends)
+ends_at = fields.DateTime("Ends at", required=True, states=_states)
 company = fields.Many2One('company.company', "Company", required=True,
-states=_states, depends=_depends,
-help="The company the period is associated with.")
+states=_states, help="The company the period is associated with.")
 state = fields.Selection([
 ('draft', 'Draft'),
 ('closed', 'Closed'),



[tryton-commits] changeset in modules/carrier_percentage:default Send only the re...

2022-04-08 Thread Nicolas Évrard
changeset 4b3bfead083b in modules/carrier_percentage:default
details: 
https://hg.tryton.org/modules/carrier_percentage?cmd=changeset=4b3bfead083b
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (11 lines):

diff -r 955d01b37bd4 -r 4b3bfead083b carrier.py
--- a/carrier.pyWed Apr 06 23:37:42 2022 +0200
+++ b/carrier.pyFri Apr 08 19:07:13 2022 +0200
@@ -14,7 +14,6 @@
 states={
 'invisible': Eval('carrier_cost_method') != 'percentage',
 },
-depends=['carrier_cost_method'],
 help="The percentage applied on the amount to compute the cost.")
 
 @classmethod



[tryton-commits] changeset in modules/carrier_subdivision:default Send only the r...

2022-04-08 Thread Nicolas Évrard
changeset 678b281fb976 in modules/carrier_subdivision:default
details: 
https://hg.tryton.org/modules/carrier_subdivision?cmd=changeset=678b281fb976
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (19 lines):

diff -r 8aa091c7af63 -r 678b281fb976 carrier.py
--- a/carrier.pyWed Apr 06 23:37:42 2022 +0200
+++ b/carrier.pyFri Apr 08 19:07:13 2022 +0200
@@ -18,7 +18,6 @@
 states={
 'invisible': ~Eval('from_country'),
 },
-depends=['from_country'],
 help="The subdivision the carrier collects from.\n"
 "Leave empty to allow collection from any subdivision.")
 from_postal_code = fields.Char("From Postal Code",
@@ -34,7 +33,6 @@
 states={
 'invisible': ~Eval('to_country'),
 },
-depends=['to_country'],
 help="The subdivision the carrier delivers to.\n"
 "Leave empty to allow delivery to any subdivision.")
 to_postal_code = fields.Char("To Postal Code",



[tryton-commits] changeset in modules/company:default Send only the required fiel...

2022-04-08 Thread Nicolas Évrard
changeset 0e17f2a68996 in modules/company:default
details: https://hg.tryton.org/modules/company?cmd=changeset=0e17f2a68996
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 company.py |  6 +-
 model.py   |  3 +--
 party.py   |  6 ++
 res.py |  3 ---
 4 files changed, 4 insertions(+), 14 deletions(-)

diffs (103 lines):

diff -r 4da3600d6e64 -r 0e17f2a68996 company.py
--- a/company.pyWed Apr 06 23:37:42 2022 +0200
+++ b/company.pyFri Apr 08 19:07:13 2022 +0200
@@ -55,7 +55,7 @@
 'company': If(
 Eval('company', -1) >= 0, Eval('company', None), None),
 },
-depends=['company'],
+depends={'company'},
 help="The party which represents the employee.")
 company = fields.Many2One('company.company', 'Company', required=True,
 help="The company to which the employee belongs.")
@@ -65,7 +65,6 @@
 (),
 )
 ],
-depends=['end_date'],
 help="When the employee joins the company.")
 end_date = fields.Date('End Date',
 domain=[If((Eval('start_date')) & (Eval('end_date')),
@@ -73,21 +72,18 @@
 (),
 )
 ],
-depends=['start_date'],
 help="When the employee leaves the company.")
 supervisor = fields.Many2One(
 'company.employee', "Supervisor",
 domain=[
 ('company', '=', Eval('company', -1)),
 ],
-depends=['company'],
 help="The employee who oversees this employee.")
 subordinates = fields.One2Many(
 'company.employee', 'supervisor', "Subordinates",
 domain=[
 ('company', '=', Eval('company', -1)),
 ],
-depends=['company'],
 help="The employees to be overseen by this employee.")
 
 @staticmethod
diff -r 4da3600d6e64 -r 0e17f2a68996 model.py
--- a/model.py  Wed Apr 06 23:37:42 2022 +0200
+++ b/model.py  Fri Apr 08 19:07:13 2022 +0200
@@ -52,8 +52,7 @@
 domain=[('company', '=', Eval(company, -1))],
 states={
 'readonly': Eval('state').in_(states),
-},
-depends=[company, 'state'])
+})
 
 
 def set_employee(field, company='company'):
diff -r 4da3600d6e64 -r 0e17f2a68996 party.py
--- a/party.py  Wed Apr 06 23:37:42 2022 +0200
+++ b/party.py  Fri Apr 08 19:07:13 2022 +0200
@@ -44,8 +44,7 @@
 def __setup__(cls):
 super().__setup__()
 cls.party.context['company'] = Eval('company', -1)
-if 'company' not in cls.party.depends:
-cls.party.depends.append('company')
+cls.party.depends.add('company')
 
 @classmethod
 def __register__(cls, module_name):
@@ -123,8 +122,7 @@
 def __setup__(cls):
 super().__setup__()
 cls.contact_mechanism.context['company'] = Eval('company', -1)
-if 'company' not in cls.contact_mechanism.depends:
-cls.contact_mechanism.depends.append('company')
+cls.contact_mechanism.depends.add('company')
 
 
 class LetterReport(Report):
diff -r 4da3600d6e64 -r 0e17f2a68996 res.py
--- a/res.pyWed Apr 06 23:37:42 2022 +0200
+++ b/res.pyFri Apr 08 19:07:13 2022 +0200
@@ -39,21 +39,18 @@
 domain=[
 ('id', 'in', Eval('companies', [])),
 ],
-depends=['companies'],
 help="Select the company to work for.")
 employees = fields.Many2Many('res.user-company.employee', 'user',
 'employee', 'Employees',
 domain=[
 ('company', 'in', Eval('companies', [])),
 ],
-depends=['companies'],
 help="Add employees to grant the user access to them.")
 employee = fields.Many2One('company.employee', 'Current Employee',
 domain=[
 ('company', '=', Eval('company', -1)),
 ('id', 'in', Eval('employees', [])),
 ],
-depends=['company', 'employees'],
 help="Select the employee to make the user behave as such.")
 company_filter = fields.Selection([
 ('one', "Current"),



[tryton-commits] changeset in modules/analytic_sale:default Send only the require...

2022-04-08 Thread Nicolas Évrard
changeset 8a834891edc6 in modules/analytic_sale:default
details: 
https://hg.tryton.org/modules/analytic_sale?cmd=changeset=8a834891edc6
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (12 lines):

diff -r d5fdec7a9b82 -r 8a834891edc6 sale.py
--- a/sale.py   Wed Apr 06 23:37:42 2022 +0200
+++ b/sale.py   Fri Apr 08 19:07:13 2022 +0200
@@ -21,8 +21,6 @@
 'invisible': Eval('type') != 'line',
 'readonly': Eval('sale_state') != 'draft',
 }
-cls.analytic_accounts.depends.extend(
-['type', 'sale_state', 'sale'])
 
 def get_invoice_line(self):
 pool = Pool()



[tryton-commits] changeset in modules/commission:default Send only the required f...

2022-04-08 Thread Nicolas Évrard
changeset 173e32a6b419 in modules/commission:default
details: 
https://hg.tryton.org/modules/commission?cmd=changeset=173e32a6b419
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 commission.py   |  25 -
 commission_reporting.py |   6 ++
 invoice.py  |   2 --
 sale.py |   3 +--
 4 files changed, 11 insertions(+), 25 deletions(-)

diffs (168 lines):

diff -r c3730c2d1d58 -r 173e32a6b419 commission.py
--- a/commission.py Wed Apr 06 23:37:42 2022 +0200
+++ b/commission.py Fri Apr 08 19:07:13 2022 +0200
@@ -33,7 +33,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'],
+depends={'company'},
 help="The party for whom the commission is calculated.")
 type_ = fields.Selection([
 ('agent', 'Agent Of'),
@@ -154,7 +154,6 @@
 ('start_date', '<=', Eval('end_date')),
 ()),
 ],
-depends=['end_date'],
 help="The first date that the agent will be considered for selection.")
 end_date = fields.Date(
 "End Date",
@@ -163,22 +162,20 @@
 ('end_date', '>=', Eval('start_date')),
 ()),
 ],
-depends=['start_date'],
 help="The last date that the agent will be considered for selection.")
 party = fields.Many2One(
 'party.party', "Party", ondelete='CASCADE', select=True,
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 company = fields.Function(fields.Many2One('company.company', "Company"),
 'on_change_with_company', searcher='search_company')
 employee = fields.Many2One(
 'company.employee', "Employee", select=True,
 domain=[
 ('company', '=', Eval('company')),
-],
-depends=['company'])
+])
 
 @classmethod
 def __setup__(cls):
@@ -334,26 +331,23 @@
 _readonly_states = {
 'readonly': Bool(Eval('invoice_line')),
 }
-_readonly_depends = ['invoice_line']
 origin = fields.Reference('Origin', selection='get_origin', select=True,
 readonly=True,
 help="The source of the commission.")
 date = fields.Date('Date', select=True, states=_readonly_states,
-depends=_readonly_depends,
 help="When the commission is due.")
 agent = fields.Many2One('commission.agent', 'Agent', required=True,
-states=_readonly_states, depends=_readonly_depends)
+states=_readonly_states)
 product = fields.Many2One('product.product', 'Product', required=True,
-states=_readonly_states, depends=_readonly_depends,
+states=_readonly_states,
 help="The product that is used on the invoice line.")
 base_amount = Monetary(
 "Base Amount", currency='currency', digits='currency',
-states=_readonly_states,
-depends=_readonly_depends)
+states=_readonly_states)
 amount = Monetary(
 "Amount", currency='currency', required=True, digits=price_digits,
 domain=[('amount', '!=', 0)],
-states=_readonly_states, depends=_readonly_depends)
+states=_readonly_states)
 currency = fields.Function(fields.Many2One('currency.currency',
 'Currency'), 'on_change_with_currency')
 type_ = fields.Function(fields.Selection([
@@ -361,7 +355,7 @@
 ('out', 'Outgoing'),
 ], 'Type'), 'on_change_with_type_')
 invoice_line = fields.Many2One('account.invoice.line', 'Invoice Line',
-readonly=True, depends=['amount', 'type_'])
+readonly=True)
 invoice_state = fields.Function(fields.Selection([
 ('', ''),
 ('invoiced', 'Invoiced'),
@@ -586,14 +580,12 @@
 If(Eval('to') & Eval('from_'), [('from_', '<=', Eval('to'))],
 []),
 ],
-depends=['to'],
 help="Limit to commissions from this date.")
 to = fields.Date('To',
 domain=[
 If(Eval('from_') & Eval('to'), [('to', '>=', Eval('from_'))],
 []),
 ],
-depends=['from_'],
 help="Limit to commissions to this date.")
 type_ = fields.Selection([
 ('in', 'Incoming'),
@@ -609,7 +601,6 @@
 If(Eval('type_') == 'out',
 ('type_', '=', 'agent'), ()),
 ],
-depends=['type_'],
 help="Limit to commissions for these agents.\n"
 "If empty all agents of the selected type are used.")
 
diff -r c3730c2d1d58 -r 173e32a6b419 commission_reporting.py
--- a/commission_reporting.py   Wed Apr 06 23:37:42 2022 +0200
+++ b/commission_reporting.py   Fri Apr 08 19:07:13 2022 +0200
@@ -200,15 +200,13 @@
 If(Eval('to_date') & 

[tryton-commits] changeset in modules/commission_waiting:default Send only the re...

2022-04-08 Thread Nicolas Évrard
changeset 6fd34b37f0ab in modules/commission_waiting:default
details: 
https://hg.tryton.org/modules/commission_waiting?cmd=changeset=6fd34b37f0ab
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (19 lines):

diff -r 94463fd01a20 -r 6fd34b37f0ab commission.py
--- a/commission.py Wed Apr 06 23:37:42 2022 +0200
+++ b/commission.py Fri Apr 08 19:07:13 2022 +0200
@@ -15,7 +15,6 @@
 ('closed', '!=', True),
 ('company', '=', Eval('company')),
 ],
-depends=['company'],
 help="The account the agent's waiting commission amounts are posted "
 "to.")
 
@@ -29,7 +28,6 @@
 def __setup__(cls):
 super(Commission, cls).__setup__()
 cls.amount.states['readonly'] |= Bool(Eval('waiting_move'))
-cls.amount.depends.append('waiting_move')
 
 @classmethod
 def copy(cls, commissions, default=None):



[tryton-commits] changeset in modules/analytic_purchase:default Send only the req...

2022-04-08 Thread Nicolas Évrard
changeset b659074283ae in modules/analytic_purchase:default
details: 
https://hg.tryton.org/modules/analytic_purchase?cmd=changeset=b659074283ae
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (12 lines):

diff -r d1a73b3fb757 -r b659074283ae purchase.py
--- a/purchase.py   Wed Apr 06 23:37:42 2022 +0200
+++ b/purchase.py   Fri Apr 08 19:07:13 2022 +0200
@@ -21,8 +21,6 @@
 'invisible': Eval('type') != 'line',
 'readonly': Eval('purchase_state') != 'draft',
 }
-cls.analytic_accounts.depends.extend(
-['type', 'purchase_state', 'purchase'])
 
 def get_invoice_line(self):
 pool = Pool()



[tryton-commits] changeset in modules/carrier_weight:default Send only the requir...

2022-04-08 Thread Nicolas Évrard
changeset a4c53ecbff19 in modules/carrier_weight:default
details: 
https://hg.tryton.org/modules/carrier_weight?cmd=changeset=a4c53ecbff19
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (36 lines):

diff -r 6556bcf1cc3a -r a4c53ecbff19 carrier.py
--- a/carrier.pyWed Apr 06 23:37:42 2022 +0200
+++ b/carrier.pyFri Apr 08 19:07:13 2022 +0200
@@ -18,7 +18,6 @@
 'required': Eval('carrier_cost_method') == 'weight',
 'readonly': Bool(Eval('weight_price_list', [])),
 },
-depends=['carrier_cost_method', 'weight_price_list'],
 help="The unit of weight criteria of the price list.")
 weight_uom_digits = fields.Function(fields.Integer('Weight Uom Digits'),
 'on_change_with_weight_uom_digits')
@@ -28,7 +27,6 @@
 'required': Eval('carrier_cost_method') == 'weight',
 'readonly': Bool(Eval('weight_price_list', [])),
 },
-depends=['carrier_cost_method', 'weight_price_list'],
 help="The currency of the price.")
 weight_price_list = fields.One2Many('carrier.weight_price_list', 'carrier',
 'Price List',
@@ -36,7 +34,6 @@
 'invisible': Eval('carrier_cost_method') != 'weight',
 'readonly': ~(Eval('weight_uom', 0) & Eval('weight_currency', 0)),
 },
-depends=['carrier_cost_method', 'weight_uom', 'weight_currency'],
 help="Add price to the carrier service.")
 
 @classmethod
@@ -89,7 +86,7 @@
 help="The carrier that the price list belongs to.")
 weight = fields.Float('Weight',
 digits=(16, Eval('_parent_carrier', {}).get('weight_uom_digits', 2)),
-depends=['carrier'],
+depends={'carrier'},
 help="The lower limit for the price.")
 price = Monetary(
 "Price", currency='currency', digits='currency',



[tryton-commits] changeset in modules/purchase_request_quotation:default Send onl...

2022-04-08 Thread Nicolas Évrard
changeset 9ba8d0f8b582 in modules/purchase_request_quotation:default
details: 
https://hg.tryton.org/modules/purchase_request_quotation?cmd=changeset=9ba8d0f8b582
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 purchase.py |  26 --
 1 files changed, 8 insertions(+), 18 deletions(-)

diffs (96 lines):

diff -r 537f2dec0b34 -r 9ba8d0f8b582 purchase.py
--- a/purchase.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/purchase.py   Fri Apr 08 19:07:13 2022 +0200
@@ -68,8 +68,7 @@
 ('sequence_type', '=',
 Id('purchase_request_quotation',
 'sequence_type_purchase_request_quotation')),
-],
-depends=['company'])
+])
 
 @classmethod
 def default_purchase_request_quotation_sequence(cls):
@@ -92,7 +91,6 @@
 states={
 'required': ~Eval('state').in_(['draft', 'cancelled'])
 },
-depends=['state'],
 help="The unique identifier of the quotation.")
 revision = fields.Integer('Revision', readonly=True,
 help="Number incremented each time the quotation is sent.")
@@ -114,17 +112,15 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 supplier_address = fields.Many2One('party.address', 'Supplier Address',
 domain=[
 ('party', '=', Eval('supplier')),
-],
-depends=['supplier'])
+])
 lines = fields.One2Many('purchase.request.quotation.line', 'quotation',
 'Lines', states={
 'readonly': Eval('state') != 'draft',
-},
-depends=['state'])
+})
 state = fields.Selection([
 ('draft', 'Draft'),
 ('sent', 'Sent'),
@@ -270,8 +266,7 @@
 description = fields.Text('Description',
 states={
 'required': ~Eval('product')
-},
-depends=['product'])
+})
 quantity = fields.Float("Quantity", digits='unit', required=True)
 unit = fields.Many2One(
 'product.uom', 'Unit', ondelete='RESTRICT',
@@ -282,8 +277,7 @@
 If(Bool(Eval('product_uom_category')),
 ('category', '=', Eval('product_uom_category')),
 ('category', '!=', -1)),
-],
-depends=['product', 'product_uom_category'])
+])
 product_uom_category = fields.Function(
 fields.Many2One('product.uom.category', 'Product Uom Category'),
 'on_change_with_product_uom_category')
@@ -292,8 +286,7 @@
 currency = fields.Many2One('currency.currency', 'Currency',
 states={
 'required': Bool(Eval('unit_price')),
-},
-depends=['unit_price'])
+})
 request = fields.Many2One('purchase.request', 'Request',
 ondelete='CASCADE', select=True, required=True,
 domain=[
@@ -303,14 +296,12 @@
 states={
 'readonly': Eval('quotation_state') != 'draft'
 },
-depends=['quotation_state'],
 help="The request which this line belongs to.")
 quotation = fields.Many2One('purchase.request.quotation', 'Quotation',
 ondelete='CASCADE', required=True,
 domain=[
('supplier', '=', Eval('supplier')),
-],
-depends=['supplier'])
+])
 quotation_state = fields.Function(fields.Selection(
 'get_quotation_state', 'Quotation State'),
 'on_change_with_quotation_state', searcher='search_quotation_state')
@@ -563,7 +554,6 @@
 ('quotation_state', '=', 'received'),
 ('request', '=', Eval('id'))
 ],
-depends=['id'],
 help="The quotation that will be chosen to create the purchase\n"
 "otherwise first ordered received quotation line will be selected.")
 



[tryton-commits] changeset in modules/purchase_requisition:default Send only the ...

2022-04-08 Thread Nicolas Évrard
changeset 67917ffe1439 in modules/purchase_requisition:default
details: 
https://hg.tryton.org/modules/purchase_requisition?cmd=changeset=67917ffe1439
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 purchase.py |  41 ++---
 1 files changed, 14 insertions(+), 27 deletions(-)

diffs (122 lines):

diff -r add0efde098f -r 67917ffe1439 purchase.py
--- a/purchase.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/purchase.py   Fri Apr 08 19:07:13 2022 +0200
@@ -53,8 +53,7 @@
 ('sequence_type', '=',
 Id('purchase_requisition',
 'sequence_type_purchase_requisition')),
-],
-depends=['company'])
+])
 
 @classmethod
 def __register__(cls, module_name):
@@ -93,40 +92,34 @@
 _states = {
 'readonly': Eval('state') != 'draft',
 }
-_depends = ['state']
 
 company = fields.Many2One(
 'company.company', "Company", required=True, select=True,
 states={
 'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
-},
-depends=['lines'] + _depends)
+})
 number = fields.Char('Number', readonly=True, select=True)
-description = fields.Char(
-'Description', states=_states, depends=_depends)
+description = fields.Char('Description', states=_states)
 employee = fields.Many2One(
-'company.employee', 'Employee', required=True,
-states=_states, depends=_depends)
+'company.employee', 'Employee', required=True, states=_states)
 supply_date = fields.Date(
 'Supply Date',
 states={
 'required': ~Eval('state').in_(['draft', 'cancelled']),
 'readonly': _states['readonly'],
-},
-depends=_depends)
+})
 warehouse = fields.Many2One(
 'stock.location', 'Warehouse',
 domain=[
 ('type', '=', 'warehouse'),
 ],
-states=_states, depends=_depends)
+states=_states)
 currency = fields.Many2One(
 'currency.currency', 'Currency',
 states={
 'readonly': (_states['readonly']
 | (Eval('lines', [0]) & Eval('currency'))),
-},
-depends=_depends)
+})
 total_amount = fields.Function(
 Monetary("Total", currency='currency', digits='currency'),
 'get_amount')
@@ -134,7 +127,7 @@
 "Total Cache", currency='currency', digits='currency')
 lines = fields.One2Many(
 'purchase.requisition.line', 'requisition', 'Lines',
-states=_states, depends=_depends)
+states=_states)
 
 approved_by = employee_field(
 "Approved By", states=['approved', 'processing', 'done', 'cancelled'])
@@ -428,38 +421,33 @@
 _states = {
 'readonly': Eval('purchase_requisition_state') != 'draft',
 }
-_depends = ['purchase_requisition_state']
 
 requisition = fields.Many2One(
 'purchase.requisition', 'Requisition',
 ondelete='CASCADE', select=True, required=True)
-supplier = fields.Many2One(
-'party.party', 'Supplier', states=_states, depends=_depends)
+supplier = fields.Many2One('party.party', 'Supplier', states=_states)
 product = fields.Many2One(
 'product.product', 'Product',
 ondelete='RESTRICT',
 domain=[
 ('purchasable', '=', True),
 ],
-states=_states, depends=_depends)
+states=_states)
 product_uom_category = fields.Function(
 fields.Many2One('product.uom.category', "Product UOM Category"),
 'on_change_with_product_uom_category')
-description = fields.Text("Description", states=_states, depends=_depends)
+description = fields.Text("Description", states=_states)
 summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
 quantity = fields.Float(
-"Quantity", digits='unit', required=True,
-states=_states, depends=_depends)
+"Quantity", digits='unit', required=True, states=_states)
 unit = fields.Many2One(
 'product.uom', 'Unit', ondelete='RESTRICT',
 states={
 'required': Bool(Eval('product')),
 'readonly': _states['readonly'],
-},
-depends=['product'] + _depends)
+})
 unit_price = Monetary(
-'Unit Price', currency='currency', digits=price_digits,
-states=_states, depends=_depends)
+'Unit Price', currency='currency', digits=price_digits, states=_states)
 currency = fields.Function(fields.Many2One('currency.currency',
 'Currency'), 'on_change_with_currency')
 amount = fields.Function(Monetary(
@@ -483,7 +471,6 @@
 ('category', 'in', [Eval(c) for c in unit_categories]),
 ('category', '!=', -1)),
 ]
-

[tryton-commits] changeset in modules/purchase_secondary_unit:default Send only t...

2022-04-08 Thread Nicolas Évrard
changeset e6a037bd14d4 in modules/purchase_secondary_unit:default
details: 
https://hg.tryton.org/modules/purchase_secondary_unit?cmd=changeset=e6a037bd14d4
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 product.py  |   6 +-
 purchase.py |  10 +++---
 2 files changed, 4 insertions(+), 12 deletions(-)

diffs (69 lines):

diff -r ac215808e81e -r e6a037bd14d4 product.py
--- a/product.pyWed Apr 06 23:37:43 2022 +0200
+++ b/product.pyFri Apr 08 19:07:13 2022 +0200
@@ -15,15 +15,13 @@
 'product.uom', "Purchase Secondary UOM",
 domain=[
 ('category', '!=', Eval('default_uom_category')),
-],
-depends=['default_uom_category'])
+])
 purchase_secondary_uom_factor = fields.Float(
 "Purchase Secondary UOM Factor", digits=uom_conversion_digits,
 states={
 'required': Bool(Eval('purchase_secondary_uom')),
 'invisible': ~Eval('purchase_secondary_uom'),
 },
-depends=['purchase_secondary_uom'],
 help="The coefficient for the formula:\n"
 "1 (purchase unit) = coefficient (secondary unit)")
 purchase_secondary_uom_rate = fields.Float(
@@ -32,7 +30,6 @@
 'required': Bool(Eval('purchase_secondary_uom')),
 'invisible': ~Eval('purchase_secondary_uom'),
 },
-depends=['purchase_secondary_uom'],
 help="The coefficient for the formula:\n"
 "coefficient (purchase unit) = 1 (secondary unit)")
 purchase_secondary_uom_category = fields.Function(
@@ -126,7 +123,6 @@
 cls.purchase_secondary_uom.states = {
 'invisible': ~Eval('purchasable', False),
 }
-cls.purchase_secondary_uom.depends.append('purchasable')
 
 
 class Product(metaclass=PoolMeta):
diff -r ac215808e81e -r e6a037bd14d4 purchase.py
--- a/purchase.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/purchase.py   Fri Apr 08 19:07:13 2022 +0200
@@ -16,8 +16,7 @@
 'invisible': ((Eval('type') != 'line')
 | ~Eval('secondary_unit')),
 'readonly': Eval('purchase_state') != 'draft',
-},
-depends=['type', 'secondary_unit', 'purchase_state']),
+}),
 'on_change_with_secondary_quantity', setter='set_secondary')
 secondary_unit = fields.Many2One(
 'product.uom', "Secondary Unit", ondelete='RESTRICT',
@@ -31,17 +30,14 @@
 | (~Eval('secondary_uom_factor')
 & ~Eval('secondary_uom_rate'))),
 'readonly': Eval('purchase_state') != 'draft',
-},
-depends=['product_secondary_uom_category', 'type',
-'secondary_uom_factor', 'secondary_uom_rate', 'purchase_state'])
+})
 secondary_unit_price = fields.Function(Monetary(
 "Secondary Unit Price", currency='currency', digits=price_digits,
 states={
 'invisible': ((Eval('type') != 'line')
 | ~Eval('secondary_unit')),
 'readonly': Eval('purchase_state') != 'draft',
-},
-depends=['type', 'secondary_unit', 'purchase_state']),
+}),
 'on_change_with_secondary_unit_price', setter='set_secondary')
 
 secondary_uom_factor = fields.Float("Secondary UOM Factor")



[tryton-commits] changeset in modules/purchase_request:default Send only the requ...

2022-04-08 Thread Nicolas Évrard
changeset 54b608e280c6 in modules/purchase_request:default
details: 
https://hg.tryton.org/modules/purchase_request?cmd=changeset=54b608e280c6
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 purchase_request.py |  18 +++---
 1 files changed, 7 insertions(+), 11 deletions(-)

diffs (61 lines):

diff -r 8c9d50aff33b -r 54b608e280c6 purchase_request.py
--- a/purchase_request.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/purchase_request.py   Fri Apr 08 19:07:13 2022 +0200
@@ -20,7 +20,6 @@
 STATES = {
 'readonly': Eval('state') != 'draft',
 }
-DEPENDS = ['state']
 
 
 class PurchaseRequest(ModelSQL, ModelView):
@@ -33,18 +32,17 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
-description = fields.Text('Description', readonly=True,
-states=STATES, depends=DEPENDS)
+depends={'company'})
+description = fields.Text('Description', readonly=True, states=STATES)
 summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
 party = fields.Many2One(
 'party.party', "Party", select=True, states=STATES,
 context={
 'company': Eval('company', -1),
 },
-depends=DEPENDS + ['company'])
+depends={'company'})
 quantity = fields.Float('Quantity', required=True, states=STATES,
-digits=(16, Eval('uom_digits', 2)), depends=DEPENDS + ['uom_digits'])
+digits=(16, Eval('uom_digits', 2)))
 uom = fields.Many2One('product.uom', 'UOM', select=True,
 ondelete='RESTRICT',
 domain=[
@@ -55,8 +53,7 @@
 states={
 'required': Bool(Eval('product')),
 'readonly': STATES['readonly'],
-},
-depends=['product', 'product_uom_category'] + DEPENDS)
+})
 uom_digits = fields.Function(fields.Integer('UOM Digits'),
 'on_change_with_uom_digits')
 product_uom_category = fields.Function(
@@ -72,14 +69,13 @@
 default_uom_digits = fields.Function(fields.Integer('Default UOM Digits'),
 'on_change_with_default_uom_digits')
 stock_level = fields.Float('Stock at Supply Date', readonly=True,
-digits=(16, Eval('default_uom_digits', 2)),
-depends=['default_uom_digits'])
+digits=(16, Eval('default_uom_digits', 2)))
 warehouse = fields.Many2One(
 'stock.location', "Warehouse",
 states={
 'required': Eval('warehouse_required', False),
 },
-domain=[('type', '=', 'warehouse')], depends=['warehouse_required'],
+domain=[('type', '=', 'warehouse')],
 readonly=True)
 warehouse_required = fields.Function(fields.Boolean('Warehouse Required'),
 'get_warehouse_required')



[tryton-commits] changeset in modules/purchase_price_list:default Send only the r...

2022-04-08 Thread Nicolas Évrard
changeset 5b1fa3a8a075 in modules/purchase_price_list:default
details: 
https://hg.tryton.org/modules/purchase_price_list?cmd=changeset=5b1fa3a8a075
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 party.py|  5 ++---
 purchase.py |  2 --
 2 files changed, 2 insertions(+), 5 deletions(-)

diffs (28 lines):

diff -r 06c5bf678cdd -r 5b1fa3a8a075 party.py
--- a/party.py  Wed Apr 06 23:37:43 2022 +0200
+++ b/party.py  Fri Apr 08 19:07:13 2022 +0200
@@ -30,10 +30,9 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 purchase_price_list = fields.Many2One(
 'product.price_list', "Purchase Price List",
 domain=[
 ('company', '=', Eval('company', -1)),
-],
-depends=['company'])
+])
diff -r 06c5bf678cdd -r 5b1fa3a8a075 purchase.py
--- a/purchase.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/purchase.py   Fri Apr 08 19:07:13 2022 +0200
@@ -14,8 +14,6 @@
 | Eval('lines', [0]))
 cls.lines.states['readonly'] = (cls.lines.states['readonly']
 | ~Eval('party'))
-if 'party' not in cls.lines.depends:
-cls.lines.depends.append('party')
 
 
 class Line(metaclass=PoolMeta):



[tryton-commits] changeset in modules/stock:default Send only the required fields...

2022-04-08 Thread Nicolas Évrard
changeset b483de7e3ad8 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset=b483de7e3ad8
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 configuration.py  |  18 +++--
 inventory.py  |  19 +++---
 location.py   |  20 +-
 move.py   |  28 ---
 period.py |   2 +-
 product.py|   6 +--
 shipment.py   |  83 +++---
 stock_reporting_margin.py |   8 +--
 8 files changed, 49 insertions(+), 135 deletions(-)

diffs (859 lines):

diff -r ffb276238a51 -r b483de7e3ad8 configuration.py
--- a/configuration.py  Wed Apr 06 23:37:44 2022 +0200
+++ b/configuration.py  Fri Apr 08 19:07:14 2022 +0200
@@ -137,48 +137,42 @@
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=',
 Id('stock', 'sequence_type_shipment_in')),
-],
-depends=['company'])
+])
 shipment_in_return_sequence = fields.Many2One(
 'ir.sequence', "Supplier Return Shipment Sequence", required=True,
 domain=[
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=',
 Id('stock', 'sequence_type_shipment_in_return')),
-],
-depends=['company'])
+])
 shipment_out_sequence = fields.Many2One(
 'ir.sequence', "Customer Shipment Sequence", required=True,
 domain=[
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=',
 Id('stock', 'sequence_type_shipment_out')),
-],
-depends=['company'])
+])
 shipment_out_return_sequence = fields.Many2One(
 'ir.sequence', "Customer Return Shipment Sequence", required=True,
 domain=[
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=',
 Id('stock', 'sequence_type_shipment_out_return')),
-],
-depends=['company'])
+])
 shipment_internal_sequence = fields.Many2One(
 'ir.sequence', "Internal Shipment Sequence", required=True,
 domain=[
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=',
 Id('stock', 'sequence_type_shipment_internal')),
-],
-depends=['company'])
+])
 inventory_sequence = fields.Many2One(
 'ir.sequence', "Inventory Sequence", required=True,
 domain=[
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=',
 Id('stock', 'sequence_type_inventory')),
-],
-depends=['company'])
+])
 
 @classmethod
 def __register__(cls, module_name):
diff -r ffb276238a51 -r b483de7e3ad8 inventory.py
--- a/inventory.py  Wed Apr 06 23:37:44 2022 +0200
+++ b/inventory.py  Fri Apr 08 19:07:14 2022 +0200
@@ -25,7 +25,6 @@
 _states = {
 'readonly': Eval('state') != 'draft',
 }
-_depends = ['state']
 
 number = fields.Char('Number', readonly=True,
 help="The main identifier for the inventory.")
@@ -34,31 +33,27 @@
 domain=[('type', '=', 'storage')], states={
 'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
 },
-depends=['state'],
 help="The location inventoried.")
 date = fields.Date('Date', required=True, states={
 'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
 },
-depends=['state'],
 help="The date of the stock count.")
 lines = fields.One2Many(
 'stock.inventory.line', 'inventory', 'Lines',
 states={
 'readonly': (_states['readonly'] | ~Eval('location')
 | ~Eval('date')),
-},
-depends=['location', 'date'] + _depends)
+})
 empty_quantity = fields.Selection([
 (None, ""),
 ('keep', "Keep"),
 ('empty', "Empty"),
-], "Empty Quantity", states=_states, depends=_depends,
+], "Empty Quantity", states=_states,
 help="How lines without a quantity are handled.")
 company = fields.Many2One('company.company', 'Company', required=True,
 states={
 'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
 },
-depends=['state'],
 help="The company the inventory is associated with.")
 state = fields.Selection([
 ('draft', "Draft"),
@@ -67,7 +62,7 @@
 ], "State", readonly=True, select=True, sort=False,
 help="The current state of the inventory.")
 
-del _states, _depends
+del _states
 
 @classmethod
 def __setup__(cls):
@@ -326,12 +321,11 

[tryton-commits] changeset in modules/stock_consignment:default Send only the req...

2022-04-08 Thread Nicolas Évrard
changeset ab0666f8e5ce in modules/stock_consignment:default
details: 
https://hg.tryton.org/modules/stock_consignment?cmd=changeset=ab0666f8e5ce
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (11 lines):

diff -r 562f2e9956f9 -r ab0666f8e5ce stock.py
--- a/stock.py  Wed Apr 06 23:37:44 2022 +0200
+++ b/stock.py  Fri Apr 08 19:07:14 2022 +0200
@@ -17,7 +17,6 @@
 states={
 'invisible': ~Eval('type').in_(['supplier', 'storage']),
 },
-depends=['type'],
 help="The party invoiced when consignment stock is used.")
 
 @classmethod



[tryton-commits] changeset in modules/stock_forecast:default Send only the requir...

2022-04-08 Thread Nicolas Évrard
changeset a478a4910025 in modules/stock_forecast:default
details: 
https://hg.tryton.org/modules/stock_forecast?cmd=changeset=a478a4910025
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 forecast.py |  39 +++
 1 files changed, 15 insertions(+), 24 deletions(-)

diffs (123 lines):

diff -r 9ca1d87bf008 -r a478a4910025 forecast.py
--- a/forecast.py   Wed Apr 06 23:37:44 2022 +0200
+++ b/forecast.py   Fri Apr 08 19:07:14 2022 +0200
@@ -28,36 +28,31 @@
 _states = {
 'readonly': Not(Equal(Eval('state'), 'draft')),
 }
-_depends = ['state']
 
 warehouse = fields.Many2One(
 'stock.location', 'Location', required=True,
 domain=[('type', '=', 'warehouse')], states={
 'readonly': Or(Not(Equal(Eval('state'), 'draft')),
 Bool(Eval('lines', [0]))),
-},
-depends=['state'])
+})
 destination = fields.Many2One(
 'stock.location', 'Destination', required=True,
-domain=[('type', 'in', ['customer', 'production'])], states=_states,
-depends=_depends)
+domain=[('type', 'in', ['customer', 'production'])], states=_states)
 from_date = fields.Date(
 "From Date", required=True,
 domain=[('from_date', '<=', Eval('to_date'))],
-states=_states, depends=_depends + ['to_date'])
+states=_states)
 to_date = fields.Date(
 "To Date", required=True,
 domain=[('to_date', '>=', Eval('from_date'))],
-states=_states, depends=_depends + ['from_date'])
+states=_states)
 lines = fields.One2Many(
-'stock.forecast.line', 'forecast', 'Lines', states=_states,
-depends=_depends)
+'stock.forecast.line', 'forecast', 'Lines', states=_states)
 company = fields.Many2One(
 'company.company', 'Company', required=True, states={
 'readonly': Or(Not(Equal(Eval('state'), 'draft')),
 Bool(Eval('lines', [0]))),
-},
-depends=['state'])
+})
 state = fields.Selection([
 ('draft', "Draft"),
 ('done', "Done"),
@@ -66,7 +61,7 @@
 active = fields.Function(fields.Boolean('Active'),
 'get_active', searcher='search_active')
 
-del _states, _depends
+del _states
 
 @classmethod
 def __setup__(cls):
@@ -259,14 +254,13 @@
 _states = {
 'readonly': Eval('forecast_state') != 'draft',
 }
-_depends = ['forecast_state']
 
 product = fields.Many2One('product.product', 'Product', required=True,
 domain=[
 ('type', '=', 'goods'),
 ('consumable', '=', False),
 ],
-states=_states, depends=_depends)
+states=_states)
 product_uom_category = fields.Function(
 fields.Many2One('product.uom.category', 'Product Uom Category'),
 'on_change_with_product_uom_category')
@@ -277,15 +271,15 @@
 ('category', '!=', -1)),
 ],
 states=_states,
-depends=['product', 'product_uom_category'] + _depends)
+depends={'product'})
 quantity = fields.Float(
 "Quantity", digits='uom', required=True,
 domain=[('quantity', '>=', 0)],
-states=_states, depends=_depends)
+states=_states)
 minimal_quantity = fields.Float(
 "Minimal Qty", digits='uom', required=True,
 domain=[('minimal_quantity', '<=', Eval('quantity'))],
-states=_states, depends=['quantity'] + _depends)
+states=_states)
 moves = fields.Many2Many('stock.forecast.line-stock.move',
 'line', 'move', 'Moves', readonly=True)
 forecast = fields.Many2One(
@@ -293,15 +287,14 @@
 states={
 'readonly': ((Eval('forecast_state') != 'draft')
 & Bool(Eval('forecast'))),
-},
-depends=['forecast_state'])
+})
 forecast_state = fields.Function(
 fields.Selection('get_forecast_states', 'Forecast State'),
 'on_change_with_forecast_state')
 quantity_executed = fields.Function(fields.Float(
 "Quantity Executed", digits='uom'), 'get_quantity_executed')
 
-del _states, _depends
+del _states
 
 @classmethod
 def __setup__(cls):
@@ -509,12 +502,10 @@
 __name__ = 'stock.forecast.complete.ask'
 from_date = fields.Date(
 "From Date", required=True,
-domain=[('from_date', '<', Eval('to_date'))],
-depends=['to_date'])
+domain=[('from_date', '<', Eval('to_date'))])
 to_date = fields.Date(
 "To Date", required=True,
-domain=[('to_date', '>', Eval('from_date'))],
-depends=['from_date'])
+domain=[('to_date', '>', Eval('from_date'))])
 
 
 class ForecastCompleteChoose(ModelView):



[tryton-commits] changeset in modules/stock_location_move:default Send only the r...

2022-04-08 Thread Nicolas Évrard
changeset 0ee17ffee5d1 in modules/stock_location_move:default
details: 
https://hg.tryton.org/modules/stock_location_move?cmd=changeset=0ee17ffee5d1
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (23 lines):

diff -r c3b387598941 -r 0ee17ffee5d1 stock.py
--- a/stock.py  Wed Apr 06 23:37:44 2022 +0200
+++ b/stock.py  Fri Apr 08 19:07:14 2022 +0200
@@ -17,8 +17,7 @@
 "Movable", select=True,
 states={
 'invisible': Eval('type') != 'storage',
-},
-depends=['type'])
+})
 assigned_by = fields.Reference(
 "Assigned by", 'get_assigned_by', readonly=True)
 
@@ -119,8 +118,7 @@
 states={
 'readonly': (~Eval('state').in_(['request', 'draft'])
 | ~Eval('from_location') | ~Eval('to_location')),
-},
-depends=['state', 'from_location', 'to_location'])
+})
 
 @classmethod
 @ModelView.button



[tryton-commits] changeset in modules/stock_lot:default Send only the required fi...

2022-04-08 Thread Nicolas Évrard
changeset 13cf1b0ce00c in modules/stock_lot:default
details: https://hg.tryton.org/modules/stock_lot?cmd=changeset=13cf1b0ce00c
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 product.py |   4 +---
 stock.py   |  19 ++-
 2 files changed, 7 insertions(+), 16 deletions(-)

diffs (87 lines):

diff -r 8f23ae5997bd -r 13cf1b0ce00c product.py
--- a/product.pyThu Apr 07 10:31:53 2022 +0200
+++ b/product.pyFri Apr 08 19:07:14 2022 +0200
@@ -45,8 +45,7 @@
 help='The type of location for which lot is required.',
 states={
 'invisible': ~Eval('type').in_(['goods', 'assets']),
-},
-depends=['type'])
+})
 lot_sequence = fields.Many2One(
 'ir.sequence', "Lot Sequence",
 domain=[
@@ -55,7 +54,6 @@
 states={
 'invisible': ~Eval('type').in_(['goods', 'assets']),
 },
-depends=['type'],
 help="The sequence used to automatically number lots.")
 
 @classmethod
diff -r 8f23ae5997bd -r 13cf1b0ce00c stock.py
--- a/stock.py  Thu Apr 07 10:31:53 2022 +0200
+++ b/stock.py  Fri Apr 08 19:07:14 2022 +0200
@@ -56,8 +56,7 @@
 "Number", required=True, select=True,
 states={
 'required': ~Eval('has_sequence') | (Eval('id', -1) >= 0),
-},
-depends=['has_sequence'])
+})
 product = fields.Many2One('product.product', 'Product', required=True)
 has_sequence = fields.Function(
 fields.Boolean("Has Sequence"), 'on_change_with_has_sequence')
@@ -289,13 +288,11 @@
 product = fields.Many2One('product.product', "Product")
 quantity = fields.Function(
 fields.Float(
-"Quantity", digits=(16, Eval('default_uom_digits', 2)),
-depends=['default_uom_digits']),
+"Quantity", digits=(16, Eval('default_uom_digits', 2))),
 'get_lot', searcher='search_lot')
 forecast_quantity = fields.Function(
 fields.Float(
-"Forecast Quantity", digits=(16, Eval('default_uom_digits', 2)),
-depends=['default_uom_digits']),
+"Forecast Quantity", digits=(16, Eval('default_uom_digits', 2))),
 'get_lot', searcher='search_lot')
 default_uom = fields.Function(
 fields.Many2One('product.uom', "Default UOM"),
@@ -398,8 +395,7 @@
 ],
 states={
 'readonly': Eval('state').in_(['cancelled', 'done']),
-},
-depends=['state', 'product'])
+})
 
 @classmethod
 def __setup__(cls):
@@ -526,15 +522,13 @@
 ],
 states={
 'readonly': ~Eval('quantity_remaining', 0),
-},
-depends=['product', 'quantity_remaining'])
+})
 
 duplicate_lot_number = fields.Integer(
 "Duplicate Lot Number",
 states={
 'invisible': Len(Eval('lots')) != 1,
 },
-depends=['lots'],
 help="The number of times the lot must be duplicated.")
 
 @classmethod
@@ -725,8 +719,7 @@
 ],
 states={
 'readonly': Eval('inventory_state') != 'draft',
-},
-depends=['product', 'inventory_state'])
+})
 
 @classmethod
 def __setup__(cls):



[tryton-commits] changeset in modules/stock_assign_manual:default Send only the r...

2022-04-08 Thread Nicolas Évrard
changeset 0eb578a763c1 in modules/stock_assign_manual:default
details: 
https://hg.tryton.org/modules/stock_assign_manual?cmd=changeset=0eb578a763c1
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (35 lines):

diff -r b21ee7b8b1f9 -r 0eb578a763c1 stock.py
--- a/stock.py  Wed Apr 06 23:37:44 2022 +0200
+++ b/stock.py  Fri Apr 08 19:07:14 2022 +0200
@@ -180,7 +180,6 @@
 ('quantity', '<=', Eval('move_quantity', 0)),
 ],
 ],
-depends=['move_quantity'],
 help="The maximum quantity to assign from the place.\n"
 "Leave empty for the full quantity of the move.")
 unit = fields.Many2One('product.uom', "Unit", readonly=True)
@@ -369,7 +368,6 @@
 ('unassigned_quantity', '<=', Eval('move_quantity', 0)),
 ],
 ],
-depends=['move_quantity'],
 help="The quantity to unassign")
 assigned_quantity = fields.Float(
 "Assigned Quantity", digits='unit',
@@ -380,7 +378,6 @@
 ('assigned_quantity', '<=', Eval('move_quantity', 0)),
 ],
 ],
-depends=['move_quantity'],
 help="The quantity left assigned")
 unit = fields.Function(
 fields.Many2One('product.uom', "Unit"), 'on_change_with_unit')
@@ -427,7 +424,6 @@
 moves = fields.One2Many(
 'stock.shipment.assigned.move', None, "Moves",
 domain=[('move.id', 'in', Eval('assigned_moves'))],
-depends=['assigned_moves'],
 help="The moves to unassign.")
 assigned_moves = fields.Many2Many(
 'stock.move', None, None, "Assigned Moves")



[tryton-commits] changeset in modules/account:default Send only the required fiel...

2022-04-08 Thread Nicolas Évrard
changeset 3d0e75dbac6e in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset=3d0e75dbac6e
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 account.py   |  165 ++-
 common.py|   10 +--
 configuration.py |   17 ++---
 fiscalyear.py|   28 +++--
 journal.py   |   10 +--
 move.py  |   92 --
 move_template.py |   13 +--
 party.py |   10 +-
 period.py|   12 +--
 tax.py   |   65 -
 10 files changed, 152 insertions(+), 270 deletions(-)

diffs (1507 lines):

diff -r e413e6504d89 -r 3d0e75dbac6e account.py
--- a/account.pyWed Apr 06 23:37:41 2022 +0200
+++ b/account.pyFri Apr 08 19:07:12 2022 +0200
@@ -53,14 +53,12 @@
 ], "Statement",
 states={
 'required': Bool(Eval('parent')),
-},
-depends=['parent'])
+})
 assets = fields.Boolean(
 "Assets",
 states={
 'invisible': Eval('statement') != 'balance',
-},
-depends=['statement'])
+})
 
 receivable = fields.Boolean(
 "Receivable",
@@ -72,8 +70,7 @@
 states={
 'invisible': ((Eval('statement') != 'balance')
 | ~Eval('assets', True)),
-},
-depends=['statement', 'assets'])
+})
 stock = fields.Boolean(
 "Stock",
 domain=[
@@ -82,8 +79,7 @@
 ],
 states={
 'invisible': Eval('statement') == 'off-balance',
-},
-depends=['statement'])
+})
 
 payable = fields.Boolean(
 "Payable",
@@ -95,8 +91,7 @@
 states={
 'invisible': ((Eval('statement') != 'balance')
 | Eval('assets', False)),
-},
-depends=['statement', 'assets'])
+})
 
 debt = fields.Boolean(
 "Debt",
@@ -109,7 +104,6 @@
 'invisible': ((Eval('statement') != 'balance')
 | Eval('assets', False)),
 },
-depends=['statement', 'assets'],
 help="Check to allow booking debt via supplier invoice.")
 
 revenue = fields.Boolean(
@@ -120,8 +114,7 @@
 ],
 states={
 'invisible': Eval('statement') != 'income',
-},
-depends=['statement'])
+})
 
 expense = fields.Boolean(
 "Expense",
@@ -131,8 +124,7 @@
 ],
 states={
 'invisible': Eval('statement') != 'income',
-},
-depends=['statement'])
+})
 if not template:
 for fname in dir(Mixin):
 field = getattr(Mixin, fname)
@@ -158,8 +150,7 @@
 ('statement', '!=', 'off-balance')),
 ),
 ('statement', '=', None),
-],
-depends=['statement'])
+])
 childs = fields.One2Many(
 'account.account.type.template', 'parent', "Children")
 
@@ -245,13 +236,11 @@
 },
 domain=[
 ('company', '=', Eval('company')),
-],
-depends=['company', 'statement'])
+])
 childs = fields.One2Many('account.account.type', 'parent', 'Children',
 domain=[
 ('company', '=', Eval('company')),
-],
-depends=['company'])
+])
 currency = fields.Function(fields.Many2One(
 'currency.currency', 'Currency'), 'get_currency')
 amount = fields.Function(Monetary(
@@ -268,8 +257,7 @@
 help="Check to override template definition",
 states={
 'invisible': ~Bool(Eval('template', -1)),
-},
-depends=['template'])
+})
 
 @classmethod
 def __register__(cls, module_name):
@@ -508,14 +496,12 @@
 states={
 'invisible': ~Eval('type'),
 },
-depends=['type'],
 help="Check to prevent posting move on the account.")
 reconcile = fields.Boolean(
 "Reconcile",
 states={
 'invisible': ~Eval('type'),
 },
-depends=['type'],
 help="Allow move lines of this account to be reconciled.")
 
 party_required = fields.Boolean('Party Required',
@@ -526,22 +512,19 @@
 ],
 states={
 'invisible': ~Eval('type') | ~Eval('deferral', False),
-},
-depends=['type', 'deferral'])
+})
 
 general_ledger_balance = 

[tryton-commits] changeset in modules/currency_rs:default Send only the required ...

2022-04-08 Thread Nicolas Évrard
changeset 03eab07c529d in modules/currency_rs:default
details: 
https://hg.tryton.org/modules/currency_rs?cmd=changeset=03eab07c529d
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 currency.py |  13 +
 1 files changed, 5 insertions(+), 8 deletions(-)

diffs (34 lines):

diff -r 7404d3142137 -r 03eab07c529d currency.py
--- a/currency.py   Wed Apr 06 23:37:42 2022 +0200
+++ b/currency.py   Fri Apr 08 19:07:13 2022 +0200
@@ -38,16 +38,15 @@
 'required': Eval('source') == 'nbs_rs',
 'invisible': Eval('source') != 'nbs_rs',
 }
-_depends = ['source']
 
-rs_username = fields.Char("Username", states=_states, depends=_depends)
-rs_password = fields.Char("Password", states=_states, depends=_depends)
-rs_license_id = fields.Char("License ID", states=_states, depends=_depends)
+rs_username = fields.Char("Username", states=_states)
+rs_password = fields.Char("Password", states=_states)
+rs_license_id = fields.Char("License ID", states=_states)
 rs_list_type = fields.Selection(
-'get_rs_list_types', "List Type", states=_states, depends=_depends)
+'get_rs_list_types', "List Type", states=_states)
 _rs_list_types = Cache(__name__ + '.get_rs_list_types', context=False)
 
-del _states, _depends
+del _states
 
 @classmethod
 def __setup__(cls):
@@ -59,8 +58,6 @@
 ('code', '=', 'RSD'),
 ()),
 ]
-if 'source' not in cls.currency.depends:
-cls.currency.depends.append('source')
 
 @fields.depends('rs_username', 'rs_password', 'rs_license_id')
 def _rs_client(self):



[tryton-commits] changeset in modules/currency:default Send only the required fie...

2022-04-08 Thread Nicolas Évrard
changeset 457954e02feb in modules/currency:default
details: https://hg.tryton.org/modules/currency?cmd=changeset=457954e02feb
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 currency.py |  8 +++-
 fields.py   |  8 
 2 files changed, 7 insertions(+), 9 deletions(-)

diffs (50 lines):

diff -r f4fa211f161d -r 457954e02feb currency.py
--- a/currency.py   Wed Apr 06 23:37:42 2022 +0200
+++ b/currency.py   Fri Apr 08 19:07:13 2022 +0200
@@ -47,7 +47,7 @@
 rates = fields.One2Many('currency.currency.rate', 'currency', 'Rates',
 help="Add floating exchange rates for the currency.")
 rounding = fields.Numeric('Rounding factor', required=True,
-digits=(12, Eval('digits', 6)), depends=['digits'],
+digits=(12, Eval('digits', 6)),
 help="The minimum amount which can be represented in this currency.")
 digits = fields.Integer("Digits", required=True,
 help="The number of digits to display after the decimal separator.")
@@ -312,8 +312,7 @@
 states={
 'required': Eval('frequency') == 'weekly',
 'invisible': Eval('frequency') != 'weekly',
-},
-depends=['frequency'])
+})
 day = fields.Integer(
 "Day of Month",
 domain=[If(Eval('frequency') == 'monthly',
@@ -323,8 +322,7 @@
 states={
 'required': Eval('frequency') == 'monthly',
 'invisible': Eval('frequency') != 'monthly',
-},
-depends=['frequency'])
+})
 currency = fields.Many2One(
 'currency.currency', "Currency", required=True,
 help="The base currency to fetch rate.")
diff -r f4fa211f161d -r 457954e02feb fields.py
--- a/fields.py Wed Apr 06 23:37:42 2022 +0200
+++ b/fields.py Fri Apr 08 19:07:13 2022 +0200
@@ -19,10 +19,10 @@
 '''
 if currency:
 if depends is None:
-depends = [currency]
-elif currency not in depends:
-depends = depends.copy()
-depends.append(currency)
+depends = set()
+else:
+depends = set(depends)
+depends.add(currency)
 super().__init__(string=string, digits=digits, help=help,
 required=required, readonly=readonly, domain=domain, states=states,
 select=select, on_change=on_change, on_change_with=on_change_with,



[tryton-commits] changeset in modules/customs:default Send only the required fiel...

2022-04-08 Thread Nicolas Évrard
changeset 602bf5696bd5 in modules/customs:default
details: https://hg.tryton.org/modules/customs?cmd=changeset=602bf5696bd5
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 customs.py |  27 +--
 product.py |  18 +-
 2 files changed, 14 insertions(+), 31 deletions(-)

diffs (147 lines):

diff -r 2011b789107b -r 602bf5696bd5 customs.py
--- a/customs.pyWed Apr 06 23:37:42 2022 +0200
+++ b/customs.pyFri Apr 08 19:07:13 2022 +0200
@@ -41,8 +41,7 @@
 start_month = fields.Selection(MONTHS, 'Start Month', sort=False,
 states={
 'required': Eval('end_month') | Eval('start_day'),
-},
-depends=['end_month', 'start_day'])
+})
 start_day = fields.Integer('Start Day',
 domain=['OR',
 ('start_day', '<=', If(Eval('start_month').in_(
@@ -52,13 +51,11 @@
 ],
 states={
 'required': Bool(Eval('start_month')),
-},
-depends=['start_month'])
+})
 end_month = fields.Selection(MONTHS, 'End Month', sort=False,
 states={
 'required': Eval('start_month') | Eval('end_day'),
-},
-depends=['start_month', 'end_day'])
+})
 end_day = fields.Integer('End Day',
 domain=['OR',
 ('end_day', '<=', If(Eval('end_month').in_(
@@ -68,8 +65,7 @@
 ],
 states={
 'required': Bool(Eval('end_month')),
-},
-depends=['end_month'])
+})
 duty_rates = fields.One2Many('customs.duty.rate', 'tariff_code',
 'Duty Rates')
 
@@ -116,15 +112,13 @@
 ('start_date', '<=', If(Bool(Eval('end_date')),
 Eval('end_date', datetime.date.max), datetime.date.max)),
 ('start_date', '=', None),
-],
-depends=['end_date'])
+])
 end_date = fields.Date('End Date',
 domain=['OR',
 ('end_date', '>=', If(Bool(Eval('start_date')),
 Eval('start_date', datetime.date.min), datetime.date.min)),
 ('end_date', '=', None),
-],
-depends=['start_date'])
+])
 computation_type = fields.Selection([
 ('amount', 'Amount'),
 ('quantity', 'Quantity'),
@@ -133,20 +127,17 @@
 states={
 'required': Eval('computation_type').in_(['amount', 'quantity']),
 'invisible': ~Eval('computation_type').in_(['amount', 'quantity']),
-},
-depends=['computation_type'])
+})
 currency = fields.Many2One('currency.currency', 'Currency',
 states={
 'required': Eval('computation_type').in_(['amount', 'quantity']),
 'invisible': ~Eval('computation_type').in_(['amount', 'quantity']),
-},
-depends=['computation_type'])
+})
 uom = fields.Many2One('product.uom', 'Uom',
 states={
 'required': Eval('computation_type') == 'quantity',
 'invisible': Eval('computation_type') != 'quantity',
-},
-depends=['computation_type'])
+})
 
 @classmethod
 def __setup__(cls):
diff -r 2011b789107b -r 602bf5696bd5 product.py
--- a/product.pyWed Apr 06 23:37:42 2022 +0200
+++ b/product.pyFri Apr 08 19:07:13 2022 +0200
@@ -13,21 +13,18 @@
 customs = fields.Boolean('Customs', select=True,
 states={
 'readonly': Bool(Eval('childs', [0])) | Bool(Eval('parent')),
-},
-depends=['parent'])
+})
 tariff_codes_parent = fields.Boolean("Use Parent's Tariff Codes",
 states={
 'invisible': ~Eval('customs', False),
 },
-depends=['customs'],
 help='Use the tariff codes defined on the parent category.')
 tariff_codes = fields.One2Many('product-customs.tariff.code',
 'product', 'Tariff Codes', order=[('sequence', 'ASC'), ('id', 'ASC')],
 states={
 'invisible': (Eval('tariff_codes_parent', False)
 | ~Eval('customs', False)),
-},
-depends=['tariff_codes_parent', 'customs'])
+})
 
 @classmethod
 def __setup__(cls):
@@ -35,11 +32,9 @@
 cls.parent.domain = [
 ('customs', '=', Eval('customs', False)),
 cls.parent.domain or []]
-cls.parent.depends.append('customs')
 cls.parent.states['required'] = Or(
 cls.parent.states.get('required', False),
 Eval('tariff_codes_parent', False))
-cls.parent.depends.append('tariff_codes_parent')
 
 @classmethod
 def default_customs(cls):
@@ -100,8 +95,7 @@
 ],
 states={
 'required': Eval('tariff_codes_category', False),
-},
-depends=['tariff_codes_category'])

[tryton-commits] changeset in modules/country:default Send only the required fiel...

2022-04-08 Thread Nicolas Évrard
changeset 11744871bc21 in modules/country:default
details: https://hg.tryton.org/modules/country?cmd=changeset=11744871bc21
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (19 lines):

diff -r 3e7052f84a97 -r 11744871bc21 country.py
--- a/country.pyWed Apr 06 23:37:42 2022 +0200
+++ b/country.pyFri Apr 08 19:07:13 2022 +0200
@@ -241,7 +241,6 @@
 domain=[
 ('country', '=', Eval('country', -1)),
 ],
-depends=['country'],
 help="Add subdivision below the parent.")
 
 @classmethod
@@ -303,7 +302,6 @@
 subdivision = fields.Many2One('country.subdivision', 'Subdivision',
 select=True, ondelete='CASCADE',
 domain=[('country', '=', Eval('country', -1))],
-depends=['country'],
 help="The subdivision where the postal code is.")
 postal_code = fields.Char('Postal Code')
 city = fields.Char(



[tryton-commits] changeset in modules/currency_ro:default Send only the required ...

2022-04-08 Thread Nicolas Évrard
changeset 827550540929 in modules/currency_ro:default
details: 
https://hg.tryton.org/modules/currency_ro?cmd=changeset=827550540929
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (12 lines):

diff -r 73e1c45ccd00 -r 827550540929 currency.py
--- a/currency.py   Wed Apr 06 23:37:42 2022 +0200
+++ b/currency.py   Fri Apr 08 19:07:13 2022 +0200
@@ -29,8 +29,6 @@
 ('code', '=', 'RON'),
 ()),
 ]
-if 'source' not in cls.currency.depends:
-cls.currency.depends.append('source')
 
 def fetch_bnr_ro(self, date):
 if (dt.date.today() - date).days < 10:



[tryton-commits] changeset in modules/production_work:default Send only the requi...

2022-04-08 Thread Nicolas Évrard
changeset 8fac6f7c59cf in modules/production_work:default
details: 
https://hg.tryton.org/modules/production_work?cmd=changeset=8fac6f7c59cf
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 production.py |   6 ++
 work.py   |  24 
 2 files changed, 10 insertions(+), 20 deletions(-)

diffs (96 lines):

diff -r d2f1b7710d59 -r 8fac6f7c59cf production.py
--- a/production.py Wed Apr 06 23:37:43 2022 +0200
+++ b/production.py Fri Apr 08 19:07:13 2022 +0200
@@ -25,8 +25,7 @@
 domain=[
 ('company', '=', Eval('company', -1)),
 ('warehouse', '=', Eval('warehouse', -1)),
-],
-depends=['routing', 'company', 'warehouse', 'state'])
+])
 works = fields.One2Many('production.work', 'production', 'Works',
 states={
 'readonly': Eval('state').in_(
@@ -34,8 +33,7 @@
 },
 domain=[
 ('company', '=', Eval('company', -1)),
-],
-depends=['state', 'company'])
+])
 
 def get_cost(self, name):
 pool = Pool()
diff -r d2f1b7710d59 -r 8fac6f7c59cf work.py
--- a/work.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/work.py   Fri Apr 08 19:07:13 2022 +0200
@@ -32,20 +32,17 @@
 domain=[
 ('company', '=', Eval('company', -1)),
 ('warehouse', '=', Eval('warehouse', -1)),
-],
-depends=['company', 'warehouse'])
+])
 children = fields.One2Many('production.work.center', 'parent', 'Children',
 domain=[
 ('company', '=', Eval('company', -1)),
 ('warehouse', '=', Eval('warehouse', -1)),
-],
-depends=['company', 'warehouse'])
+])
 category = fields.Many2One('production.work.center.category', 'Category')
 cost_price = fields.Numeric('Cost Price', digits=price_digits,
 states={
 'required': Bool(Eval('cost_method')),
-},
-depends=['cost_method'])
+})
 cost_method = fields.Selection([
 ('', ''),
 ('cycle', 'Per Cycle'),
@@ -53,8 +50,7 @@
 ], 'Cost Method',
 states={
 'required': Bool(Eval('cost_price')),
-},
-depends=['cost_price'])
+})
 company = fields.Many2One('company.company', 'Company', required=True,
 select=True)
 warehouse = fields.Many2One('stock.location', 'Warehouse', required=True,
@@ -108,8 +104,7 @@
 select=True, ondelete='CASCADE',
 domain=[
 ('company', '=', Eval('company', -1)),
-],
-depends=['company'])
+])
 work_center_category = fields.Function(fields.Many2One(
 'production.work.center.category', 'Work Center Category'),
 'on_change_with_work_center_category')
@@ -123,13 +118,11 @@
 ],
 states={
 'required': ~Eval('state').in_(['request', 'draft']),
-},
-depends=['work_center_category', 'company', 'warehouse', 'state'])
+})
 cycles = fields.One2Many('production.work.cycle', 'work', 'Cycles',
 states={
 'readonly': Eval('state').in_(['request', 'done']),
-},
-depends=['state'])
+})
 active_cycles = fields.One2Many(
 'production.work.cycle', 'work', "Active Cycles",
 readonly=True,
@@ -283,8 +276,7 @@
 states={
 'required': Eval('state') == 'done',
 'readonly': Eval('state').in_(['done', 'draft', 'cancelled']),
-},
-depends=['state'])
+})
 cost = fields.Numeric('Cost', digits=price_digits, readonly=True)
 state = fields.Selection([
 ('draft', 'Draft'),



[tryton-commits] changeset in modules/project:default Send only the required fiel...

2022-04-08 Thread Nicolas Évrard
changeset dc5037f9beee in modules/project:default
details: https://hg.tryton.org/modules/project?cmd=changeset=dc5037f9beee
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 work.py |  19 +++
 1 files changed, 7 insertions(+), 12 deletions(-)

diffs (57 lines):

diff -r 8d65d420aa67 -r dc5037f9beee work.py
--- a/work.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/work.py   Fri Apr 08 19:07:13 2022 +0200
@@ -136,12 +136,12 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['type', 'company'])
+depends={'company'})
 party_address = fields.Many2One('party.address', 'Contact Address',
 domain=[('party', '=', Eval('party'))],
 states={
 'invisible': Eval('type') != 'project',
-}, depends=['party', 'type'])
+})
 timesheet_works = fields.One2Many(
 'timesheet.work', 'origin', 'Timesheet Works', readonly=True, size=1)
 timesheet_available = fields.Function(
@@ -150,14 +150,12 @@
 timesheet_start_date = fields.Function(fields.Date('Timesheet Start',
 states={
 'invisible': ~Eval('timesheet_available'),
-},
-depends=['timesheet_available']),
+}),
 'get_timesheet_date', setter='set_timesheet_date')
 timesheet_end_date = fields.Function(fields.Date('Timesheet End',
 states={
 'invisible': ~Eval('timesheet_available'),
-},
-depends=['timesheet_available']),
+}),
 'get_timesheet_date', setter='set_timesheet_date')
 timesheet_duration = fields.Function(fields.TimeDelta('Duration',
 'company_work_time',
@@ -191,18 +189,15 @@
 'project.work', 'Parent', path='path', ondelete='RESTRICT',
 domain=[
 ('company', '=', Eval('company', -1)),
-],
-depends=['company'])
+])
 path = fields.Char("Path", select=True)
 children = fields.One2Many('project.work', 'parent', 'Children',
 domain=[
 ('company', '=', Eval('company', -1)),
-],
-depends=['company'])
+])
 status = fields.Many2One(
 'project.work.status', "Status", required=True, select=True,
-domain=[If(Bool(Eval('type')), ('types', 'in', Eval('type')), ())],
-depends=['type'])
+domain=[If(Bool(Eval('type')), ('types', 'in', Eval('type')), ())])
 
 @staticmethod
 def default_type():



[tryton-commits] changeset in modules/production_work_timesheet:default Send only...

2022-04-08 Thread Nicolas Évrard
changeset d05ec485ae51 in modules/production_work_timesheet:default
details: 
https://hg.tryton.org/modules/production_work_timesheet?cmd=changeset=d05ec485ae51
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (13 lines):

diff -r 617f9bd85f0a -r d05ec485ae51 work.py
--- a/work.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/work.py   Fri Apr 08 19:07:13 2022 +0200
@@ -27,8 +27,7 @@
 domain=[
 ('company', '=', Eval('company', -1)),
 ('work', '=', Eval('timesheet_work', -1)),
-],
-depends=['timesheet_works', 'timesheet_work', 'company']),
+]),
 'get_timesheet_lines', setter='set_timesheet_lines')
 
 def get_timesheet_work(self, name):



[tryton-commits] changeset in modules/production_split:default Send only the requ...

2022-04-08 Thread Nicolas Évrard
changeset 7db105906d1b in modules/production_split:default
details: 
https://hg.tryton.org/modules/production_split?cmd=changeset=7db105906d1b
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (12 lines):

diff -r 28f5e95ed2a4 -r 7db105906d1b production.py
--- a/production.py Wed Apr 06 23:37:43 2022 +0200
+++ b/production.py Fri Apr 08 19:07:13 2022 +0200
@@ -99,7 +99,6 @@
 uom = fields.Many2One('product.uom', 'Uom', required=True,
 domain=[
 ('category', '=', Eval('uom_category')),
-],
-depends=['uom_category'])
+])
 uom_category = fields.Many2One('product.uom.category', 'Uom Category',
 readonly=True)



[tryton-commits] changeset in modules/account_dunning:default Send only the requi...

2022-04-08 Thread Nicolas Évrard
changeset f2b601fdb747 in modules/account_dunning:default
details: 
https://hg.tryton.org/modules/account_dunning?cmd=changeset=f2b601fdb747
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 dunning.py |  16 ++--
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (70 lines):

diff -r e3dfda5dc2af -r f2b601fdb747 dunning.py
--- a/dunning.pyWed Apr 06 23:37:41 2022 +0200
+++ b/dunning.pyFri Apr 08 19:07:12 2022 +0200
@@ -71,7 +71,6 @@
 _STATES = {
 'readonly': Eval('state') != 'draft',
 }
-_DEPENDS = ['state']
 
 
 class Dunning(ModelSQL, ModelView):
@@ -80,7 +79,7 @@
 company = fields.Many2One('company.company', 'Company', required=True,
 help="Make the dunning belong to the company.",
 select=True,
-states=_STATES, depends=_DEPENDS)
+states=_STATES)
 line = fields.Many2One('account.move.line', 'Line', required=True,
 help="The receivable line to dun for.",
 domain=[
@@ -91,27 +90,25 @@
 ('credit', '<', 0),
 ],
 ],
-states=_STATES, depends=_DEPENDS + ['company'])
+states=_STATES)
 procedure = fields.Many2One('account.dunning.procedure', 'Procedure',
-required=True, states=_STATES, depends=_DEPENDS)
+required=True, states=_STATES)
 level = fields.Many2One('account.dunning.level', 'Level', required=True,
 domain=[
 ('procedure', '=', Eval('procedure', -1)),
 ],
-states=_STATES, depends=_DEPENDS + ['procedure'])
+states=_STATES)
 date = fields.Date(
 "Date", readonly=True,
 states={
 'invisible': Eval('state') == 'draft',
 },
-depends=['state'],
 help="When the dunning reached the level.")
 age = fields.Function(fields.TimeDelta(
 "Age",
 states={
 'invisible': Eval('state') == 'draft',
 },
-depends=['state'],
 help="How long the dunning has been at the level."),
 'get_age')
 blocked = fields.Boolean('Blocked',
@@ -128,7 +125,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company']),
+depends={'company'}),
 'get_line_field', searcher='search_line_field')
 amount = fields.Function(Monetary(
 "Amount", currency='currency', digits='currency'),
@@ -142,8 +139,7 @@
 currency='second_currency', digits='second_currency',
 states={
 'invisible': Eval('currency') == Eval('second_currency'),
-},
-depends=['currency', 'second_currency']),
+}),
 'get_amount_second_currency')
 second_currency = fields.Function(fields.Many2One('currency.currency',
 'Second Currency'), 'get_second_currency')



[tryton-commits] changeset in modules/account_dunning_email:default Send only the...

2022-04-08 Thread Nicolas Évrard
changeset 781d6cfafcc5 in modules/account_dunning_email:default
details: 
https://hg.tryton.org/modules/account_dunning_email?cmd=changeset=781d6cfafcc5
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (26 lines):

diff -r d669641fb035 -r 781d6cfafcc5 account.py
--- a/account.pyWed Apr 06 23:37:41 2022 +0200
+++ b/account.pyFri Apr 08 19:07:12 2022 +0200
@@ -37,21 +37,18 @@
 states={
 'required': Bool(Eval('send_email')),
 'invisible': ~Eval('send_email'),
-},
-depends=['send_email'])
+})
 email_from = fields.Char(
 "From", translate=True,
 states={
 'invisible': ~Eval('send_email'),
 },
-depends=['send_email'],
 help="Leave empty for the value defined in the configuration file.")
 email_contact_mechanism = fields.Selection(
 'get_contact_mechanisms', "Contact Mechanism",
 states={
 'invisible': ~Eval('send_email'),
 },
-depends=['send_email'],
 help="Define which e-mail to use from the party's contact mechanisms")
 
 @classmethod



[tryton-commits] changeset in modules/account_es:default Send only the required f...

2022-04-08 Thread Nicolas Évrard
changeset 7146a907f556 in modules/account_es:default
details: 
https://hg.tryton.org/modules/account_es?cmd=changeset=7146a907f556
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 account.py |  15 +--
 account_payment.py |   1 -
 reporting_tax.py   |  17 ++---
 3 files changed, 11 insertions(+), 22 deletions(-)

diffs (110 lines):

diff -r 0ffdf28b210b -r 7146a907f556 account.py
--- a/account.pyWed Apr 06 23:37:41 2022 +0200
+++ b/account.pyFri Apr 08 19:07:12 2022 +0200
@@ -34,8 +34,7 @@
 states={
 'readonly': (Bool(Eval('template', -1))
 & ~Eval('template_override', False)),
-},
-depends=['template', 'template_override'])
+})
 
 
 class TaxTemplate(metaclass=PoolMeta):
@@ -90,26 +89,22 @@
 states={
 'readonly': (Bool(Eval('template', -1))
 & ~Eval('template_override', False)),
-},
-depends=['template', 'template_override'])
+})
 es_ec_purchases_list_code = fields.Char("Spanish EC Purchases List Code",
 states={
 'readonly': (Bool(Eval('template', -1))
 & ~Eval('template_override', False)),
-},
-depends=['template', 'template_override'])
+})
 es_reported_with = fields.Many2One('account.tax', "Reported with",
 states={
 'readonly': (Bool(Eval('template', -1))
 & ~Eval('template_override', False)),
-},
-depends=['template', 'template_override'])
+})
 es_exclude_from_vat_book = fields.Boolean("Exclude from Spanish VAT Book",
 states={
 'readonly': (Bool(Eval('template', -1))
 & ~Eval('template_override', False)),
-},
-depends=['template', 'template_override'])
+})
 
 @classmethod
 def default_es_exclude_from_vat_book(cls):
diff -r 0ffdf28b210b -r 7146a907f556 account_payment.py
--- a/account_payment.pyWed Apr 06 23:37:41 2022 +0200
+++ b/account_payment.pyFri Apr 08 19:07:12 2022 +0200
@@ -15,7 +15,6 @@
 'invisible': ((Eval('process_method') != 'sepa')
 | (Eval('es_sepa_bank_account_country_code') != 'ES')),
 },
-depends=['process_method', 'es_sepa_bank_account_country_code'],
 help="Check to receive payments before the payment date.")
 
 @fields.depends('sepa_bank_account_number')
diff -r 0ffdf28b210b -r 7146a907f556 reporting_tax.py
--- a/reporting_tax.py  Wed Apr 06 23:37:41 2022 +0200
+++ b/reporting_tax.py  Fri Apr 08 19:07:12 2022 +0200
@@ -632,16 +632,14 @@
 ('start_date', '<=', Eval('end_date')),
 (),
 ),
-],
-depends=['end_date'])
+])
 end_date = fields.Date("End Date",
 domain=[
 If(Eval('start_date'),
 ('end_date', '>=', Eval('start_date')),
 (),
 ),
-],
-depends=['start_date'])
+])
 
 @classmethod
 def default_start_date(cls):
@@ -714,19 +712,17 @@
 required=True,
 domain=[
 ('company', '=', Eval('company')),
-],
-depends=['company'])
+])
 start_period = fields.Many2One('account.period', "Start Period",
 domain=[
 ('fiscalyear', '=', Eval('fiscalyear')),
 ('start_date', '<=', (Eval('end_period'), 'start_date')),
-], depends=['fiscalyear', 'end_period'])
+])
 end_period = fields.Many2One('account.period', "End Period",
 domain=[
 ('fiscalyear', '=', Eval('fiscalyear')),
 ('start_date', '>=', (Eval('start_period'), 'start_date'))
-],
-depends=['fiscalyear', 'start_period'])
+])
 es_vat_book_type = fields.Selection([
 # Use same key as tax authority
 ('E', "Issued"),
@@ -769,8 +765,7 @@
 "Surcharge Tax Amount", currency='currency', digits='currency',
 states={
 'invisible': ~(Eval('surcharge_tax', None)),
-},
-depends=['surcharge_tax'])
+})
 
 currency = fields.Function(fields.Many2One(
 'currency.currency', "Currency"),



[tryton-commits] changeset in modules/account_dunning_fee:default Send only the r...

2022-04-08 Thread Nicolas Évrard
changeset 52f611d9de44 in modules/account_dunning_fee:default
details: 
https://hg.tryton.org/modules/account_dunning_fee?cmd=changeset=52f611d9de44
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (13 lines):

diff -r 0fd3ff13566d -r 52f611d9de44 dunning.py
--- a/dunning.pyWed Apr 06 23:37:41 2022 +0200
+++ b/dunning.pyFri Apr 08 19:07:12 2022 +0200
@@ -28,8 +28,7 @@
 states={
 'invisible': Eval('compute_method') != 'percentage',
 'required': Eval('compute_method') == 'percentage',
-},
-depends=['compute_method'])
+})
 
 def get_amount(self, dunning):
 'Return fee amount and currency'



[tryton-commits] changeset in modules/marketing_email:default Send only the requi...

2022-04-08 Thread Nicolas Évrard
changeset 4748f746beed in modules/marketing_email:default
details: 
https://hg.tryton.org/modules/marketing_email?cmd=changeset=4748f746beed
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 marketing.py |  15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r 316f3153b310 -r 4748f746beed marketing.py
--- a/marketing.py  Wed Apr 06 23:37:42 2022 +0200
+++ b/marketing.py  Fri Apr 08 19:07:13 2022 +0200
@@ -314,22 +314,20 @@
 _states = {
 'readonly': Eval('state') != 'draft',
 }
-_depends = ['state']
 from_ = fields.Char(
-"From", states=_states, depends=_depends,
+"From", states=_states,
 help="Leave empty for the value defined in the configuration file.")
 list_ = fields.Many2One(
 'marketing.email.list', "List",
-required=True, states=_states, depends=_depends)
+required=True, states=_states)
 title = fields.Char(
-"Title", required=True, states=_states, depends=_depends)
+"Title", required=True, states=_states)
 content = fields.Text(
 "Content",
 states={
 'required': Eval('state') != 'draft',
 'readonly': _states['readonly'],
-},
-depends=['state'] + _depends)
+})
 urls = fields.One2Many(
 'web.shortened_url', 'record', "URLs", readonly=True)
 state = fields.Selection([
@@ -337,7 +335,7 @@
 ('sending', "Sending"),
 ('sent', "Sent"),
 ], "State", readonly=True, select=True, sort=False)
-del _states, _depends
+del _states
 
 @classmethod
 def __setup__(cls):
@@ -522,5 +520,4 @@
 'marketing.email', "E-Mail", required=True,
 domain=[
 ('list_', '=', Eval('list_')),
-],
-depends=['list_'])
+])



[tryton-commits] changeset in modules/notification_email:default Send only the re...

2022-04-08 Thread Nicolas Évrard
changeset 27903c92c2c3 in modules/notification_email:default
details: 
https://hg.tryton.org/modules/notification_email?cmd=changeset=27903c92c2c3
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 ir.py   |   3 +--
 notification.py |  11 +--
 2 files changed, 2 insertions(+), 12 deletions(-)

diffs (86 lines):

diff -r 03131d84632e -r 27903c92c2c3 ir.py
--- a/ir.py Wed Apr 06 23:37:43 2022 +0200
+++ b/ir.py Fri Apr 08 19:07:13 2022 +0200
@@ -13,8 +13,7 @@
 states={
 'required': Eval('notification_email_required', False),
 'invisible': ~Eval('notification_email_required', False),
-},
-depends=['notification_email_required'])
+})
 notification_email_required = fields.Function(
 fields.Boolean("Notification Email Required"),
 'on_change_with_notification_email_required')
diff -r 03131d84632e -r 27903c92c2c3 notification.py
--- a/notification.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/notification.py   Fri Apr 08 19:07:13 2022 +0200
@@ -43,7 +43,6 @@
 domain=[
 ('model.model', '=', Eval('model')),
 ],
-depends=['model'],
 help="The field that contains the recipient(s).")
 fallback_recipients = fields.Many2One(
 'res.user', "Recipients Fallback User",
@@ -53,14 +52,12 @@
 states={
 'invisible': ~Eval('recipients'),
 },
-depends=['recipients'],
 help="User notified when no recipients e-mail is found")
 recipients_secondary = fields.Many2One(
 'ir.model.field', "Secondary Recipients",
 domain=[
 ('model.model', '=', Eval('model')),
 ],
-depends=['model'],
 help="The field that contains the secondary recipient(s).")
 fallback_recipients_secondary = fields.Many2One(
 'res.user', "Secondary Recipients Fallback User",
@@ -70,14 +67,12 @@
 states={
 'invisible': ~Eval('recipients_secondary'),
 },
-depends=['recipients'],
 help="User notified when no secondary recipients e-mail is found")
 recipients_hidden = fields.Many2One(
 'ir.model.field', "Hidden Recipients",
 domain=[
 ('model.model', '=', Eval('model')),
 ],
-depends=['model'],
 help="The field that contains the hidden recipient(s).")
 fallback_recipients_hidden = fields.Many2One(
 'res.user', "Hidden Recipients Fallback User",
@@ -87,7 +82,6 @@
 states={
 'invisible': ~Eval('recipients_hidden'),
 },
-depends=['recipients_hidden'],
 help="User notified when no hidden recipients e-mail is found")
 
 contact_mechanism = fields.Selection(
@@ -104,13 +98,11 @@
 domain=[
 ('model', '=', Eval('model')),
 ],
-depends=['model'],
 help="The reports used as attachments.")
 
 triggers = fields.One2Many(
 'ir.trigger', 'notification_email', "Triggers",
 domain=[('model.model', '=', Eval('model'))],
-depends=['model'],
 help="Add a trigger for the notification.")
 send_after = fields.TimeDelta(
 "Send After",
@@ -346,8 +338,7 @@
 'ir.action.report', "Report", required=True,
 domain=[
 ('model', '=', Eval('model')),
-],
-depends=['model'])
+])
 
 model = fields.Function(fields.Char("Model"), 'get_model')
 



[tryton-commits] changeset in modules/incoterm:default Send only the required fie...

2022-04-08 Thread Nicolas Évrard
changeset e1cf976199ab in modules/incoterm:default
details: https://hg.tryton.org/modules/incoterm?cmd=changeset=e1cf976199ab
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 common.py |  14 +-
 party.py  |   4 ++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diffs (75 lines):

diff -r 2ce3e6a1e86d -r e1cf976199ab common.py
--- a/common.py Wed Apr 06 23:37:42 2022 +0200
+++ b/common.py Fri Apr 08 19:07:13 2022 +0200
@@ -26,11 +26,10 @@
 @classmethod
 def __setup__(cls):
 super().__setup__()
-readonly, depends = cls._incoterm_readonly_state()
+readonly = cls._incoterm_readonly_state()
 cls.incoterm.states = {
 'readonly': readonly,
 }
-cls.incoterm.depends = depends
 
 cls.incoterm_location.states = {
 'readonly': readonly,
@@ -40,16 +39,15 @@
 cls.incoterm_location.search_context = {
 'related_party': related_party,
 }
-cls.incoterm_location.depends = (
-depends + ['incoterm'] + related_party_depends)
+cls.incoterm_location.depends = {'incoterm'} | related_party_depends
 
 @classmethod
 def _incoterm_readonly_state(cls):
-return ~Eval('state').in_(['draft']), ['state']
+return ~Eval('state').in_(['draft'])
 
 @classmethod
 def _incoterm_related_party(cls):
-return Eval('party'), ['party']
+return Eval('party'), {'party'}
 
 @property
 def incoterm_name(self):
@@ -73,16 +71,14 @@
 @classmethod
 def __setup__(cls):
 super().__setup__()
-readonly, depends = cls._incoterm_readonly_state()
+readonly = cls._incoterm_readonly_state()
 cls.incoterm.domain = [
 If(~readonly,
 ('id', 'in', Eval('available_incoterms', [])),
 ()),
 ]
-cls.incoterm.depends += depends + ['available_incoterms']
 cls.incoterm_location.states['required'] = (
 Eval('incoterm_location_required', False))
-cls.incoterm_location.depends.append('incoterm_location_required')
 
 @fields.depends('company', 'party', methods=['_get_incoterm_pattern'])
 def on_change_with_available_incoterms(self, name=None):
diff -r 2ce3e6a1e86d -r e1cf976199ab party.py
--- a/party.py  Wed Apr 06 23:37:42 2022 +0200
+++ b/party.py  Fri Apr 08 19:07:13 2022 +0200
@@ -94,7 +94,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 company = fields.Many2One('company.company', "Company")
 type = fields.Selection([
 ('purchase', "Purchase"),
@@ -111,7 +111,7 @@
 ('party.distance', 'ASC NULLS LAST'),
 ('id', None),
 ],
-depends=['party'])
+depends={'party'})
 
 @classmethod
 def __setup__(cls):



[tryton-commits] changeset in modules/marketing_automation:default Send only the ...

2022-04-08 Thread Nicolas Évrard
changeset f6100aec8cb7 in modules/marketing_automation:default
details: 
https://hg.tryton.org/modules/marketing_automation?cmd=changeset=f6100aec8cb7
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (94 lines):

diff -r 2125544eb448 -r f6100aec8cb7 marketing_automation.py
--- a/marketing_automation.py   Wed Apr 06 23:37:42 2022 +0200
+++ b/marketing_automation.py   Fri Apr 08 19:07:13 2022 +0200
@@ -270,7 +270,6 @@
 states={
 'invisible': ~Eval('event'),
 },
-depends=['event'],
 help="Check to execute the activity "
 "if the event has not happened by the end of the delay.")
 on = fields.Function(fields.Selection([
@@ -291,7 +290,6 @@
 states={
 'required': Eval('negative', False),
 },
-depends=['negative'],
 help="After how much time the action should be executed.")
 
 action = fields.Selection([
@@ -304,7 +302,6 @@
 states={
 'invisible': Eval('action') != 'send_email',
 },
-depends=['action'],
 help="Leave empty to use the value defined in the configuration file.")
 email_title = fields.Char(
 "E-Mail Title",
@@ -313,7 +310,6 @@
 'invisible': Eval('action') != 'send_email',
 'required': Eval('action') == 'send_email',
 },
-depends=['action'],
 help="The subject of the email.\n"
 "The Genshi syntax can be used "
 "with 'record' in the evaluation context.")
@@ -324,7 +320,6 @@
 'invisible': Eval('action') != 'send_email',
 'required': Eval('action') == 'send_email',
 },
-depends=['action'],
 help="The HTML content of the E-mail.\n"
 "The Genshi syntax can be used "
 "with 'record' in the evaluation context.")
@@ -336,15 +331,14 @@
 "E-Mails Opened",
 states={
 'invisible': Eval('action') != 'send_email',
-},
-depends=['action']), 'get_record_count')
+}), 'get_record_count')
 email_clicked = fields.Function(
 fields.Integer(
 "E-Mails Clicked",
 states={
 'invisible': Eval('action') != 'send_email',
-},
-depends=['action']), 'get_record_count')
+}),
+'get_record_count')
 
 @classmethod
 def __setup__(cls):
@@ -359,7 +353,6 @@
 [(name, 'in', events + [None])],
 domain)
 field.domain = [domain]
-field.depends = ['parent_action']
 
 @classmethod
 def view_attributes(cls):
@@ -736,20 +729,17 @@
 "At",
 states={
 'readonly': Eval('state') != 'waiting',
-},
-depends=['state'])
+})
 email_opened = fields.Boolean(
 "E-Mail Opened",
 states={
 'invisible': Eval('activity_action') != 'send_email',
-},
-depends=['activity_action'])
+})
 email_clicked = fields.Boolean(
 "E-Mail Clicked",
 states={
 'invisible': Eval('activity_action') != 'send_email',
-},
-depends=['activity_action'])
+})
 state = fields.Selection([
 ('waiting', "Waiting"),
 ('done', "Done"),



[tryton-commits] changeset in modules/party:default Send only the required fields...

2022-04-08 Thread Nicolas Évrard
changeset b93652467c11 in modules/party:default
details: https://hg.tryton.org/modules/party?cmd=changeset=b93652467c11
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 address.py   |   9 +++--
 contact_mechanism.py |  14 +++---
 party.py |   4 
 3 files changed, 10 insertions(+), 17 deletions(-)

diffs (116 lines):

diff -r 94fd562eb13e -r b93652467c11 address.py
--- a/address.pyWed Apr 06 23:37:43 2022 +0200
+++ b/address.pyFri Apr 08 19:07:13 2022 +0200
@@ -28,8 +28,7 @@
 party = fields.Many2One('party.party', 'Party', required=True,
 ondelete='CASCADE', select=True, states={
 'readonly': Eval('id', 0) > 0,
-},
-depends=['id'])
+})
 party_name = fields.Char(
 "Party Name",
 help="If filled, replace the name of the party for address formatting")
@@ -54,8 +53,7 @@
 ('type', 'in', Eval('subdivision_types', [])),
 ()
 ),
-],
-depends=['country', 'subdivision_types'])
+])
 full_address = fields.Function(fields.Text('Full Address'),
 'get_full_address')
 identifiers = fields.One2Many(
@@ -63,8 +61,7 @@
 domain=[
 ('party', '=', Eval('party')),
 ('type', 'in', ['fr_siret']),
-],
-depends=['party'])
+])
 
 @classmethod
 def __setup__(cls):
diff -r 94fd562eb13e -r b93652467c11 contact_mechanism.py
--- a/contact_mechanism.py  Wed Apr 06 23:37:43 2022 +0200
+++ b/contact_mechanism.py  Fri Apr 08 19:07:13 2022 +0200
@@ -48,9 +48,9 @@
 type = fields.Selection(_TYPES, "Type", required=True, sort=False)
 value = fields.Char("Value", select=True,
 # Add all function fields to ensure to always fill them via on_change
-depends=[
+depends={
 'email', 'website', 'skype', 'sip', 'other_value',
-'value_compact'])
+'value_compact'})
 value_compact = fields.Char('Value Compact', readonly=True)
 name = fields.Char("Name")
 comment = fields.Text("Comment")
@@ -66,27 +66,27 @@
 email = fields.Function(fields.Char('E-Mail', states={
 'invisible': Eval('type') != 'email',
 'required': Eval('type') == 'email',
-}, depends=['value', 'type']),
+}, depends={'value'}),
 'get_value', setter='set_value')
 website = fields.Function(fields.Char('Website', states={
 'invisible': Eval('type') != 'website',
 'required': Eval('type') == 'website',
-}, depends=['value', 'type']),
+}, depends={'value'}),
 'get_value', setter='set_value')
 skype = fields.Function(fields.Char('Skype', states={
 'invisible': Eval('type') != 'skype',
 'required': Eval('type') == 'skype',
-}, depends=['value', 'type']),
+}, depends={'value'}),
 'get_value', setter='set_value')
 sip = fields.Function(fields.Char('SIP', states={
 'invisible': Eval('type') != 'sip',
 'required': Eval('type') == 'sip',
-}, depends=['value', 'type']),
+}, depends={'value'}),
 'get_value', setter='set_value')
 other_value = fields.Function(fields.Char('Value', states={
 'invisible': Eval('type').in_(['email', 'website', 'skype', 'sip']),
 'required': ~Eval('type').in_(['email', 'website']),
-}, depends=['value', 'type']),
+}, depends={'value'}),
 'get_value', setter='set_value')
 url = fields.Function(fields.Char('URL', states={
 'invisible': ~Eval('url'),
diff -r 94fd562eb13e -r b93652467c11 party.py
--- a/party.py  Wed Apr 06 23:37:43 2022 +0200
+++ b/party.py  Fri Apr 08 19:07:13 2022 +0200
@@ -39,7 +39,6 @@
 states={
 'readonly': Eval('code_readonly', True),
 },
-depends=['code_readonly'],
 help="The unique identifier of the party.")
 code_readonly = fields.Function(fields.Boolean('Code Readonly'),
 'get_code_readonly')
@@ -98,7 +97,6 @@
 cls.active.states.update({
 'readonly': Bool(Eval('replaced_by')),
 })
-cls.active.depends.append('replaced_by')
 
 @classmethod
 def __register__(cls, module_name):
@@ -627,7 +625,6 @@
 domain=[
 ('party', '=', Eval('party', -1)),
 ],
-depends=['party', 'type_address'],
 help="The address identified by this record.")
 type = fields.Selection('get_types', 'Type')
 type_string = type.translated('type')
@@ -893,7 +890,6 @@
 domain=[
 ('id', '!=', Eval('source', -1)),
 ],
-depends=['source'],
 help="The party that replaces.")
 
 @classmethod



[tryton-commits] changeset in modules/product:default Send only the required fiel...

2022-04-08 Thread Nicolas Évrard
changeset b0e8f1a28f68 in modules/product:default
details: https://hg.tryton.org/modules/product?cmd=changeset=b0e8f1a28f68
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 product.py |  16 
 uom.py |   1 -
 2 files changed, 4 insertions(+), 13 deletions(-)

diffs (98 lines):

diff -r 5a9354b2ed88 -r b0e8f1a28f68 product.py
--- a/product.pyWed Apr 06 23:37:43 2022 +0200
+++ b/product.pyFri Apr 08 19:07:13 2022 +0200
@@ -63,14 +63,12 @@
 "Code", select=True,
 states={
 'readonly': Eval('code_readonly', False),
-},
-depends=['code_readonly'])
+})
 type = fields.Selection(TYPES, "Type", required=True)
 consumable = fields.Boolean('Consumable',
 states={
 'invisible': Eval('type', 'goods') != 'goods',
 },
-depends=['type'],
 help="Check to allow stock moves to be assigned "
 "regardless of stock level.")
 list_price = fields.MultiValue(fields.Numeric(
@@ -114,7 +112,6 @@
 domain=[
 If(~Eval('active'), ('active', '=', False), ()),
 ],
-depends=['active'],
 help="The different variants the product comes in.")
 
 @classmethod
@@ -138,7 +135,6 @@
 cls.cost_price_method.domain = [
 Get(types_cost_method, Eval('type'), []),
 ]
-cls.cost_price_method.depends = ['type']
 
 @classmethod
 def _cost_price_method_domain_per_type(cls):
@@ -339,7 +335,6 @@
 domain=[
 If(Eval('active'), ('active', '=', True), ()),
 ],
-depends=['active'],
 help="The product that defines the common properties "
 "inherited by the variant.")
 code_readonly = fields.Function(fields.Boolean('Code Readonly'),
@@ -355,7 +350,6 @@
 states={
 'readonly': Eval('code_readonly', False),
 },
-depends=['code_readonly'],
 help="The unique identifier for the product (aka SKU).")
 code = fields.Char("Code", readonly=True, select=True,
 help="A unique identifier for the variant.")
@@ -414,8 +408,6 @@
 tfield.states['invisible'] |= invisible_state
 else:
 tfield.states['invisible'] = invisible_state
-if 'template' not in tfield.depends:
-tfield.depends.append('template')
 setattr(cls, attr, TemplateFunction(tfield))
 order_method = getattr(cls, 'order_%s' % attr, None)
 if (not order_method
@@ -634,7 +626,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 list_price = fields.Numeric("List Price", digits=price_digits)
 
 @classmethod
@@ -669,7 +661,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 cost_price_method = fields.Selection(
 'get_cost_price_methods', "Cost Price Method")
 
@@ -729,7 +721,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 cost_price = fields.Numeric(
 "Cost Price", required=True, digits=price_digits)
 
diff -r 5a9354b2ed88 -r b0e8f1a28f68 uom.py
--- a/uom.pyWed Apr 06 23:37:43 2022 +0200
+++ b/uom.pyFri Apr 08 19:07:13 2022 +0200
@@ -57,7 +57,6 @@
 domain=[
 ('rounding', '>', 0),
 ],
-depends=['digits'],
 help="The accuracy to which values are rounded.")
 digits = fields.Integer(
 "Display Digits", required=True,



[tryton-commits] changeset in modules/product_attribute:default Send only the req...

2022-04-08 Thread Nicolas Évrard
changeset 33b77d7d8950 in modules/product_attribute:default
details: 
https://hg.tryton.org/modules/product_attribute?cmd=changeset=33b77d7d8950
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (20 lines):

diff -r eb616b953a46 -r 33b77d7d8950 product.py
--- a/product.pyWed Apr 06 23:37:43 2022 +0200
+++ b/product.pyFri Apr 08 19:07:13 2022 +0200
@@ -50,14 +50,13 @@
 'readonly': (~Eval('attribute_set')
 & ~Eval('_parent_template', {}).get('attribute_set')),
 },
-depends=['attribute_set', 'template'],
+depends={'template'},
 help="Add attributes to the variant.")
 attributes_name = fields.Function(fields.Char(
 "Attributes Name",
 states={
 'invisible': ~Eval('attribute_set'),
-},
-depends=['attribute_set']),
+}),
 'on_change_with_attributes_name')
 
 @fields.depends('attribute_set', 'attributes')



[tryton-commits] changeset in modules/sale_gift_card:default Send only the requir...

2022-04-08 Thread Nicolas Évrard
changeset 8a8af20ea329 in modules/sale_gift_card:default
details: 
https://hg.tryton.org/modules/sale_gift_card?cmd=changeset=8a8af20ea329
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 account.py |   9 +++--
 product.py |   3 +--
 sale.py|  24 
 stock.py   |   4 +---
 4 files changed, 13 insertions(+), 27 deletions(-)

diffs (141 lines):

diff -r 92e0d5732427 -r 8a8af20ea329 account.py
--- a/account.pyWed Apr 06 23:37:43 2022 +0200
+++ b/account.pyFri Apr 08 19:07:14 2022 +0200
@@ -42,16 +42,14 @@
 ('type.gift_card', '=', True),
 ('closed', '!=', True),
 ('company', '=', Eval('company', -1)),
-],
-depends=['company'])
+])
 gift_card_account_revenue = fields.Many2One(
 'account.account', "Gift Card Revenue",
 domain=[
 ('type.gift_card', '=', True),
 ('closed', '!=', True),
 ('company', '=', Eval('company', -1)),
-],
-depends=['company'])
+])
 
 
 def AccountTypeMixin(template=False):
@@ -66,8 +64,7 @@
 ],
 states={
 'invisible': Eval('statement') != 'balance',
-},
-depends=['statement'])
+})
 if not template:
 for fname in dir(Mixin):
 field = getattr(Mixin, fname)
diff -r 92e0d5732427 -r 8a8af20ea329 product.py
--- a/product.pyWed Apr 06 23:37:43 2022 +0200
+++ b/product.pyFri Apr 08 19:07:14 2022 +0200
@@ -16,8 +16,7 @@
 "Gift Card",
 states={
 'invisible': ~Eval('type').in_(['service', 'goods']),
-},
-depends=['type'])
+})
 
 @fields.depends('gift_card')
 def on_change_gift_card(self):
diff -r 92e0d5732427 -r 8a8af20ea329 sale.py
--- a/sale.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/sale.py   Fri Apr 08 19:07:14 2022 +0200
@@ -47,8 +47,7 @@
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=', Id(
 'sale_gift_card', 'sequence_type_gift_card')),
-],
-depends=['company'])
+])
 
 
 class GiftCard(ModelSQL, ModelView):
@@ -59,13 +58,11 @@
 _states = {
 'readonly': Bool(Eval('origin')) | Bool(Eval('spent_on')),
 }
-_depends = ['origin']
 
 number = fields.Char(
-"Number", required=True, states=_states, depends=_depends)
+"Number", required=True, states=_states)
 company = fields.Many2One(
-'company.company', "Company", required=True,
-states=_states, depends=_depends)
+'company.company', "Company", required=True, states=_states)
 product = fields.Many2One(
 'product.product', "Product", required=True,
 domain=[
@@ -74,13 +71,12 @@
 context={
 'company': Eval('company', -1),
 },
-states=_states, depends=_depends + ['company'])
+states=_states, depends={'company'})
 value = Monetary(
 "Value", currency='currency', digits='currency', required=True,
-states=_states, depends=_depends)
+states=_states)
 currency = fields.Many2One(
-'currency.currency', "Currency", required=True,
-states=_states, depends=_depends)
+'currency.currency', "Currency", required=True, states=_states)
 
 origin = fields.Reference(
 "Origin", selection='get_origin', select=True, readonly=True)
@@ -88,7 +84,6 @@
 "Spent On", selection='get_spent_on', select=True, readonly=True)
 
 del _states
-del _depends
 
 @classmethod
 def __setup__(cls):
@@ -269,8 +264,7 @@
 ],
 states={
 'readonly': Eval('state') != 'draft',
-},
-depends=['state', 'company', 'currency'])
+})
 
 @classmethod
 @ModelView.button
@@ -339,8 +333,7 @@
 ],
 states={
 'readonly': Eval('state') != 'draft',
-},
-depends=['state', 'company', 'currency'])
+})
 
 @fields.depends('state', 'gift_cards')
 def on_change_with_total(self, name=None):
@@ -410,7 +403,6 @@
 states={
 'invisible': ~Eval('is_gift_card_service', False),
 },
-depends=['is_gift_card_service'],
 help="Leave empty for the customer email.")
 
 @fields.depends('product')
diff -r 92e0d5732427 -r 8a8af20ea329 stock.py
--- a/stock.py  Wed Apr 06 23:37:43 2022 +0200
+++ b/stock.py  Fri Apr 08 19:07:14 2022 +0200
@@ -29,9 +29,7 @@
 & (Eval('state') == 'done')),
 'readonly': Eval('state').in_(['cancel', 'done']),
 },
-depends=[
-'gift_cards_required', 'internal_quantity', 'company', 'product',
-'state'])
+depends={'internal_quantity'})
  

[tryton-commits] changeset in modules/sale_extra:default Send only the required f...

2022-04-08 Thread Nicolas Évrard
changeset 5c6647fd6bd6 in modules/sale_extra:default
details: 
https://hg.tryton.org/modules/sale_extra?cmd=changeset=5c6647fd6bd6
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 sale.py |  12 
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (39 lines):

diff -r 951ff9252f4c -r 5c6647fd6bd6 sale.py
--- a/sale.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/sale.py   Fri Apr 08 19:07:14 2022 +0200
@@ -77,22 +77,19 @@
 datetime.date.max,
 Eval('end_date', datetime.date.max))),
 ('start_date', '=', None),
-],
-depends=['end_date'])
+])
 end_date = fields.Date('End Date',
 domain=['OR',
 ('end_date', '>=', If(~Eval('start_date', None),
 datetime.date.min,
 Eval('start_date', datetime.date.min))),
 ('end_date', '=', None),
-],
-depends=['start_date'])
+])
 price_list = fields.Many2One('product.price_list', 'Price List',
 ondelete='CASCADE',
 domain=[
 ('company', '=', Eval('company', -1)),
-],
-depends=['company'])
+])
 sale_amount = Monetary(
 "Sale Amount", currency='currency', digits='currency')
 currency = fields.Function(fields.Many2One(
@@ -209,8 +206,7 @@
 unit = fields.Many2One('product.uom', 'Unit', required=True,
 domain=[
 ('category', '=', Eval('product_uom_category', -1)),
-],
-depends=['product_uom_category'])
+])
 free = fields.Boolean('Free')
 currency = fields.Function(fields.Many2One(
 'currency.currency', "Currency"),



[tryton-commits] changeset in modules/sale_opportunity:default Send only the requ...

2022-04-08 Thread Nicolas Évrard
changeset 99aab2e7a1c3 in modules/sale_opportunity:default
details: 
https://hg.tryton.org/modules/sale_opportunity?cmd=changeset=99aab2e7a1c3
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 configuration.py |   3 +--
 opportunity.py   |  49 +++--
 2 files changed, 20 insertions(+), 32 deletions(-)

diffs (150 lines):

diff -r e9d3b5b04d3c -r 99aab2e7a1c3 configuration.py
--- a/configuration.py  Wed Apr 06 23:37:44 2022 +0200
+++ b/configuration.py  Fri Apr 08 19:07:14 2022 +0200
@@ -39,8 +39,7 @@
 ('company', 'in', [Eval('company', -1), None]),
 ('sequence_type', '=',
 Id('sale_opportunity', 'sequence_type_sale_opportunity')),
-],
-depends=['company'])
+])
 
 @classmethod
 def __register__(cls, module_name):
diff -r e9d3b5b04d3c -r 99aab2e7a1c3 opportunity.py
--- a/opportunity.pyWed Apr 06 23:37:44 2022 +0200
+++ b/opportunity.pyFri Apr 08 19:07:14 2022 +0200
@@ -33,12 +33,10 @@
 _states_start = {
 'readonly': Eval('state') != 'lead',
 }
-_depends_start = ['state']
 _states_stop = {
 'readonly': Eval('state').in_(
 ['converted', 'won', 'lost', 'cancelled']),
 }
-_depends_stop = ['state']
 
 number = fields.Char('Number', readonly=True, required=True, select=True)
 reference = fields.Char('Reference', select=True)
@@ -51,7 +49,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['state', 'company'])
+depends={'company'})
 contact = fields.Many2One(
 'party.contact_mechanism', "Contact",
 context={
@@ -63,7 +61,7 @@
 depends=['party', 'company'])
 address = fields.Many2One('party.address', 'Address',
 domain=[('party', '=', Eval('party'))],
-select=True, depends=['party', 'state'],
+select=True,
 states=_states_stop)
 company = fields.Many2One('company.company', 'Company', required=True,
 select=True,
@@ -73,38 +71,32 @@
 domain=[
 ('id', If(In('company', Eval('context', {})), '=', '!='),
 Get(Eval('context', {}), 'company', 0)),
-],
-depends=_depends_stop)
+])
 currency = fields.Function(fields.Many2One(
 'currency.currency', "Currency"),
 'on_change_with_currency')
 amount = Monetary(
 "Amount", currency='currency', digits='currency',
-states=_states_stop, depends=_depends_stop,
+states=_states_stop,
 help='Estimated revenue amount.')
 payment_term = fields.Many2One('account.invoice.payment_term',
 'Payment Term', states={
 'readonly': In(Eval('state'),
 ['converted', 'lost', 'cancelled']),
-},
-depends=['state'])
+})
 employee = fields.Many2One('company.employee', 'Employee',
 states={
 'readonly': _states_stop['readonly'],
 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
 },
-depends=['state', 'company'],
 domain=[('company', '=', Eval('company'))])
 start_date = fields.Date('Start Date', required=True, select=True,
-states=_states_start, depends=_depends_start)
-end_date = fields.Date('End Date', select=True,
-states=_states_stop, depends=_depends_stop)
-description = fields.Char('Description',
-states=_states_stop, depends=_depends_stop)
-comment = fields.Text('Comment', states=_states_stop,
-depends=_depends_stop)
+states=_states_start)
+end_date = fields.Date('End Date', select=True, states=_states_stop)
+description = fields.Char('Description', states=_states_stop)
+comment = fields.Text('Comment', states=_states_stop)
 lines = fields.One2Many('sale.opportunity.line', 'opportunity', 'Lines',
-states=_states_stop, depends=_depends_stop)
+states=_states_stop)
 conversion_probability = fields.Float('Conversion Probability',
 digits=(1, 4), required=True,
 domain=[
@@ -115,10 +107,10 @@
 'readonly': ~Eval('state').in_(
 ['opportunity', 'lead', 'converted']),
 },
-depends=['state'], help="Percentage between 0 and 100.")
+help="Percentage between 0 and 100.")
 lost_reason = fields.Text('Reason for loss', states={
 'invisible': Eval('state') != 'lost',
-}, depends=['state'])
+})
 sales = fields.One2Many('sale.sale', 'origin', 'Sales')
 
 converted_by = employee_field(
@@ -132,8 +124,8 @@
 ('cancelled', "Cancelled"),
 ], "State", required=True, select=True, sort=False, readonly=True)
 
-del _states_start, _depends_start
-del _states_stop, _depends_stop
+del _states_start

[tryton-commits] changeset in modules/sale_complaint:default Send only the requir...

2022-04-08 Thread Nicolas Évrard
changeset af86855d9ca3 in modules/sale_complaint:default
details: 
https://hg.tryton.org/modules/sale_complaint?cmd=changeset=af86855d9ca3
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 complaint.py |  43 +--
 sale.py  |   3 +--
 2 files changed, 18 insertions(+), 28 deletions(-)

diffs (162 lines):

diff -r 925eef105f9a -r af86855d9ca3 complaint.py
--- a/complaint.py  Wed Apr 06 23:37:43 2022 +0200
+++ b/complaint.py  Fri Apr 08 19:07:14 2022 +0200
@@ -33,26 +33,24 @@
 _states = {
 'readonly': Eval('state') != 'draft',
 }
-_depends = ['state']
 
 number = fields.Char('Number', readonly=True, select=True)
 reference = fields.Char('Reference', select=True)
-date = fields.Date('Date', states=_states, depends=_depends)
+date = fields.Date('Date', states=_states)
 customer = fields.Many2One(
 'party.party', "Customer", required=True, states=_states,
 context={
 'company': Eval('company', -1),
 },
-depends=_depends + ['company'])
+depends={'company'})
 address = fields.Many2One('party.address', 'Address',
 domain=[('party', '=', Eval('customer'))],
-states=_states, depends=_depends + ['customer'])
+states=_states)
 company = fields.Many2One('company.company', 'Company', required=True,
-states=_states, depends=_depends)
-employee = fields.Many2One('company.employee', 'Employee',
-states=_states, depends=_depends)
+states=_states)
+employee = fields.Many2One('company.employee', 'Employee', states=_states)
 type = fields.Many2One('sale.complaint.type', 'Type', required=True,
-states=_states, depends=_depends)
+states=_states)
 origin = fields.Reference('Origin', selection='get_origin',
 domain={
 'sale.sale': [
@@ -93,18 +91,18 @@
 | Bool(Eval('actions', [0]))),
 'required': Bool(Eval('origin_model')),
 },
-depends=['state', 'customer', 'origin_model', 'company'])
+depends={'origin_model'})
 origin_id = fields.Function(fields.Integer('Origin ID'),
 'on_change_with_origin_id')
 origin_model = fields.Function(fields.Char('Origin Model'),
 'on_change_with_origin_model')
-description = fields.Text('Description', states=_states, depends=_depends)
+description = fields.Text('Description', states=_states)
 actions = fields.One2Many('sale.complaint.action', 'complaint', 'Actions',
 states={
 'readonly': ((Eval('state') != 'draft')
 | (If(~Eval('origin_id', 0), 0, Eval('origin_id', 0)) <= 0)),
 },
-depends=['state', 'origin_model', 'origin_id'])
+depends={'origin_model'})
 state = fields.Selection([
 ('draft', 'Draft'),
 ('waiting', 'Waiting'),
@@ -345,18 +343,16 @@
 'readonly': ((Eval('complaint_state') != 'draft')
 | Bool(Eval('result'))),
 }
-_depends = ['complaint_state', 'result']
 _line_states = {
 'invisible': ~Eval('_parent_complaint', {}
 ).get('origin_model', 'sale.line').in_(
 ['sale.line', 'account.invoice.line']),
 'readonly': _states['readonly'],
 }
-_line_depends = _depends
 
 complaint = fields.Many2One(
 'sale.complaint', 'Complaint', required=True, ondelete='CASCADE',
-states=_states, depends=_depends)
+states=_states)
 action = fields.Selection([
 ('sale_return', 'Create Sale Return'),
 ('credit_note', 'Create Credit Note'),
@@ -369,7 +365,6 @@
 ).get('origin_model', 'sale.sale') != 'sale.sale',
 'readonly': _states['readonly'],
 },
-depends=_depends,
 help='Leave empty for all lines.')
 
 invoice_lines = fields.One2Many(
@@ -381,19 +376,18 @@
 ) != 'account.invoice',
 'readonly': _states['readonly'],
 },
-depends=_depends,
 help='Leave empty for all lines.')
 
 quantity = fields.Float(
 "Quantity", digits='unit',
-states=_line_states, depends=_line_depends,
+states=_line_states,
 help='Leave empty for the same quantity.')
 unit = fields.Function(fields.Many2One('product.uom', 'Unit',
-states=_line_states, depends=_line_depends),
+states=_line_states),
 'on_change_with_unit')
 unit_price = Monetary(
 "Unit Price", currency='currency', digits=price_digits,
-states=_line_states, depends=_line_depends,
+states=_line_states,
 help='Leave empty for the same price.')
 
 amount = fields.Function(Monetary(
@@ -616,17 +610,16 @@
 (Eval('complaint_state') != 'draft')
 | 

[tryton-commits] changeset in modules/sale_discount:default Send only the require...

2022-04-08 Thread Nicolas Évrard
changeset 10791a811f3d in modules/sale_discount:default
details: 
https://hg.tryton.org/modules/sale_discount?cmd=changeset=10791a811f3d
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 sale.py |  9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 2cb83036371a -r 10791a811f3d sale.py
--- a/sale.py   Wed Apr 06 23:37:43 2022 +0200
+++ b/sale.py   Fri Apr 08 19:07:14 2022 +0200
@@ -17,24 +17,21 @@
 states={
 'invisible': Eval('type') != 'line',
 'readonly': Eval('sale_state') != 'draft',
-},
-depends=['type', 'sale_state'])
+})
 
 discount_rate = fields.Function(fields.Numeric(
 "Discount Rate", digits=(16, 4),
 states={
 'invisible': Eval('type') != 'line',
 'readonly': Eval('sale_state') != 'draft',
-},
-depends=['type', 'sale_state']),
+}),
 'on_change_with_discount_rate', setter='set_discount_rate')
 discount_amount = fields.Function(Monetary(
 "Discount Amount", currency='currency', digits=price_digits,
 states={
 'invisible': Eval('type') != 'line',
 'readonly': Eval('sale_state') != 'draft',
-},
-depends=['type', 'sale_state']),
+}),
 'on_change_with_discount_amount', setter='set_discount_amount')
 
 discount = fields.Function(fields.Char(



[tryton-commits] changeset in trytond:default Send only the required fields when ...

2022-04-08 Thread Nicolas Évrard
changeset 4ceb8ad07bd5 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=4ceb8ad07bd5
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 CHANGELOG |   3 +++
 doc/ref/fields.rst|  17 -
 trytond/ir/email_.py  |   2 +-
 trytond/model/active.py   |   2 --
 trytond/model/fields/date.py  |  19 +--
 trytond/model/fields/field.py |  26 +++---
 trytond/model/fields/float.py |  22 +-
 trytond/model/fields/many2many.py |  19 ---
 trytond/model/fields/one2many.py  |  18 +++---
 trytond/model/fields/reference.py |  17 ++---
 trytond/model/modelstorage.py |   7 +++
 trytond/model/modelview.py|  24 ++--
 trytond/tests/modelview.py|  16 
 trytond/tests/modelview.xml   |  24 
 trytond/tests/test_modelview.py   |  22 ++
 trytond/tests/test_tryton.py  |  21 ++---
 16 files changed, 207 insertions(+), 52 deletions(-)

diffs (543 lines):

diff -r 7df5f88c1e60 -r 4ceb8ad07bd5 CHANGELOG
--- a/CHANGELOG Fri Apr 08 09:55:23 2022 +0200
+++ b/CHANGELOG Fri Apr 08 19:07:14 2022 +0200
@@ -1,3 +1,6 @@
+* Use a set for field's depends
+* Relax the constraint on a field's depends
+* Include only needed fields when fetching a view definition
 * Make warning check re-entrant
 * Manage DatabaseDataError in ModelSQL
 * Remove support for pysqlite2
diff -r 7df5f88c1e60 -r 4ceb8ad07bd5 doc/ref/fields.rst
--- a/doc/ref/fields.rstFri Apr 08 09:55:23 2022 +0200
+++ b/doc/ref/fields.rstFri Apr 08 19:07:14 2022 +0200
@@ -112,13 +112,28 @@
 
 .. attribute:: Field.depends
 
-   A list of field names on which the field depends.
+   A :py:class:`set` of extra field names on which the field depends.
 
This means that the client read also these fields even if they are not
defined on the view.
:attr:`Field.depends` is used for example to ensure that
:class:`~trytond.pyson.PYSON` statement could be evaluated.
 
+.. attribute:: Field.display_depends
+
+   A computed set of field names on which the field depends when being
+   displayed in a read only view.
+
+.. attribute:: Field.edition_depends
+
+   A computed set of field names on which the field depends when being
+   displayed in a writable view.
+
+.. attribute:: Field.validation_depends
+
+   A computed set of field names on which the field depends when being
+   validated.
+
 .. attribute:: Field.context
 
A dictionary which updates the current context for *relation field*.
diff -r 7df5f88c1e60 -r 4ceb8ad07bd5 trytond/ir/email_.py
--- a/trytond/ir/email_.py  Fri Apr 08 09:55:23 2022 +0200
+++ b/trytond/ir/email_.py  Fri Apr 08 19:07:14 2022 +0200
@@ -332,7 +332,7 @@
 ],
 ]
 ]
-field.depends.append('model')
+field.depends.add('model')
 cls.__rpc__.update({
 'get': RPC(instantiate=0),
 'get_default': RPC(),
diff -r 7df5f88c1e60 -r 4ceb8ad07bd5 trytond/model/active.py
--- a/trytond/model/active.py   Fri Apr 08 09:55:23 2022 +0200
+++ b/trytond/model/active.py   Fri Apr 08 19:07:14 2022 +0200
@@ -32,8 +32,6 @@
 field.states['readonly'] |= inactive
 else:
 field.states['readonly'] = inactive
-if 'active' not in field.depends:
-field.depends.append('active')
 
 if issubclass(cls, ModelView):
 for states in cls._buttons.values():
diff -r 7df5f88c1e60 -r 4ceb8ad07bd5 trytond/model/fields/date.py
--- a/trytond/model/fields/date.py  Fri Apr 08 09:55:23 2022 +0200
+++ b/trytond/model/fields/date.py  Fri Apr 08 19:07:14 2022 +0200
@@ -1,13 +1,14 @@
 # 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
+from functools import cached_property
 
 from sql.functions import AtTimeZone, Function
 
 from trytond import backend
-from trytond.pyson import PYSONEncoder
+from trytond.pyson import PYSON, PYSONEncoder
 
-from .field import Field
+from .field import Field, get_eval_fields
 
 
 class SQLite_Date(Function):
@@ -59,6 +60,20 @@
 definition['format'] = encoder.encode(self.format)
 return definition
 
+@cached_property
+def display_depends(self):
+depends = super().display_depends
+if isinstance(self.format, PYSON):
+depends |= get_eval_fields(self.format)
+return depends
+
+@cached_property
+def validation_depends(self):
+depends = super().display_depends
+if isinstance(self.format, PYSON):
+depends |= 

[tryton-commits] changeset in modules/web_shop_shopify:default Send only the requ...

2022-04-08 Thread Nicolas Évrard
changeset 9e0083eba168 in modules/web_shop_shopify:default
details: 
https://hg.tryton.org/modules/web_shop_shopify?cmd=changeset=9e0083eba168
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 product.py |  12 
 web.py |  19 +++
 2 files changed, 11 insertions(+), 20 deletions(-)

diffs (101 lines):

diff -r 631a1eb1c574 -r 9e0083eba168 product.py
--- a/product.pyWed Apr 06 23:37:45 2022 +0200
+++ b/product.pyFri Apr 08 19:07:14 2022 +0200
@@ -75,7 +75,7 @@
 'readonly': Bool(Eval('shopify_identifiers', [-1])),
 'invisible': ~Eval('salable', False),
 },
-depends=['default_uom_category', 'shopify_identifiers', 'salable'])
+depends={'default_uom_category'})
 
 @classmethod
 def __setup__(cls):
@@ -89,7 +89,6 @@
 ('category', 'in', [Eval(c, -1) for c in categories]),
 ('digits', '=', 0),
 ]
-cls.shopify_uom.depends.extend(categories)
 
 @classmethod
 def _shopify_uom_categories(cls):
@@ -471,8 +470,7 @@
 If(Eval('shopify_option3'),
 ('id', '!=', Eval('shopify_option3')),
 ()),
-],
-depends=['attributes', 'shopify_option2', 'shopify_option3'])
+])
 shopify_option2 = fields.Many2One(
 'product.attribute', "Option 2",
 domain=[
@@ -486,8 +484,7 @@
 ],
 states={
 'invisible': ~Eval('shopify_option1'),
-},
-depends=['attributes', 'shopify_option1', 'shopify_option3'])
+})
 shopify_option3 = fields.Many2One(
 'product.attribute', "Option 3",
 domain=[
@@ -501,8 +498,7 @@
 ],
 states={
 'invisible': ~Eval('shopify_option2'),
-},
-depends=['attributes', 'shopify_option1', 'shopify_option2'])
+})
 
 @classmethod
 def __setup__(cls):
diff -r 631a1eb1c574 -r 9e0083eba168 web.py
--- a/web.pyWed Apr 06 23:37:45 2022 +0200
+++ b/web.pyFri Apr 08 19:07:14 2022 +0200
@@ -32,32 +32,28 @@
 'required': Eval('type') == 'shopify',
 'invisible': Eval('type') != 'shopify',
 }
-_depends = ['type']
 
-shopify_url = fields.Char("Shop URL", states=_states, depends=_depends)
+shopify_url = fields.Char("Shop URL", states=_states)
 shopify_version = fields.Selection(
-'get_shopify_versions', "Version", states=_states, depends=_depends)
-shopify_password = fields.Char(
-"Password", states=_states, depends=_depends)
+'get_shopify_versions', "Version", states=_states)
+shopify_password = fields.Char("Password", states=_states)
 shopify_webhook_shared_secret = fields.Char(
 "Webhook Shared Secret",
 states={
 'invisible': _states['invisible'],
-},
-depends=_depends)
+})
 shopify_webhook_endpoint_order = fields.Function(
 fields.Char(
 "Webhook Order Endpoint",
 help="The URL to be called by Shopify for Order events."),
 'on_change_with_shopify_webhook_endpoint_order')
 shopify_warehouses = fields.One2Many(
-'web.shop-stock.location', 'shop', "Warehouses",
-states=_states, depends=_depends)
+'web.shop-stock.location', 'shop', "Warehouses", states=_states)
 shopify_payment_journals = fields.One2Many(
 'web.shop.shopify_payment_journal', 'shop', "Payment Journals",
-states=_states, depends=_depends)
+states=_states)
 
-del _states, _depends
+del _states
 
 @classmethod
 def __setup__(cls):
@@ -69,7 +65,6 @@
 field.states['invisible'] |= invisible
 else:
 field.states['invisible'] = invisible
-field.depends.append('type')
 
 @classmethod
 def get_shopify_versions(cls):



[tryton-commits] changeset in modules/web_shop:default Send only the required fie...

2022-04-08 Thread Nicolas Évrard
changeset 31883463311b in modules/web_shop:default
details: https://hg.tryton.org/modules/web_shop?cmd=changeset=31883463311b
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 product.py |   1 -
 sale.py|   3 +--
 web.py |  16 +++-
 3 files changed, 8 insertions(+), 12 deletions(-)

diffs (85 lines):

diff -r 895c459ace78 -r 31883463311b product.py
--- a/product.pyWed Apr 06 23:37:45 2022 +0200
+++ b/product.pyFri Apr 08 19:07:14 2022 +0200
@@ -25,7 +25,6 @@
 states={
 'invisible': ~Eval('salable'),
 },
-depends=['salable'],
 help="The list of web shops on which the product is published.")
 
 
diff -r 895c459ace78 -r 31883463311b sale.py
--- a/sale.py   Wed Apr 06 23:37:45 2022 +0200
+++ b/sale.py   Fri Apr 08 19:07:14 2022 +0200
@@ -21,8 +21,7 @@
 states={
 'required': Bool(Eval('web_shop')),
 'readonly': ~Eval('web_id'),
-},
-depends=['web_shop'])
+})
 
 @classmethod
 def __setup__(cls):
diff -r 895c459ace78 -r 31883463311b web.py
--- a/web.pyWed Apr 06 23:37:45 2022 +0200
+++ b/web.pyFri Apr 08 19:07:14 2022 +0200
@@ -69,7 +69,7 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'])
+depends={'company'})
 
 products = fields.Many2Many(
 'web.shop-product.product', 'shop', 'product', "Products",
@@ -79,14 +79,14 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'],
+depends={'company'},
 help="The list of products to publish.")
 products_removed = Many2ManyInactive(
 'web.shop-product.product', 'shop', 'product', "Products Removed",
 context={
 'company': Eval('company', -1),
 },
-depends=['company'],
+depends={'company'},
 help="The list of products to unpublish.")
 
 categories = fields.Many2Many(
@@ -94,14 +94,14 @@
 context={
 'company': Eval('company', -1),
 },
-depends=['company'],
+depends={'company'},
 help="The list of categories to publish.")
 categories_removed = Many2ManyInactive(
 'web.shop-product.category', 'shop', 'category', "Categories Removed",
 context={
 'company': Eval('company', -1),
 },
-depends=['company'],
+depends={'company'},
 help="The list of categories to unpublish.")
 
 _name_cache = Cache('web.shop.name', context=False)
@@ -325,12 +325,10 @@
 domain=['OR',
 ('party', '=', Eval('party', -1)),
 ('party', 'in', Eval('secondary_parties', [])),
-],
-depends=['party', 'secondary_parties'])
+])
 shipment_address = fields.Many2One(
 'party.address', "Shipment Address",
 domain=['OR',
 ('party', '=', Eval('party', -1)),
 ('party', 'in', Eval('secondary_parties', [])),
-],
-depends=['party', 'secondary_parties'])
+])



[tryton-commits] changeset in modules/web_shop_vue_storefront:default Send only t...

2022-04-08 Thread Nicolas Évrard
changeset 04573aa647ee in modules/web_shop_vue_storefront:default
details: 
https://hg.tryton.org/modules/web_shop_vue_storefront?cmd=changeset=04573aa647ee
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

 party.py |  3 +--
 web.py   |  6 ++
 2 files changed, 3 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 36f7c33e8c9a -r 04573aa647ee party.py
--- a/party.py  Wed Apr 06 23:37:45 2022 +0200
+++ b/party.py  Fri Apr 08 19:07:14 2022 +0200
@@ -36,8 +36,7 @@
 domain=[
 ('party', '=', Eval('party', -1)),
 ('type', 'in', ['phone', 'mobile']),
-],
-depends=['party'])
+])
 
 def get_vsf(self, for_party=None):
 if for_party and for_party != self.party:
diff -r 36f7c33e8c9a -r 04573aa647ee web.py
--- a/web.pyWed Apr 06 23:37:45 2022 +0200
+++ b/web.pyFri Apr 08 19:07:14 2022 +0200
@@ -82,15 +82,13 @@
 states={
 'required': Eval('type') == 'vsf',
 'invisible': Eval('type') != 'vsf',
-},
-depends=['type'])
+})
 vsf_elasticsearch_index = fields.Char(
 "Elasticsearch Index",
 states={
 'required': Eval('type') == 'vsf',
 'invisible': Eval('type') != 'vsf',
-},
-depends=['type'])
+})
 
 @classmethod
 def __setup__(cls):



[tryton-commits] changeset in modules/web_user:default Send only the required fie...

2022-04-08 Thread Nicolas Évrard
changeset 784cb76aff7a in modules/web_user:default
details: https://hg.tryton.org/modules/web_user?cmd=changeset=784cb76aff7a
description:
Send only the required fields when fetching a readonly view definition

issue11134
review380081002
diffstat:

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

diffs (13 lines):

diff -r 00d3db4a79c3 -r 784cb76aff7a user.py
--- a/user.py   Fri Apr 08 09:46:11 2022 +0200
+++ b/user.py   Fri Apr 08 19:07:14 2022 +0200
@@ -72,8 +72,7 @@
 email = fields.Char('E-mail', select=True,
 states={
 'required': Eval('active', True),
-},
-depends=['active'])
+})
 email_valid = fields.Boolean('E-mail Valid')
 email_token = fields.Char('E-mail Token', select=True)
 password_hash = fields.Char('Password Hash')



[tryton-commits] changeset in sao:default Support _write, _delete and _timestamp ...

2022-04-11 Thread Nicolas Évrard
changeset d55dcdf12d28 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset=d55dcdf12d28
description:
Support _write, _delete and _timestamp values when set from default 
value

issue11012
review372751002
diffstat:

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

diffs (16 lines):

diff -r 9efb7fa52876 -r d55dcdf12d28 src/model.js
--- a/src/model.js  Sun Apr 10 19:28:21 2022 +0200
+++ b/src/model.js  Mon Apr 11 12:48:41 2022 +0200
@@ -953,6 +953,12 @@
 var promises = [];
 var fieldnames = [];
 for (var fname in values) {
+if ((fname == '_write') ||
+(fname == '_delete') ||
+(fname == '_timestamp')) {
+this[fname] = values[fname];
+continue;
+}
 if (!values.hasOwnProperty(fname)) {
 continue;
 }



[tryton-commits] changeset in trytond:default Support _write, _delete and _timest...

2022-04-11 Thread Nicolas Évrard
changeset dec0a57b1d90 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=dec0a57b1d90
description:
Support _write, _delete and _timestamp values when set from default 
value

issue11012
review372751002
diffstat:

 doc/ref/models.rst |  5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 51164f435179 -r dec0a57b1d90 doc/ref/models.rst
--- a/doc/ref/models.rstSun Apr 10 19:10:14 2022 +0200
+++ b/doc/ref/models.rstMon Apr 11 12:48:41 2022 +0200
@@ -285,6 +285,11 @@
``.``.
The number of *dots* in the name is not limited.
 
+   The virtual fields ``_write`` and ``_delete`` can be used the read the
+   writeable and deleteable state of the records.
+   Regarding the ``_timestamp`` virtual fields it contains a timestamp that is
+   used in the context to make a soft lock preventing update collisions.
+
.. note::
   The order of the returned list is not guaranteed.
 



[tryton-commits] changeset in tryton:default Support _write, _delete and _timesta...

2022-04-11 Thread Nicolas Évrard
changeset a1dac30e2d70 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=a1dac30e2d70
description:
Support _write, _delete and _timestamp values when set from default 
value

issue11012
review372751002
diffstat:

 tryton/gui/window/view_form/model/record.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r 70dae4f35b49 -r a1dac30e2d70 tryton/gui/window/view_form/model/record.py
--- a/tryton/gui/window/view_form/model/record.py   Wed Apr 06 23:37:45 
2022 +0200
+++ b/tryton/gui/window/view_form/model/record.py   Mon Apr 11 12:48:41 
2022 +0200
@@ -427,6 +427,9 @@
 def set_default(self, val, signal=True, validate=True):
 fieldnames = []
 for fieldname, value in list(val.items()):
+if fieldname in {'_write', '_delete', '_timestamp'}:
+setattr(self, fieldname, value)
+continue
 if fieldname not in self.group.fields:
 continue
 if fieldname == self.group.exclude_field:



[tryton-commits] changeset in tryton:default Request a column size recomputation ...

2022-04-06 Thread Nicolas Évrard
changeset d415b76ceb89 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=d415b76ceb89
description:
Request a column size recomputation on treeview realization

issue11228
review370861002
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r 78a1a046d717 -r d415b76ceb89 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Mar 30 
19:20:31 2022 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Apr 06 
14:27:11 2022 +0200
@@ -50,12 +50,15 @@
 
 
 def realized(func):
-"Decorator for treeview realized"
+has_been_realized = False
+
 @wraps(func)
 def wrapper(self, *args, **kwargs):
-if (hasattr(self.view.treeview, 'get_realized')
-and not self.view.treeview.get_realized()):
-return
+nonlocal has_been_realized
+if not has_been_realized:
+has_been_realized = self.view.treeview.get_realized()
+if has_been_realized:
+self.view.treeview.queue_resize()
 return func(self, *args, **kwargs)
 return wrapper
 



[tryton-commits] changeset in tryton:default Use a file in the user directory for...

2022-04-11 Thread Nicolas Évrard
changeset e0688f8ac964 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=e0688f8ac964
description:
Use a file in the user directory for stdout and stderr on Windows

issue11390
review397911002
diffstat:

 CHANGELOG|   1 +
 bin/tryton   |   4 
 doc/usage.rst|   3 +++
 tryton/config.py |  12 +---
 4 files changed, 13 insertions(+), 7 deletions(-)

diffs (72 lines):

diff -r a1dac30e2d70 -r e0688f8ac964 CHANGELOG
--- a/CHANGELOG Mon Apr 11 12:48:41 2022 +0200
+++ b/CHANGELOG Mon Apr 11 16:37:34 2022 +0200
@@ -1,3 +1,4 @@
+* Add option to define logging output location
 * Remove TreeViewControl
 * Manage optional column
 * Default CSV encoding to UTF8 with BOM
diff -r a1dac30e2d70 -r e0688f8ac964 bin/tryton
--- a/bin/trytonMon Apr 11 12:48:41 2022 +0200
+++ b/bin/trytonMon Apr 11 16:37:34 2022 +0200
@@ -11,10 +11,6 @@
 pass
 
 if hasattr(sys, 'frozen'):
-if not ('-v' in sys.argv or '--verbose' in sys.argv or
-'-l' in sys.argv or '--log-level' in sys.argv):
-sys.stdout = open(os.devnull, 'w')
-sys.stderr = open(os.devnull, 'w')
 prefix = os.path.dirname(sys.executable)
 os.environ['GTK_EXE_PREFIX'] = prefix
 os.environ['GTK_DATA_PREFIX'] = prefix
diff -r a1dac30e2d70 -r e0688f8ac964 doc/usage.rst
--- a/doc/usage.rst Mon Apr 11 12:48:41 2022 +0200
+++ b/doc/usage.rst Mon Apr 11 16:37:34 2022 +0200
@@ -38,6 +38,9 @@
 -l LOG_LEVEL, --log-level=LOG_LEVEL  Specify the log level: DEBUG, INFO,
  WARNING, ERROR, CRITICAL
 
+-o LOG_OUTPUT, --log-ouput=LOG_OUTPUT Specify the file used to output logging
+  information
+
 -u LOGIN, --user=LOGIN   Specify the login user
 
 -s SERVER, --server=SERVER   Specify the server hostname:port
diff -r a1dac30e2d70 -r e0688f8ac964 tryton/config.py
--- a/tryton/config.py  Mon Apr 11 12:48:41 2022 +0200
+++ b/tryton/config.py  Mon Apr 11 16:37:34 2022 +0200
@@ -84,6 +84,8 @@
 parser.add_option("-l", "--log-level", dest="log_level",
 help=_("specify the log level: "
 "DEBUG, INFO, WARNING, ERROR, CRITICAL"))
+parser.add_option("-o", "--log-ouput", dest="log_output", default=None,
+help=_("specify the file used to output logging information"))
 parser.add_option("-u", "--user", dest="login",
 help=_("specify the login user"))
 parser.add_option("-s", "--server", dest="host",
@@ -93,8 +95,10 @@
 get_config_dir(), 'tryton.conf')
 self.load()
 
-self.options['dev'] = opt.dev
-logging.basicConfig()
+logging_config = {}
+if opt.log_output:
+logging_config['filename'] = opt.log_output
+
 loglevels = {
 'DEBUG': logging.DEBUG,
 'INFO': logging.INFO,
@@ -107,8 +111,10 @@
 opt.log_level = 'INFO'
 else:
 opt.log_level = 'ERROR'
-logging.getLogger().setLevel(loglevels[opt.log_level.upper()])
+logging_config['level'] = loglevels[opt.log_level.upper()]
+logging.basicConfig(**logging_config)
 
+self.options['dev'] = opt.dev
 for arg in ['login', 'host']:
 if getattr(opt, arg):
 self.options['login.' + arg] = getattr(opt, arg)



[tryton-commits] changeset in modules/account:default Add delegated amount on lin...

2022-04-11 Thread Nicolas Évrard
changeset 56e9b82a66f1 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset=56e9b82a66f1
description:
Add delegated amount on lines to pay

issue10345
review346191002
diffstat:

 CHANGELOG  |   1 +
 move.py|  21 +
 tests/scenario_move_line_group.rst |  11 +++
 view/move_line_form.xml|   3 +++
 view/move_line_tree.xml|   1 +
 5 files changed, 37 insertions(+), 0 deletions(-)

diffs (97 lines):

diff -r 9307e7841f70 -r 56e9b82a66f1 CHANGELOG
--- a/CHANGELOG Sun Apr 10 19:11:37 2022 +0200
+++ b/CHANGELOG Mon Apr 11 19:19:54 2022 +0200
@@ -1,3 +1,4 @@
+* Add delegated amount on move lines
 * Enforce same type for children account as their parent
 * Show debit / credit columns in ledgers when they contain lines
 * Count number of lines in Account and General Ledger
diff -r 9307e7841f70 -r 56e9b82a66f1 move.py
--- a/move.py   Sun Apr 10 19:11:37 2022 +0200
+++ b/move.py   Mon Apr 11 19:19:54 2022 +0200
@@ -841,6 +841,13 @@
 'get_amount')
 amount_currency = fields.Function(fields.Many2One('currency.currency',
 'Amount Currency'), 'get_amount_currency')
+delegated_amount = fields.Function(Monetary(
+"Delegated Amount",
+currency='amount_currency', digits='amount_currency',
+states={
+'invisible': ~Eval('reconciliation', False),
+}),
+'get_delegated_amount')
 
 del _states
 
@@ -1035,6 +1042,20 @@
 order_move_origin = MoveLineMixin._order_move_field('origin')
 order_move_state = MoveLineMixin._order_move_field('state')
 
+def get_delegated_amount(self, name):
+def final_delegated_line(line):
+if not line.reconciliation or not line.reconciliation.delegate_to:
+return line
+return final_delegated_line(line.reconciliation.delegate_to)
+
+final_delegation = final_delegated_line(self)
+if final_delegation == self:
+return None
+elif final_delegation.reconciliation:
+return final_delegation.amount_currency.round(0)
+else:
+return final_delegation.amount
+
 @classmethod
 def query_get(cls, table):
 '''
diff -r 9307e7841f70 -r 56e9b82a66f1 tests/scenario_move_line_group.rst
--- a/tests/scenario_move_line_group.rstSun Apr 10 19:11:37 2022 +0200
+++ b/tests/scenario_move_line_group.rstMon Apr 11 19:19:54 2022 +0200
@@ -117,6 +117,14 @@
 >>> payable.balance, payable.amount_second_currency
 (Decimal('0.00'), Decimal('0.00'))
 
+>>> delegated_line1, delegated_line2 = lines
+>>> delegated_line1.reload()
+>>> delegated_line2.reload()
+>>> delegated_line1.delegated_amount
+Decimal('45')
+>>> delegated_line2.delegated_amount
+Decimal('45')
+
 >>> Reconciliation = Model.get('account.move.reconciliation')
 >>> reconciliations = Reconciliation.find([])
 >>> len(reconciliations)
@@ -151,3 +159,6 @@
>>> cancel.execute('cancel')
>>> Reconciliation.find([('id', '=', reconciliations[0].id)])
[]
+
+   >>> delegated_line1.reload()
+   >>> delegated_line1.delegated_amount
diff -r 9307e7841f70 -r 56e9b82a66f1 view/move_line_form.xml
--- a/view/move_line_form.xml   Sun Apr 10 19:11:37 2022 +0200
+++ b/view/move_line_form.xml   Mon Apr 11 19:19:54 2022 +0200
@@ -34,8 +34,11 @@
 
 
 
+
 
 
+
+
 
 
 
diff -r 9307e7841f70 -r 56e9b82a66f1 view/move_line_tree.xml
--- a/view/move_line_tree.xml   Sun Apr 10 19:11:37 2022 +0200
+++ b/view/move_line_tree.xml   Mon Apr 11 19:19:54 2022 +0200
@@ -11,6 +11,7 @@
 
 
 
+
 
 
 



[tryton-commits] changeset in modules/account_move_line_grouping:default Add dele...

2022-04-11 Thread Nicolas Évrard
changeset 943412699dfe in modules/account_move_line_grouping:default
details: 
https://hg.tryton.org/modules/account_move_line_grouping?cmd=changeset=943412699dfe
description:
Add delegated amount on lines to pay

issue10345
review346191002
diffstat:

 CHANGELOG |   1 +
 account.py|  16 +++-
 tests/scenario_account_move_line_grouping.rst |   5 -
 view/move_line_group_form.xml |   2 ++
 4 files changed, 22 insertions(+), 2 deletions(-)

diffs (87 lines):

diff -r 48a4abb19462 -r 943412699dfe CHANGELOG
--- a/CHANGELOG Sun Apr 10 19:11:37 2022 +0200
+++ b/CHANGELOG Mon Apr 11 19:19:54 2022 +0200
@@ -1,3 +1,4 @@
+* Add delegated amount on move lines
 * Add support for Python 3.10
 * Remove support for Python 3.6
 
diff -r 48a4abb19462 -r 943412699dfe account.py
--- a/account.pySun Apr 10 19:11:37 2022 +0200
+++ b/account.pyMon Apr 11 19:19:54 2022 +0200
@@ -1,7 +1,7 @@
 # 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 sql import Literal, Null, Select, Window
-from sql.aggregate import BoolAnd, Min, Sum
+from sql.aggregate import BoolAnd, BoolOr, Min, Sum
 from sql.functions import CurrentTimestamp, FirstValue
 
 from trytond.model import ModelSQL, ModelView, fields
@@ -47,7 +47,16 @@
 'get_amount')
 amount_currency = fields.Function(fields.Many2One(
 'currency.currency', "Amount Currency"), 'get_amount_currency')
+delegated_amount = fields.Function(Monetary(
+"Delegated Amount",
+currency='amount_currency', digits='amount_currency',
+states={
+'invisible': ~Eval('partially_reconciled', False),
+}),
+'get_delegated_amount')
 
+partially_reconciled = fields.Boolean(
+"Partially Reconciled", readonly=True)
 reconciled = fields.Boolean("Reconciled", readonly=True)
 amount_reconciled = Monetary(
 "Amount Reconciled",
@@ -136,6 +145,7 @@
 Sum(line.debit).as_('debit'),
 Sum(line.credit).as_('credit'),
 Sum(line.amount_second_currency).as_('amount_second_currency'),
+BoolOr(line.reconciliation != Null).as_('partially_reconciled'),
 BoolAnd(line.reconciliation != Null).as_('reconciled'),
 Sum(
 line.debit + line.credit,
@@ -153,6 +163,10 @@
 if self.account:
 return self.account.currency.id
 
+def get_delegated_amount(self, name):
+return self.amount_currency.round(
+sum(l.delegated_amount for l in self.lines if l.delegated_amount))
+
 
 class MoveLineGroup_MoveLine(ModelSQL):
 "Account Move Line Group - Move Line"
diff -r 48a4abb19462 -r 943412699dfe 
tests/scenario_account_move_line_grouping.rst
--- a/tests/scenario_account_move_line_grouping.rst Sun Apr 10 19:11:37 
2022 +0200
+++ b/tests/scenario_account_move_line_grouping.rst Mon Apr 11 19:19:54 
2022 +0200
@@ -109,6 +109,10 @@
 ... ])
 >>> line.amount_reconciled == Decimal(22)
 True
+>>> line.partially_reconciled
+True
+>>> line.delegated_amount
+Decimal('0.00')
 >>> if backend.name != 'sqlite':
 ... len(line.lines)
 ... else:
@@ -125,4 +129,3 @@
 ... else:
 ... 1
 1
-
diff -r 48a4abb19462 -r 943412699dfe view/move_line_group_form.xml
--- a/view/move_line_group_form.xml Sun Apr 10 19:11:37 2022 +0200
+++ b/view/move_line_group_form.xml Mon Apr 11 19:19:54 2022 +0200
@@ -40,6 +40,8 @@
 
 
 
+
+
 
 
 



[tryton-commits] changeset in modules/account_invoice:default Add delegated amoun...

2022-04-11 Thread Nicolas Évrard
changeset 69d87d4691ea in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset=69d87d4691ea
description:
Add delegated amount on lines to pay

issue10345
review346191002
diffstat:

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

diffs (11 lines):

diff -r 8c118af9986c -r 69d87d4691ea view/move_line_list_to_pay.xml
--- a/view/move_line_list_to_pay.xmlSun Apr 10 19:11:37 2022 +0200
+++ b/view/move_line_list_to_pay.xmlMon Apr 11 19:19:54 2022 +0200
@@ -5,5 +5,6 @@
 
 
 
-
+
+
 



[tryton-commits] changeset in tryton:default Remove extra operator when simplifyi...

2022-04-14 Thread Nicolas Évrard
changeset 0a6285f33c2f in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=0a6285f33c2f
description:
Remove extra operator when simplifying nested domains

issue11406
review390621002
diffstat:

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

diffs (20 lines):

diff -r 7a9ef1e1db52 -r 0a6285f33c2f tryton/common/domain_inversion.py
--- a/tryton/common/domain_inversion.py Mon Apr 11 23:41:21 2022 +0200
+++ b/tryton/common/domain_inversion.py Thu Apr 14 10:21:54 2022 +0200
@@ -307,9 +307,14 @@
 domain_op = bool_operator(domain)
 for branch in domain:
 simplified_branch = simplify_nested(branch)
-if (bool_operator(branch) == domain_op
+if (bool_operator(simplified_branch) == domain_op
 or len(simplified_branch) == 1):
-simplified.extend(simplified_branch)
+if (simplified
+and simplified_branch
+and simplified_branch[0] in ['AND', 'OR']):
+simplified.extend(simplified_branch[1:])
+else:
+simplified.extend(simplified_branch)
 else:
 simplified.append(simplified_branch)
 return simplified



[tryton-commits] changeset in sao:default Remove extra operator when simplifying ...

2022-04-14 Thread Nicolas Évrard
changeset f71d57b75ee9 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset=f71d57b75ee9
description:
Remove extra operator when simplifying nested domains

issue11406
review390621002
diffstat:

 src/common.js |  15 +++
 tests/sao.js  |   3 +++
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r ad6e506af3ac -r f71d57b75ee9 src/common.js
--- a/src/common.js Wed Apr 13 19:07:40 2022 +0200
+++ b/src/common.js Thu Apr 14 10:21:53 2022 +0200
@@ -2574,12 +2574,19 @@
 return this.simplify_nested(domain[0]);
 } else {
 var simplified = [];
-var domain_op = this._bool_operator(domain);
 for (var branch of domain) {
 var simplified_branch = this.simplify_nested(branch);
-if ((this._bool_operator(branch) == domain_op) ||
-(simplified_branch.length == 1)) {
-simplified.push(...simplified_branch);
+if ((this._bool_operator(simplified_branch) ==
+this._bool_operator(simplified)) ||
+(simplified_branch.length == 1)) {
+if ((simplified.length > 0) &&
+(simplified_branch.length > 0) &&
+((simplified_branch[0] == 'AND') ||
+(simplified_branch[0] == 'OR'))) {
+simplified.push(...simplified_branch.slice(1));
+} else {
+simplified.push(...simplified_branch);
+}
 } else {
 simplified.push(simplified_branch);
 }
diff -r ad6e506af3ac -r f71d57b75ee9 tests/sao.js
--- a/tests/sao.js  Wed Apr 13 19:07:40 2022 +0200
+++ b/tests/sao.js  Thu Apr 14 10:21:53 2022 +0200
@@ -2612,6 +2612,9 @@
 [
 ['OR', ['x', '=', 3], ['AND', ['y', '=', 5]]],
 ['OR', ['x', '=', 3], ['y', '=', 5]]],
+[
+['OR', ['x', '=', 1], ['OR', ['x', '=', 2], ['x', '=', 3]]],
+['OR', ['x', '=', 1], ['x', '=', 2], ['x', '=', 3]]],
 [[['x', '=', 3], ['OR']], [['x', '=', 3]]],
 [['OR', ['x', '=', 3], []], []],
 [['OR', ['x', '=', 3], ['OR']], []],



[tryton-commits] changeset in trytond:default Remove extra operator when simplify...

2022-04-14 Thread Nicolas Évrard
changeset b9ed8d94a300 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=b9ed8d94a300
description:
Remove extra operator when simplifying nested domains

issue11406
review390621002
diffstat:

 trytond/tests/test_tools.py   |  5 +
 trytond/tools/domain_inversion.py |  9 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 0cd242b9bfc4 -r b9ed8d94a300 trytond/tests/test_tools.py
--- a/trytond/tests/test_tools.py   Tue Apr 12 13:09:01 2022 +0200
+++ b/trytond/tests/test_tools.py   Thu Apr 14 10:21:54 2022 +0200
@@ -570,6 +570,11 @@
 self.assertEqual(
 simplify(domain), ['OR', ['x', '=', 3], ['y', '=', 5]])
 
+domain = ['OR', ('x', '=', 1), ['OR', ('x', '=', 2), ('x', '=', 3)]]
+self.assertEqual(
+simplify(domain),
+['OR', ('x', '=', 1), ('x', '=', 2), ('x', '=', 3)])
+
 domain = [['x', '=', 3], ['OR']]
 self.assertEqual(simplify(domain), [['x', '=', 3]])
 
diff -r 0cd242b9bfc4 -r b9ed8d94a300 trytond/tools/domain_inversion.py
--- a/trytond/tools/domain_inversion.py Tue Apr 12 13:09:01 2022 +0200
+++ b/trytond/tools/domain_inversion.py Thu Apr 14 10:21:54 2022 +0200
@@ -307,9 +307,14 @@
 domain_op = bool_operator(domain)
 for branch in domain:
 simplified_branch = simplify_nested(branch)
-if (bool_operator(branch) == domain_op
+if (bool_operator(simplified_branch) == domain_op
 or len(simplified_branch) == 1):
-simplified.extend(simplified_branch)
+if (simplified
+and simplified_branch
+and simplified_branch[0] in ['AND', 'OR']):
+simplified.extend(simplified_branch[1:])
+else:
+simplified.extend(simplified_branch)
 else:
 simplified.append(simplified_branch)
 return simplified



[tryton-commits] changeset in trytond:6.0 Add compatibility with Werkzeug 2.1.0

2022-04-14 Thread Nicolas Évrard
changeset d488548ca402 in trytond:6.0
details: https://hg.tryton.org/trytond?cmd=changeset=d488548ca402
description:
Add compatibility with Werkzeug 2.1.0

issue11353
review356241003
(grafted from 6355790727873d028d833d6126a934e593114a67)
diffstat:

 trytond/tests/test_routes.py |  24 
 trytond/tests/test_wsgi.py   |  12 ++--
 2 files changed, 18 insertions(+), 18 deletions(-)

diffs (155 lines):

diff -r e4dea759b0f6 -r d488548ca402 trytond/tests/test_routes.py
--- a/trytond/tests/test_routes.py  Fri May 28 09:10:15 2021 +0200
+++ b/trytond/tests/test_routes.py  Thu Mar 31 13:43:36 2022 +0200
@@ -6,7 +6,7 @@
 import unittest
 
 from werkzeug.test import Client
-from werkzeug.wrappers import BaseResponse
+from werkzeug.wrappers import Response
 
 from trytond.pool import Pool
 from trytond.tests.test_tryton import activate_module, DB_NAME, drop_db
@@ -46,7 +46,7 @@
 
 def test_data_no_field(self):
 "Test GET data without field"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(self.data_url('res.user'), headers=self.auth_headers)
 
@@ -55,7 +55,7 @@
 
 def test_data_one_field(self):
 "Test GET data with one field"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -66,7 +66,7 @@
 
 def test_data_multiple_fields(self):
 "Test GET data with multiple fields"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -78,7 +78,7 @@
 
 def test_data_language(self):
 "Test GET data with language"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -93,7 +93,7 @@
 
 def test_data_size(self):
 "Test GET data with size limit"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -107,7 +107,7 @@
 
 def test_data_page(self):
 "Test GET data with page"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response0 = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -130,7 +130,7 @@
 
 def test_data_encoding(self):
 "Test GET data with encoding"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -147,7 +147,7 @@
 
 def test_data_delimiter(self):
 "Test GET data with delimiter"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -159,7 +159,7 @@
 
 def test_data_quotechar(self):
 "Test GET data with quotechar"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -172,7 +172,7 @@
 
 def test_data_no_header(self):
 "Test GET data without header"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -183,7 +183,7 @@
 
 def test_data_locale_format(self):
 "Test GET data in locale format"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response_std = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
diff -r e4dea759b0f6 -r d488548ca402 trytond/tests/test_wsgi.py
--- a/trytond/tests/test_wsgi.pyFri May 28 09:10:15 2021 +0200
+++ b/trytond/tests/test_wsgi.pyThu Mar 31 13:43:36 2022 +0200
@@ -34,7 +34,7 @@
 raise exception
 
 client = Client(app)
-(response, status, headers) = client.get('/willfail')
+_ = client.get('/willfail')
 
 spy.assert_called_once_with(app, sentinel.request, exception)
 
@@ -60,7 +60,7 @@
 raise exception
 
 client = Client(app)
-(response, status, headers) = client.get('/willfail')
+_ = client.get('/willfail')
 
 spy1.assert_called_once_with(app, sentinel.request, exception)
 spy2.assert_called_once_with(app, sentinel.request, exception)
@@ -84,7 +84,7 @@
 raise exception
 
 client = Client(app)
-(response, status, headers) = client.get('/willfail')
+_ = client.get('/willfail')
 
 spy.assert_called_once_with(app, sentinel.request, exception)
 
@@ -105,10 +105,10 @@
 raise self.TestException('foo')
 
 client = Client(app)
-   

[tryton-commits] changeset in trytond:6.2 Add compatibility with Werkzeug 2.1.0

2022-04-14 Thread Nicolas Évrard
changeset 34ec02f528d7 in trytond:6.2
details: https://hg.tryton.org/trytond?cmd=changeset=34ec02f528d7
description:
Add compatibility with Werkzeug 2.1.0

issue11353
review356241003
(grafted from 6355790727873d028d833d6126a934e593114a67)
diffstat:

 trytond/tests/test_routes.py |  24 
 trytond/tests/test_wsgi.py   |  12 ++--
 2 files changed, 18 insertions(+), 18 deletions(-)

diffs (155 lines):

diff -r 67a94f7e03e8 -r 34ec02f528d7 trytond/tests/test_routes.py
--- a/trytond/tests/test_routes.py  Sat Mar 19 15:04:09 2022 +0100
+++ b/trytond/tests/test_routes.py  Thu Mar 31 13:43:36 2022 +0200
@@ -6,7 +6,7 @@
 import unittest
 
 from werkzeug.test import Client
-from werkzeug.wrappers import BaseResponse
+from werkzeug.wrappers import Response
 
 from trytond.pool import Pool
 from trytond.tests.test_tryton import activate_module, DB_NAME, drop_db
@@ -46,7 +46,7 @@
 
 def test_data_no_field(self):
 "Test GET data without field"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(self.data_url('res.user'), headers=self.auth_headers)
 
@@ -55,7 +55,7 @@
 
 def test_data_one_field(self):
 "Test GET data with one field"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -66,7 +66,7 @@
 
 def test_data_multiple_fields(self):
 "Test GET data with multiple fields"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -78,7 +78,7 @@
 
 def test_data_language(self):
 "Test GET data with language"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -93,7 +93,7 @@
 
 def test_data_size(self):
 "Test GET data with size limit"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -107,7 +107,7 @@
 
 def test_data_page(self):
 "Test GET data with page"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response0 = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -130,7 +130,7 @@
 
 def test_data_encoding(self):
 "Test GET data with encoding"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('ir.lang'), headers=self.auth_headers,
@@ -147,7 +147,7 @@
 
 def test_data_delimiter(self):
 "Test GET data with delimiter"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -159,7 +159,7 @@
 
 def test_data_quotechar(self):
 "Test GET data with quotechar"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -172,7 +172,7 @@
 
 def test_data_no_header(self):
 "Test GET data without header"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
@@ -183,7 +183,7 @@
 
 def test_data_locale_format(self):
 "Test GET data in locale format"
-c = Client(app, BaseResponse)
+c = Client(app, Response)
 
 response_std = c.get(
 self.data_url('res.user'), headers=self.auth_headers,
diff -r 67a94f7e03e8 -r 34ec02f528d7 trytond/tests/test_wsgi.py
--- a/trytond/tests/test_wsgi.pySat Mar 19 15:04:09 2022 +0100
+++ b/trytond/tests/test_wsgi.pyThu Mar 31 13:43:36 2022 +0200
@@ -34,7 +34,7 @@
 raise exception
 
 client = Client(app)
-(response, status, headers) = client.get('/willfail')
+_ = client.get('/willfail')
 
 spy.assert_called_once_with(app, sentinel.request, exception)
 
@@ -60,7 +60,7 @@
 raise exception
 
 client = Client(app)
-(response, status, headers) = client.get('/willfail')
+_ = client.get('/willfail')
 
 spy1.assert_called_once_with(app, sentinel.request, exception)
 spy2.assert_called_once_with(app, sentinel.request, exception)
@@ -84,7 +84,7 @@
 raise exception
 
 client = Client(app)
-(response, status, headers) = client.get('/willfail')
+_ = client.get('/willfail')
 
 spy.assert_called_once_with(app, sentinel.request, exception)
 
@@ -105,10 +105,10 @@
 raise self.TestException('foo')
 
 client = Client(app)
-   

[tryton-commits] changeset in tryton:5.0 Request a column size recomputation on t...

2022-04-14 Thread Nicolas Évrard
changeset 48a7129d20ad in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset=48a7129d20ad
description:
Request a column size recomputation on treeview realization

issue11228
review370861002
(grafted from d415b76ceb89d70a716e415b0e524576d7d2303d)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r 0bc786fbba7d -r 48a7129d20ad 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Sun Mar 06 
18:02:00 2022 +0100
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Apr 06 
14:27:11 2022 +0200
@@ -50,12 +50,15 @@
 
 
 def realized(func):
-"Decorator for treeview realized"
+has_been_realized = False
+
 @wraps(func)
 def wrapper(self, *args, **kwargs):
-if (hasattr(self.view.treeview, 'get_realized')
-and not self.view.treeview.get_realized()):
-return
+nonlocal has_been_realized
+if not has_been_realized:
+has_been_realized = self.view.treeview.get_realized()
+if has_been_realized:
+self.view.treeview.queue_resize()
 return func(self, *args, **kwargs)
 return wrapper
 



[tryton-commits] changeset in tryton:6.2 Request a column size recomputation on t...

2022-04-14 Thread Nicolas Évrard
changeset 1f1a5356caff in tryton:6.2
details: https://hg.tryton.org/tryton?cmd=changeset=1f1a5356caff
description:
Request a column size recomputation on treeview realization

issue11228
review370861002
(grafted from d415b76ceb89d70a716e415b0e524576d7d2303d)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r e948a83f7767 -r 1f1a5356caff 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Sun Mar 06 
18:02:00 2022 +0100
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Apr 06 
14:27:11 2022 +0200
@@ -51,12 +51,15 @@
 
 
 def realized(func):
-"Decorator for treeview realized"
+has_been_realized = False
+
 @wraps(func)
 def wrapper(self, *args, **kwargs):
-if (hasattr(self.view.treeview, 'get_realized')
-and not self.view.treeview.get_realized()):
-return
+nonlocal has_been_realized
+if not has_been_realized:
+has_been_realized = self.view.treeview.get_realized()
+if has_been_realized:
+self.view.treeview.queue_resize()
 return func(self, *args, **kwargs)
 return wrapper
 



[tryton-commits] changeset in tryton:6.0 Request a column size recomputation on t...

2022-04-14 Thread Nicolas Évrard
changeset e5fbd9092453 in tryton:6.0
details: https://hg.tryton.org/tryton?cmd=changeset=e5fbd9092453
description:
Request a column size recomputation on treeview realization

issue11228
review370861002
(grafted from d415b76ceb89d70a716e415b0e524576d7d2303d)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r e94fef3e95da -r e5fbd9092453 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Sun Mar 06 
18:02:00 2022 +0100
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Wed Apr 06 
14:27:11 2022 +0200
@@ -51,12 +51,15 @@
 
 
 def realized(func):
-"Decorator for treeview realized"
+has_been_realized = False
+
 @wraps(func)
 def wrapper(self, *args, **kwargs):
-if (hasattr(self.view.treeview, 'get_realized')
-and not self.view.treeview.get_realized()):
-return
+nonlocal has_been_realized
+if not has_been_realized:
+has_been_realized = self.view.treeview.get_realized()
+if has_been_realized:
+self.view.treeview.queue_resize()
 return func(self, *args, **kwargs)
 return wrapper
 



[tryton-commits] changeset in trytond:default Remove python2 compatibility code f...

2022-05-06 Thread Nicolas Évrard
changeset 849222352082 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=849222352082
description:
Remove python2 compatibility code from fields.Binary

issue11467
review41003
diffstat:

 trytond/model/fields/binary.py |  12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r c7b0d5f64013 -r 849222352082 trytond/model/fields/binary.py
--- a/trytond/model/fields/binary.pyMon May 02 16:25:17 2022 +0200
+++ b/trytond/model/fields/binary.pyFri May 06 18:18:01 2022 +0200
@@ -9,13 +9,21 @@
 from .field import Field
 
 
+def caster(d):
+if isinstance(d, bytes):
+return d
+elif isinstance(d, memoryview):
+return bytes(d)
+return bytes(d, encoding='utf8')
+
+
 class Binary(Field):
 '''
 Define a binary field (``bytes``).
 '''
 _type = 'binary'
 _sql_type = 'BLOB'
-cast = bytearray if bytes == str else bytes
+cast = staticmethod(caster)
 
 def __init__(self, string='', help='', required=False, readonly=False,
 domain=None, states=None, select=False, on_change=None,
@@ -89,8 +97,6 @@
 continue
 value = i[name]
 if value:
-if isinstance(value, str):
-value = value.encode('utf-8')
 value = converter(value)
 else:
 value = default



[tryton-commits] changeset in modules/company_work_time:default Remove user login...

2022-04-29 Thread Nicolas Évrard
changeset 4a857556b923 in modules/company_work_time:default
details: 
https://hg.tryton.org/modules/company_work_time?cmd=changeset=4a857556b923
description:
Remove user login and user preferences cache

The user login cache could result in an error when using trytond in a
multiprocess environment due to a delay in the broadcast of the cache
invalidation.

The user preferences cache was there only to set the context when 
validating
the records but it is useless since the context is now set from the
transaction.

review401251002
issue11430
diffstat:

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

diffs (14 lines):

diff -r bfbd2c379a74 -r 4a857556b923 company.py
--- a/company.pySat Apr 16 18:30:17 2022 +0200
+++ b/company.pyFri Apr 29 17:14:27 2022 +0200
@@ -37,10 +37,3 @@
 @staticmethod
 def default_hours_per_work_year():
 return 1920
-
-@classmethod
-def write(cls, *args):
-pool = Pool()
-User = pool.get('res.user')
-super(Company, cls).write(*args)
-User._get_preferences_cache.clear()



[tryton-commits] changeset in trytond:default Remove user login and user preferen...

2022-04-29 Thread Nicolas Évrard
changeset a18d951b647d in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=a18d951b647d
description:
Remove user login and user preferences cache

The user login cache could result in an error when using trytond in a
multiprocess environment due to a delay in the broadcast of the cache
invalidation.

The user preferences cache was there only to set the context when 
validating
the records but it is useless since the context is now set from the
transaction.

review401251002
issue11430
diffstat:

 trytond/model/modelstorage.py |  12 +-
 trytond/res/__init__.py   |   2 -
 trytond/res/ir.py |  39 --
 trytond/res/user.py   |  49 ++
 4 files changed, 4 insertions(+), 98 deletions(-)

diffs (232 lines):

diff -r 633a31cb1026 -r a18d951b647d trytond/model/modelstorage.py
--- a/trytond/model/modelstorage.py Wed Apr 27 18:28:46 2022 +0200
+++ b/trytond/model/modelstorage.py Fri Apr 29 17:14:27 2022 +0200
@@ -1146,15 +1146,6 @@
 # also convert iterator to list
 records = cls.browse(records)
 
-ctx_pref = {}
-if Transaction().user:
-try:
-User = pool.get('res.user')
-except KeyError:
-pass
-else:
-ctx_pref = User.get_preferences(context_only=True)
-
 def is_pyson(test):
 if isinstance(test, PYSON):
 return True
@@ -1324,8 +1315,7 @@
 field_names = set(field_names)
 function_fields = {name for name, field in cls._fields.items()
 if isinstance(field, fields.Function)}
-ctx_pref['active_test'] = False
-with Transaction().set_context(ctx_pref):
+with Transaction().set_context(active_test=False):
 for field_name, field in cls._fields.items():
 if (field_name not in field_names
 and not (field.validation_depends & field_names)
diff -r 633a31cb1026 -r a18d951b647d trytond/res/__init__.py
--- a/trytond/res/__init__.py   Wed Apr 27 18:28:46 2022 +0200
+++ b/trytond/res/__init__.py   Fri Apr 29 17:14:27 2022 +0200
@@ -30,10 +30,8 @@
 ir.ModelButtonRule,
 ir.ModelButtonClick,
 ir.RuleGroupGroup,
-ir.Lang,
 ir.SequenceType,
 ir.SequenceTypeGroup,
-ir.ModuleConfigWizardItem,
 ir.Export,
 ir.Export_Group,
 ir.Export_Write_Group,
diff -r 633a31cb1026 -r a18d951b647d trytond/res/ir.py
--- a/trytond/res/ir.py Wed Apr 27 18:28:46 2022 +0200
+++ b/trytond/res/ir.py Fri Apr 29 17:14:27 2022 +0200
@@ -176,16 +176,6 @@
 select=True, required=True)
 
 
-class Lang(metaclass=PoolMeta):
-__name__ = 'ir.lang'
-
-@classmethod
-def write(cls, langs, values, *args):
-super(Lang, cls).write(langs, values, *args)
-# Restart the cache for get_preferences
-Pool().get('res.user')._get_preferences_cache.clear()
-
-
 class SequenceType(metaclass=PoolMeta):
 __name__ = 'ir.sequence.type'
 groups = fields.Many2Many('ir.sequence.type-res.group', 'sequence_type',
@@ -224,35 +214,6 @@
 Rule._domain_get_cache.clear()
 
 
-class ModuleConfigWizardItem(metaclass=PoolMeta):
-__name__ = 'ir.module.config_wizard.item'
-
-@classmethod
-def create(cls, vlist):
-pool = Pool()
-User = pool.get('res.user')
-result = super(ModuleConfigWizardItem, cls).create(vlist)
-# Restart the cache for get_preferences
-User._get_preferences_cache.clear()
-return result
-
-@classmethod
-def write(cls, items, values, *args):
-pool = Pool()
-User = pool.get('res.user')
-super(ModuleConfigWizardItem, cls).write(items, values, *args)
-# Restart the cache for get_preferences
-User._get_preferences_cache.clear()
-
-@classmethod
-def delete(cls, items):
-pool = Pool()
-User = pool.get('res.user')
-super(ModuleConfigWizardItem, cls).delete(items)
-# Restart the cache for get_preferences
-User._get_preferences_cache.clear()
-
-
 class Export(metaclass=PoolMeta):
 __name__ = 'ir.export'
 
diff -r 633a31cb1026 -r a18d951b647d trytond/res/user.py
--- a/trytond/res/user.py   Wed Apr 27 18:28:46 2022 +0200
+++ b/trytond/res/user.py   Fri Apr 29 17:14:27 2022 +0200
@@ -155,9 +155,7 @@
 warnings = fields.One2Many('res.user.warning', 'user', 'Warnings')
 sessions = fields.Function(fields.Integer('Sessions'),
 'get_sessions')
-_get_preferences_cache = Cache('res_user.get_preferences')
 _get_groups_cache = Cache('res_user.get_groups', context=False)
-_get_login_cache = Cache('res_user._get_login', context=False)
 
 @classmethod
 def __setup__(cls):
@@ -374,10 +372,7 @@
 @classmethod
 def 

[tryton-commits] changeset in trytond:default Read at most cache size or IN_MAX r...

2022-05-10 Thread Nicolas Évrard
changeset 48bad78f99b0 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=48bad78f99b0
description:
Read at most cache size or IN_MAX records from the database

issue11468
review427111003
diffstat:

 trytond/model/modelstorage.py |  8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 290ec5f156b2 -r 48bad78f99b0 trytond/model/modelstorage.py
--- a/trytond/model/modelstorage.py Sat May 07 14:10:36 2022 +0200
+++ b/trytond/model/modelstorage.py Tue May 10 15:24:37 2022 +0200
@@ -1676,11 +1676,13 @@
 if id_ not in s:
 s.add(id_)
 yield id_
+read_size = max(1, min(
+self._cache.size_limit, self._local_cache.size_limit,
+self._transaction.database.IN_MAX))
 index = self._ids.index(self.id)
 ids = chain(islice(self._ids, index, None),
 islice(self._ids, 0, max(index - 1, 0)))
-ids = islice(unique(filter(filter_, ids)),
-self._transaction.database.IN_MAX)
+ids = islice(unique(filter(filter_, ids)), read_size)
 
 def instantiate(field, value, data):
 if field._type in ('many2one', 'one2one', 'reference'):
@@ -1744,7 +1746,7 @@
 read_data = []
 for id_ in islice(chain(islice(self._ids, index, None),
 islice(self._ids, 0, max(index - 1, 0))),
-self._transaction.database.IN_MAX):
+read_size):
 if id_ in self._cache:
 data = {'id': id_}
 for fname in ffields:



[tryton-commits] changeset in tryton-tweet:default Post on mastodon too

2022-05-10 Thread Nicolas Évrard
changeset 457ea2c6531c in tryton-tweet:default
details: https://hg.tryton.org/tryton-tweet?cmd=changeset=457ea2c6531c
description:
Post on mastodon too
diffstat:

 requirements.txt |   1 +
 tweet|  68 +++
 2 files changed, 49 insertions(+), 20 deletions(-)

diffs (93 lines):

diff -r 9e0d01e3d806 -r 457ea2c6531c requirements.txt
--- a/requirements.txt  Thu Oct 28 12:05:37 2021 +0200
+++ b/requirements.txt  Tue May 10 18:13:12 2022 +0200
@@ -1,1 +1,2 @@
+requests
 python-twitter
diff -r 9e0d01e3d806 -r 457ea2c6531c tweet
--- a/tweet Thu Oct 28 12:05:37 2021 +0200
+++ b/tweet Tue May 10 18:13:12 2022 +0200
@@ -1,10 +1,12 @@
 #!/usr/bin/env python3
+import configparser
 import os
-import configparser
 import sys
+import urllib.parse
 from itertools import groupby
 from random import choice
 
+import requests
 import twitter
 
 curdir = os.path.dirname(__file__)
@@ -14,24 +16,50 @@
 return line == '\n'
 
 
-data, prefix = {
-'tip': ('tips', "#TrytonTips "),
-'success-story': ('success-stories', ""),
-}[sys.argv[1]]
-tweets = []
-with open(os.path.join(curdir, data), 'r') as fp:
-for key, lines in groupby(fp, block_separator):
-if key:
-continue
-tweets.append(prefix + ' '.join(map(str.strip, lines)))
-tweet = choice(tweets)
+def choose_text():
+data, prefix = {
+'tip': ('tips', "#TrytonTips "),
+'success-story': ('success-stories', ""),
+}[sys.argv[1]]
+tweets = []
+with open(os.path.join(curdir, data), 'r') as fp:
+for key, lines in groupby(fp, block_separator):
+if key:
+continue
+tweets.append(prefix + ' '.join(map(str.strip, lines)))
+return choice(tweets)
+
+
+def tweet(text):
+config = configparser.ConfigParser()
+config.read(os.path.join(curdir, 'twitter.cfg'))
 
-config = configparser.ConfigParser()
-config.read(os.path.join(curdir, 'twitter.cfg'))
+twitter.Api(
+consumer_key=config.get('consumer', 'key'),
+consumer_secret=config.get('consumer', 'secret'),
+access_token_key=config.get('access_token', 'key'),
+access_token_secret=config.get('access_token', 'secret')
+).PostUpdate(text)
+
+
+def toot(text):
+config = configparser.ConfigParser()
+config.read(os.path.join(curdir, 'mastodon.cfg'))
+token = config.get('tokens', 'access')
 
-twitter.Api(
-consumer_key=config.get('consumer', 'key'),
-consumer_secret=config.get('consumer', 'secret'),
-access_token_key=config.get('access_token', 'key'),
-access_token_secret=config.get('access_token', 'secret')
-).PostUpdate(tweet)
+requests.post(
+urllib.parse.urljoin(
+config.get('instance', 'url'), '/api/v1/statuses'),
+params={
+'status': text,
+},
+headers={
+'Authorization': f"Bearer {token}",
+})
+
+
+
+if __name__ == '__main__':
+text = choose_text()
+tweet(text)
+toot(text)



[tryton-commits] changeset in tryton:default Load group fields before setting the...

2022-05-09 Thread Nicolas Évrard
changeset ba6c9da73849 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=ba6c9da73849
description:
Load group fields before setting the current record

issue11448
review423081003
diffstat:

 tryton/gui/window/view_form/screen/screen.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r 1fd17afe1078 -r ba6c9da73849 
tryton/gui/window/view_form/screen/screen.py
--- a/tryton/gui/window/view_form/screen/screen.py  Mon May 02 16:27:14 
2022 +0200
+++ b/tryton/gui/window/view_form/screen/screen.py  Mon May 09 16:13:31 
2022 +0200
@@ -420,11 +420,11 @@
 if self.parent:
 self.filter_widget = None
 self.order = None
+self.__group.add_fields(fields)
 if len(group):
 self.current_record = group[0]
 else:
 self.current_record = None
-self.__group.add_fields(fields)
 for name, views in fields_views.items():
 self.__group.fields[name].views.update(views)
 self.__group.exclude_field = self.exclude_field



[tryton-commits] changeset in trytond:default Catch get_connection errors in Cach...

2022-09-17 Thread Nicolas Évrard
changeset 7123014d260c in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=7123014d260c
description:
Catch get_connection errors in Cache listener

issue11563
review411271003
diffstat:

 trytond/cache.py |  26 --
 1 files changed, 16 insertions(+), 10 deletions(-)

diffs (45 lines):

diff -r 65b62a8b02c3 -r 7123014d260c trytond/cache.py
--- a/trytond/cache.py  Fri Sep 16 23:36:30 2022 +0200
+++ b/trytond/cache.py  Sat Sep 17 19:00:48 2022 +0200
@@ -348,16 +348,20 @@
 
 @classmethod
 def _listen(cls, dbname):
-database = backend.Database(dbname)
-if not database.has_channel():
-raise NotImplementedError
+current_thread = threading.current_thread()
+pid = os.getpid()
 
-logger.info("listening on channel '%s' of '%s'", cls._channel, dbname)
-conn = database.get_connection(autocommit=True)
-pid = os.getpid()
-selector = selectors.DefaultSelector()
-current_thread = threading.current_thread()
+conn, selector = None, None
 try:
+database = backend.Database(dbname)
+if not database.has_channel():
+raise NotImplementedError
+
+logger.info(
+"listening on channel '%s' of '%s'", cls._channel, dbname)
+conn = database.get_connection(autocommit=True)
+selector = selectors.DefaultSelector()
+
 cursor = conn.cursor()
 cursor.execute('LISTEN "%s"' % cls._channel)
 current_thread.listening = True
@@ -380,8 +384,10 @@
 "cache listener on '%s' crashed", dbname, exc_info=True)
 raise
 finally:
-selector.close()
-database.put_connection(conn)
+if selector:
+selector.close()
+if conn:
+database.put_connection(conn)
 with cls._listener_lock[pid]:
 if cls._listener.get((pid, dbname)) == current_thread:
 del cls._listener[pid, dbname]



[tryton-commits] changeset in tryton:default Select the clicked line when activat...

2022-09-17 Thread Nicolas Évrard
changeset e97626052a77 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=e97626052a77
description:
Select the clicked line when activating a button in list view

issue11212
review433141003
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r ee18cb647324 -r e97626052a77 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Fri Sep 16 
23:36:30 2022 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Sat Sep 17 
18:58:55 2022 +0200
@@ -1305,11 +1305,17 @@
 store = self.view.treeview.get_model()
 record = store.get_value(store.get_iter(path), 0)
 
+if self.view.record and self.view.record != record:
+widget.stop_emission_by_name('clicked')
+return True
+
 state_changes = record.expr_eval(
 self.attrs.get('states', {}))
 if state_changes.get('invisible') \
 or state_changes.get('readonly'):
 return True
+
+self.view.treeview.set_cursor(path)
 widget.handler_block_by_func(self.button_clicked)
 try:
 self.view.screen.button(self.attrs)



[tryton-commits] changeset in modules/account_payment_sepa:6.0 Handle multiple tr...

2022-10-12 Thread Nicolas Évrard
changeset e2d9f811b79e in modules/account_payment_sepa:6.0
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=e2d9f811b79e
description:
Handle multiple transactions in CAMT054 Ntry tags

issue11672
review413471003
(grafted from fc8e9d9cb870d9353ff374120688b8e9779b90c0)
diffstat:

 sepa_handler.py |  84 +---
 1 files changed, 44 insertions(+), 40 deletions(-)

diffs (122 lines):

diff -r 9b25677cd795 -r e2d9f811b79e sepa_handler.py
--- a/sepa_handler.py   Fri Nov 05 00:17:58 2021 +0100
+++ b/sepa_handler.py   Mon Oct 03 00:13:39 2022 +0200
@@ -35,48 +35,59 @@
 element.clear()
 
 def handle_entry(self, element):
-payments = self.get_payments(element)
-if self.is_returned(element):
-for payment in payments:
-self.set_return_information(payment, element)
-self.Payment.save(payments)
-self.Payment.fail(payments)
-else:
-date_value = self.date_value(element)
+tag = etree.QName(element)
+failed, succeeded = [], []
+date_value = self.date_value(element)
+
+for transaction in element.findall('.//{%s}TxDtls' % tag.namespace):
+payments = self.get_payments(transaction)
+if self.is_returned(transaction):
+for payment in payments:
+self.set_return_information(payment, transaction)
+failed.extend(payments)
+else:
+succeeded.extend(payments)
+
+if failed:
+self.Payment.save(failed)
+self.Payment.fail(failed)
+if succeeded:
 with Transaction().set_context(date_value=date_value):
-self.Payment.succeed(payments)
+self.Payment.succeed(succeeded)
 
 def get_payment_kind(self, element):
-tag = etree.QName(element)
-return self._kinds[
-element.find('./{%s}CdtDbtInd' % tag.namespace).text]
+camt_ns = etree.QName(element).namespace
+for path in [
+'./camt:CdtDbtInd',
+'./ancestor::camt:NtryDtls/camt:Btch/camt:CdtDbtInd',
+'./ancestor::camt:Ntry/camt:CdtDbtInd',
+]:
+cdtdbtind = element.xpath(path, namespaces={'camt': camt_ns})
+if cdtdbtind:
+return self._kinds[cdtdbtind[0].text]
 _kinds = {
 'CRDT': 'payable',
 'DBIT': 'receivable',
 }
 
-def get_payments(self, element):
-tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-# Version 1 doesn't have NtryDtls but directly TxDtls
-details = element.find('./{%s}TxDtls' % tag.namespace)
-if details is None:
-return []
-instr_id = details.find('.//{%s}InstrId' % tag.namespace)
+def get_payments(self, transaction):
+tag = etree.QName(transaction)
+instr_id = transaction.find(
+'.//{%s}InstrId' % tag.namespace)
+end_to_end_id = transaction.find(
+'.//{%s}EndToEndId' % tag.namespace)
+payment_kind = self.get_payment_kind(transaction)
 if instr_id is not None:
-payments = self.Payment.search([
+return self.Payment.search([
 ('sepa_instruction_id', '=', instr_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
-end_to_end_id = details.find('.//{%s}EndToEndId' % tag.namespace)
-if end_to_end_id is not None:
-payments = self.Payment.search([
+elif end_to_end_id is not None:
+return self.Payment.search([
 ('sepa_end_to_end_id', '=', end_to_end_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
+return []
 
 def date_value(self, element):
 tag = etree.QName(element)
@@ -92,25 +103,18 @@
 
 def is_returned(self, element):
 tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-return
-return_reason = details.find('.//{%s}RtrInf' % tag.namespace)
-if return_reason is None:
-return False
-return True
+return_reason = element.find('.//{%s}RtrInf' % tag.namespace)
+return return_reason is not None
 
 def set_return_information(self, payment, element):
 tag = etree.QName(element)
 
 reason_code = element.find(
-'./{%(ns)s}NtryDtls//{%(ns)s}RtrInf/{%(ns)s}Rsn/{%(ns)s}Cd'
-% {'ns': tag.namespace})
+

[tryton-commits] changeset in modules/account_payment_sepa:5.0 Handle multiple tr...

2022-10-12 Thread Nicolas Évrard
changeset c407830443b8 in modules/account_payment_sepa:5.0
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=c407830443b8
description:
Handle multiple transactions in CAMT054 Ntry tags

issue11672
review413471003
(grafted from fc8e9d9cb870d9353ff374120688b8e9779b90c0)
diffstat:

 sepa_handler.py |  84 +---
 1 files changed, 44 insertions(+), 40 deletions(-)

diffs (122 lines):

diff -r 737c1376ef6e -r c407830443b8 sepa_handler.py
--- a/sepa_handler.py   Fri Oct 15 17:28:08 2021 +0200
+++ b/sepa_handler.py   Mon Oct 03 00:13:39 2022 +0200
@@ -35,48 +35,59 @@
 element.clear()
 
 def handle_entry(self, element):
-payments = self.get_payments(element)
-if self.is_returned(element):
-for payment in payments:
-self.set_return_information(payment, element)
-self.Payment.save(payments)
-self.Payment.fail(payments)
-else:
-date_value = self.date_value(element)
+tag = etree.QName(element)
+failed, succeeded = [], []
+date_value = self.date_value(element)
+
+for transaction in element.findall('.//{%s}TxDtls' % tag.namespace):
+payments = self.get_payments(transaction)
+if self.is_returned(transaction):
+for payment in payments:
+self.set_return_information(payment, transaction)
+failed.extend(payments)
+else:
+succeeded.extend(payments)
+
+if failed:
+self.Payment.save(failed)
+self.Payment.fail(failed)
+if succeeded:
 with Transaction().set_context(date_value=date_value):
-self.Payment.succeed(payments)
+self.Payment.succeed(succeeded)
 
 def get_payment_kind(self, element):
-tag = etree.QName(element)
-return self._kinds[
-element.find('./{%s}CdtDbtInd' % tag.namespace).text]
+camt_ns = etree.QName(element).namespace
+for path in [
+'./camt:CdtDbtInd',
+'./ancestor::camt:NtryDtls/camt:Btch/camt:CdtDbtInd',
+'./ancestor::camt:Ntry/camt:CdtDbtInd',
+]:
+cdtdbtind = element.xpath(path, namespaces={'camt': camt_ns})
+if cdtdbtind:
+return self._kinds[cdtdbtind[0].text]
 _kinds = {
 'CRDT': 'payable',
 'DBIT': 'receivable',
 }
 
-def get_payments(self, element):
-tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-# Version 1 doesn't have NtryDtls but directly TxDtls
-details = element.find('./{%s}TxDtls' % tag.namespace)
-if details is None:
-return []
-instr_id = details.find('.//{%s}InstrId' % tag.namespace)
+def get_payments(self, transaction):
+tag = etree.QName(transaction)
+instr_id = transaction.find(
+'.//{%s}InstrId' % tag.namespace)
+end_to_end_id = transaction.find(
+'.//{%s}EndToEndId' % tag.namespace)
+payment_kind = self.get_payment_kind(transaction)
 if instr_id is not None:
-payments = self.Payment.search([
+return self.Payment.search([
 ('sepa_instruction_id', '=', instr_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
-end_to_end_id = details.find('.//{%s}EndToEndId' % tag.namespace)
-if end_to_end_id is not None:
-payments = self.Payment.search([
+elif end_to_end_id is not None:
+return self.Payment.search([
 ('sepa_end_to_end_id', '=', end_to_end_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
+return []
 
 def date_value(self, element):
 tag = etree.QName(element)
@@ -92,25 +103,18 @@
 
 def is_returned(self, element):
 tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-return
-return_reason = details.find('.//{%s}RtrInf' % tag.namespace)
-if return_reason is None:
-return False
-return True
+return_reason = element.find('.//{%s}RtrInf' % tag.namespace)
+return return_reason is not None
 
 def set_return_information(self, payment, element):
 tag = etree.QName(element)
 
 reason_code = element.find(
-'./{%(ns)s}NtryDtls//{%(ns)s}RtrInf/{%(ns)s}Rsn/{%(ns)s}Cd'
-% {'ns': tag.namespace})
+

[tryton-commits] changeset in modules/account_payment_sepa:6.2 Handle multiple tr...

2022-10-12 Thread Nicolas Évrard
changeset 464e762c9287 in modules/account_payment_sepa:6.2
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=464e762c9287
description:
Handle multiple transactions in CAMT054 Ntry tags

issue11672
review413471003
(grafted from fc8e9d9cb870d9353ff374120688b8e9779b90c0)
diffstat:

 sepa_handler.py |  84 +---
 1 files changed, 44 insertions(+), 40 deletions(-)

diffs (122 lines):

diff -r 5cb9db4b9ba2 -r 464e762c9287 sepa_handler.py
--- a/sepa_handler.py   Fri Jul 01 23:55:42 2022 +0200
+++ b/sepa_handler.py   Mon Oct 03 00:13:39 2022 +0200
@@ -35,48 +35,59 @@
 element.clear()
 
 def handle_entry(self, element):
-payments = self.get_payments(element)
-if self.is_returned(element):
-for payment in payments:
-self.set_return_information(payment, element)
-self.Payment.save(payments)
-self.Payment.fail(payments)
-else:
-date_value = self.date_value(element)
+tag = etree.QName(element)
+failed, succeeded = [], []
+date_value = self.date_value(element)
+
+for transaction in element.findall('.//{%s}TxDtls' % tag.namespace):
+payments = self.get_payments(transaction)
+if self.is_returned(transaction):
+for payment in payments:
+self.set_return_information(payment, transaction)
+failed.extend(payments)
+else:
+succeeded.extend(payments)
+
+if failed:
+self.Payment.save(failed)
+self.Payment.fail(failed)
+if succeeded:
 with Transaction().set_context(date_value=date_value):
-self.Payment.succeed(payments)
+self.Payment.succeed(succeeded)
 
 def get_payment_kind(self, element):
-tag = etree.QName(element)
-return self._kinds[
-element.find('./{%s}CdtDbtInd' % tag.namespace).text]
+camt_ns = etree.QName(element).namespace
+for path in [
+'./camt:CdtDbtInd',
+'./ancestor::camt:NtryDtls/camt:Btch/camt:CdtDbtInd',
+'./ancestor::camt:Ntry/camt:CdtDbtInd',
+]:
+cdtdbtind = element.xpath(path, namespaces={'camt': camt_ns})
+if cdtdbtind:
+return self._kinds[cdtdbtind[0].text]
 _kinds = {
 'CRDT': 'payable',
 'DBIT': 'receivable',
 }
 
-def get_payments(self, element):
-tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-# Version 1 doesn't have NtryDtls but directly TxDtls
-details = element.find('./{%s}TxDtls' % tag.namespace)
-if details is None:
-return []
-instr_id = details.find('.//{%s}InstrId' % tag.namespace)
+def get_payments(self, transaction):
+tag = etree.QName(transaction)
+instr_id = transaction.find(
+'.//{%s}InstrId' % tag.namespace)
+end_to_end_id = transaction.find(
+'.//{%s}EndToEndId' % tag.namespace)
+payment_kind = self.get_payment_kind(transaction)
 if instr_id is not None:
-payments = self.Payment.search([
+return self.Payment.search([
 ('sepa_instruction_id', '=', instr_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
-end_to_end_id = details.find('.//{%s}EndToEndId' % tag.namespace)
-if end_to_end_id is not None:
-payments = self.Payment.search([
+elif end_to_end_id is not None:
+return self.Payment.search([
 ('sepa_end_to_end_id', '=', end_to_end_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
+return []
 
 def date_value(self, element):
 tag = etree.QName(element)
@@ -92,25 +103,18 @@
 
 def is_returned(self, element):
 tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-return
-return_reason = details.find('.//{%s}RtrInf' % tag.namespace)
-if return_reason is None:
-return False
-return True
+return_reason = element.find('.//{%s}RtrInf' % tag.namespace)
+return return_reason is not None
 
 def set_return_information(self, payment, element):
 tag = etree.QName(element)
 
 reason_code = element.find(
-'./{%(ns)s}NtryDtls//{%(ns)s}RtrInf/{%(ns)s}Rsn/{%(ns)s}Cd'
-% {'ns': tag.namespace})
+

[tryton-commits] changeset in modules/account_payment_sepa:6.4 Handle multiple tr...

2022-10-12 Thread Nicolas Évrard
changeset d09b18cbf5be in modules/account_payment_sepa:6.4
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=d09b18cbf5be
description:
Handle multiple transactions in CAMT054 Ntry tags

issue11672
review413471003
(grafted from fc8e9d9cb870d9353ff374120688b8e9779b90c0)
diffstat:

 sepa_handler.py |  84 +---
 1 files changed, 44 insertions(+), 40 deletions(-)

diffs (122 lines):

diff -r 629907cf742d -r d09b18cbf5be sepa_handler.py
--- a/sepa_handler.py   Fri Jul 01 23:54:36 2022 +0200
+++ b/sepa_handler.py   Mon Oct 03 00:13:39 2022 +0200
@@ -35,48 +35,59 @@
 element.clear()
 
 def handle_entry(self, element):
-payments = self.get_payments(element)
-if self.is_returned(element):
-for payment in payments:
-self.set_return_information(payment, element)
-self.Payment.save(payments)
-self.Payment.fail(payments)
-else:
-date_value = self.date_value(element)
+tag = etree.QName(element)
+failed, succeeded = [], []
+date_value = self.date_value(element)
+
+for transaction in element.findall('.//{%s}TxDtls' % tag.namespace):
+payments = self.get_payments(transaction)
+if self.is_returned(transaction):
+for payment in payments:
+self.set_return_information(payment, transaction)
+failed.extend(payments)
+else:
+succeeded.extend(payments)
+
+if failed:
+self.Payment.save(failed)
+self.Payment.fail(failed)
+if succeeded:
 with Transaction().set_context(date_value=date_value):
-self.Payment.succeed(payments)
+self.Payment.succeed(succeeded)
 
 def get_payment_kind(self, element):
-tag = etree.QName(element)
-return self._kinds[
-element.find('./{%s}CdtDbtInd' % tag.namespace).text]
+camt_ns = etree.QName(element).namespace
+for path in [
+'./camt:CdtDbtInd',
+'./ancestor::camt:NtryDtls/camt:Btch/camt:CdtDbtInd',
+'./ancestor::camt:Ntry/camt:CdtDbtInd',
+]:
+cdtdbtind = element.xpath(path, namespaces={'camt': camt_ns})
+if cdtdbtind:
+return self._kinds[cdtdbtind[0].text]
 _kinds = {
 'CRDT': 'payable',
 'DBIT': 'receivable',
 }
 
-def get_payments(self, element):
-tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-# Version 1 doesn't have NtryDtls but directly TxDtls
-details = element.find('./{%s}TxDtls' % tag.namespace)
-if details is None:
-return []
-instr_id = details.find('.//{%s}InstrId' % tag.namespace)
+def get_payments(self, transaction):
+tag = etree.QName(transaction)
+instr_id = transaction.find(
+'.//{%s}InstrId' % tag.namespace)
+end_to_end_id = transaction.find(
+'.//{%s}EndToEndId' % tag.namespace)
+payment_kind = self.get_payment_kind(transaction)
 if instr_id is not None:
-payments = self.Payment.search([
+return self.Payment.search([
 ('sepa_instruction_id', '=', instr_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
-end_to_end_id = details.find('.//{%s}EndToEndId' % tag.namespace)
-if end_to_end_id is not None:
-payments = self.Payment.search([
+elif end_to_end_id is not None:
+return self.Payment.search([
 ('sepa_end_to_end_id', '=', end_to_end_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
+return []
 
 def date_value(self, element):
 tag = etree.QName(element)
@@ -92,25 +103,18 @@
 
 def is_returned(self, element):
 tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-return
-return_reason = details.find('.//{%s}RtrInf' % tag.namespace)
-if return_reason is None:
-return False
-return True
+return_reason = element.find('.//{%s}RtrInf' % tag.namespace)
+return return_reason is not None
 
 def set_return_information(self, payment, element):
 tag = etree.QName(element)
 
 reason_code = element.find(
-'./{%(ns)s}NtryDtls//{%(ns)s}RtrInf/{%(ns)s}Rsn/{%(ns)s}Cd'
-% {'ns': tag.namespace})
+

[tryton-commits] changeset in trytond:default Add configuration entries for unacc...

2022-10-09 Thread Nicolas Évrard
changeset b634739721c9 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=b634739721c9
description:
Add configuration entries for unaccent and similarity functions

issue10851
review370001002
diffstat:

 CHANGELOG  |   1 +
 doc/topics/configuration.rst   |  14 ++
 trytond/backend/postgresql/database.py |   5 +++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r fa9f7d4695e6 -r b634739721c9 CHANGELOG
--- a/CHANGELOG Sun Oct 09 18:51:02 2022 +0200
+++ b/CHANGELOG Sun Oct 09 19:58:51 2022 +0200
@@ -1,3 +1,4 @@
+* Add configuration entries for unaccent and similarity functions
 * Add authentication services
 * Schedule actions using server timezone
 * Reset the user sessions less often
diff -r fa9f7d4695e6 -r b634739721c9 doc/topics/configuration.rst
--- a/doc/topics/configuration.rst  Sun Oct 09 18:51:02 2022 +0200
+++ b/doc/topics/configuration.rst  Sun Oct 09 19:58:51 2022 +0200
@@ -229,6 +229,20 @@
 The maximum number of simultaneous connections to the database per process.
 Default: ``64``
 
+unaccent_function
+~
+
+The name of the unaccent function.
+
+Default: ``unaccent``
+
+similarity_function
+~~~
+
+The name of the similarity function.
+
+Default: ``similarity``
+
 request
 ---
 
diff -r fa9f7d4695e6 -r b634739721c9 trytond/backend/postgresql/database.py
--- a/trytond/backend/postgresql/database.pySun Oct 09 18:51:02 2022 +0200
+++ b/trytond/backend/postgresql/database.pySun Oct 09 19:58:51 2022 +0200
@@ -76,12 +76,13 @@
 
 class Unaccent(Function):
 __slots__ = ()
-_function = 'unaccent'
+_function = config.get('database', 'unaccent_function', default='unaccent')
 
 
 class Similarity(Function):
 __slots__ = ()
-_function = 'similarity'
+_function = config.get(
+'database', 'similarity_function', default='similarity')
 
 
 class Match(BinaryOperator):



[tryton-commits] changeset in modules/account_invoice:default Extend scenario to ...

2022-10-02 Thread Nicolas Évrard
changeset 149066718d79 in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset=149066718d79
description:
Extend scenario to check amount_to_pay

issue10440
review351971032
diffstat:

 tests/scenario_invoice_group_line.rst |  16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diffs (60 lines):

diff -r 26b5f5d804ee -r 149066718d79 tests/scenario_invoice_group_line.rst
--- a/tests/scenario_invoice_group_line.rst Wed Sep 14 19:27:28 2022 +0200
+++ b/tests/scenario_invoice_group_line.rst Mon Oct 03 00:11:05 2022 +0200
@@ -64,6 +64,8 @@
 >>> invoice.click('post')
 >>> invoice.state
 'posted'
+>>> invoice.amount_to_pay
+Decimal('10.00')
 
 Post supplier invoice::
 
@@ -77,6 +79,8 @@
 >>> supplier_invoice.click('post')
 >>> supplier_invoice.state
 'posted'
+>>> supplier_invoice.amount_to_pay
+Decimal('5.00')
 
 Group lines::
 
@@ -91,9 +95,13 @@
 >>> invoice.reload()
 >>> invoice.state
 'posted'
+>>> invoice.amount_to_pay
+Decimal('0')
 >>> supplier_invoice.reload()
 >>> supplier_invoice.state
 'posted'
+>>> supplier_invoice.amount_to_pay
+Decimal('0')
 
 Receive remaining line::
 
@@ -121,9 +129,13 @@
 >>> invoice.reload()
 >>> invoice.state
 'paid'
+>>> invoice.amount_to_pay
+Decimal('0')
 >>> supplier_invoice.reload()
 >>> supplier_invoice.state
 'paid'
+>>> supplier_invoice.amount_to_pay
+Decimal('0')
 
 Remove the created reconciliation::
 
@@ -134,6 +146,10 @@
 >>> invoice.reload()
 >>> invoice.state
 'posted'
+>>> invoice.amount_to_pay
+Decimal('0')
 >>> supplier_invoice.reload()
 >>> supplier_invoice.state
 'posted'
+>>> supplier_invoice.amount_to_pay
+Decimal('0')



[tryton-commits] changeset in tryton:default Eager load at least 1/10 of the clie...

2022-10-02 Thread Nicolas Évrard
changeset 8fdd045ddd51 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset=8fdd045ddd51
description:
Eager load at least 1/10 of the client limit

issue10043
review336131003
diffstat:

 tryton/gui/window/view_form/model/record.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 3f68e6090c44 -r 8fdd045ddd51 tryton/gui/window/view_form/model/record.py
--- a/tryton/gui/window/view_form/model/record.py   Sat Oct 01 14:48:30 
2022 +0200
+++ b/tryton/gui/window/view_form/model/record.py   Mon Oct 03 00:22:51 
2022 +0200
@@ -83,7 +83,7 @@
 
 record_context = self.get_context()
 if loading == 'eager':
-limit = int(CONFIG['client.limit'] / len(fnames))
+limit = CONFIG['client.limit'] // min(len(fnames), 10)
 
 def filter_group(record):
 return (not record.destroyed



[tryton-commits] changeset in trytond:default Schedule actions using server timezone

2022-10-02 Thread Nicolas Évrard
changeset b040256012ac in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=b040256012ac
description:
Schedule actions using server timezone

issue9436
review423091003
diffstat:

 CHANGELOG |   1 +
 doc/ref/tools/index.rst   |   1 +
 doc/ref/tools/timezone.rst|  25 ++
 doc/topics/cron.rst   |   5 ++
 setup.py  |   1 +
 trytond/__init__.py   |   1 +
 trytond/ir/cron.py|   9 +++-
 trytond/ir/view/cron_form.xml |   2 +
 trytond/tests/test_ir.py  |  76 ++-
 trytond/tests/test_tools.py   |  14 +++-
 trytond/tools/timezone.py |  45 +
 11 files changed, 176 insertions(+), 4 deletions(-)

diffs (321 lines):

diff -r f4c77eb02b5b -r b040256012ac CHANGELOG
--- a/CHANGELOG Mon Oct 03 00:15:12 2022 +0200
+++ b/CHANGELOG Mon Oct 03 00:20:49 2022 +0200
@@ -1,3 +1,4 @@
+* Schedule actions using server timezone
 * Reset the user sessions less often
 * Add straight values to wizard state view
 * Add strip option to Char fields
diff -r f4c77eb02b5b -r b040256012ac doc/ref/tools/index.rst
--- a/doc/ref/tools/index.rst   Mon Oct 03 00:15:12 2022 +0200
+++ b/doc/ref/tools/index.rst   Mon Oct 03 00:20:49 2022 +0200
@@ -13,3 +13,4 @@
 email
 singleton
 immutabledict
+timezone
diff -r f4c77eb02b5b -r b040256012ac doc/ref/tools/timezone.rst
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/doc/ref/tools/timezone.rstMon Oct 03 00:20:49 2022 +0200
@@ -0,0 +1,25 @@
+.. _ref-tools-timezone:
+.. module:: trytond.tools.timezone
+
+timezone
+
+
+.. function:: get_tzinfo(zoneid)
+
+   Get a class representing a IANA time zone specified by the string 
``zoneid``.
+
+.. function:: available_timezones()
+
+   Get a list of all the valid IANA keys available.
+
+.. attribute:: UTC
+
+   The UTC :py:class:`datetime.tzinfo` instance.
+
+.. attribute:: SERVER
+
+   The server timezone :py:class:`datetime.tzinfo` instance.
+
+   Tryton tests the environment variables ``TRYTOND_TZ`` and ``TZ`` in this
+   order to select to IANA key to use.
+   If they are both empty, it defaults to ``UTC``.
diff -r f4c77eb02b5b -r b040256012ac doc/topics/cron.rst
--- a/doc/topics/cron.rst   Mon Oct 03 00:15:12 2022 +0200
+++ b/doc/topics/cron.rst   Mon Oct 03 00:20:49 2022 +0200
@@ -11,6 +11,11 @@
 and the interval of time between calls. The method must be a class method of a
 :class:`~trytond.model.Model` which can be called without any parameters.
 
+.. note::
+
+   The timezone used to schedule the action is
+   :attr:`timezone.SERVER `.
+
 To register a new method with the scheduler, you must extend the ``ir.cron``
 model and append the new method to the
 :attr:`~trytond.model.fields.Selection.selection` attribute of the ``method``
diff -r f4c77eb02b5b -r b040256012ac setup.py
--- a/setup.py  Mon Oct 03 00:15:12 2022 +0200
+++ b/setup.py  Mon Oct 03 00:20:49 2022 +0200
@@ -161,6 +161,7 @@
 'werkzeug',
 'wrapt',
 'passlib >= 1.7.0',
+'pytz;python_verrion<"3.9"',
 ],
 extras_require={
 'test': tests_require,
diff -r f4c77eb02b5b -r b040256012ac trytond/__init__.py
--- a/trytond/__init__.py   Mon Oct 03 00:15:12 2022 +0200
+++ b/trytond/__init__.py   Mon Oct 03 00:20:49 2022 +0200
@@ -9,6 +9,7 @@
 
 __version__ = "6.5.0"
 
+os.environ.setdefault('TRYTOND_TZ', os.environ.get('TZ', 'UTC'))
 os.environ['TZ'] = 'UTC'
 if hasattr(time, 'tzset'):
 time.tzset()
diff -r f4c77eb02b5b -r b040256012ac trytond/ir/cron.py
--- a/trytond/ir/cron.pyMon Oct 03 00:15:12 2022 +0200
+++ b/trytond/ir/cron.pyMon Oct 03 00:20:49 2022 +0200
@@ -14,6 +14,7 @@
 from trytond.pool import Pool
 from trytond.pyson import Eval
 from trytond.status import processing
+from trytond.tools import timezone as tz
 from trytond.transaction import Transaction
 from trytond.worker import run_task
 
@@ -66,6 +67,7 @@
 ['minutes', 'hours', 'days', 'weeks']),
 },
 depends=['interval_type'])
+timezone = fields.Function(fields.Char("Timezone"), 'get_timezone')
 
 next_call = fields.DateTime("Next Call", select=True)
 method = fields.Selection([
@@ -97,6 +99,9 @@
 # Migration from 5.0: remove required on next_call
 table_h.not_null_action('next_call', 'remove')
 
+def get_timezone(self, name):
+return tz.SERVER.key
+
 @staticmethod
 def check_xml_record(crons, values):
 return True
@@ -110,7 +115,7 @@
 ]
 
 def compute_next_call(self, now):
-return (now
+return (now.replace(tzinfo=tz.UTC).astimezone(tz.SERVER)
 + relativedelta(**{self.interval_type: self.interval_number})
 + relativedelta(
 microsecond=0,
@@ -132,7 +137,7 @@
 int(self.weekday.index)
 if self.weekday
   

[tryton-commits] changeset in sao:default Eager load at least 1/10 of the client ...

2022-10-02 Thread Nicolas Évrard
changeset 4dacbcf16843 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset=4dacbcf16843
description:
Eager load at least 1/10 of the client limit

issue10043
review336131003
diffstat:

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

diffs (14 lines):

diff -r a963f1896290 -r 4dacbcf16843 src/model.js
--- a/src/model.js  Sat Oct 01 14:45:59 2022 +0200
+++ b/src/model.js  Mon Oct 03 00:22:51 2022 +0200
@@ -681,8 +681,8 @@
 
 var context = jQuery.extend({}, this.get_context());
 if (loading == 'eager') {
-var limit = parseInt(Sao.config.limit / fnames_to_fetch.length,
-10);
+var limit = Math.trunc(Sao.config.limit /
+Math.min(fnames_to_fetch.length, 10));
 
 const filter_group = record => {
 return (!record.destroyed &&



[tryton-commits] changeset in trytond:default Reset less often the user sessions

2022-10-02 Thread Nicolas Évrard
changeset 38bd66006727 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=38bd66006727
description:
Reset less often the user sessions

issue10202
review341741060
diffstat:

 CHANGELOG |   1 +
 trytond/ir/session.py |  42 +-
 2 files changed, 30 insertions(+), 13 deletions(-)

diffs (101 lines):

diff -r 15ef08043b65 -r 38bd66006727 CHANGELOG
--- a/CHANGELOG Sun Oct 02 00:22:56 2022 +0200
+++ b/CHANGELOG Mon Oct 03 00:06:41 2022 +0200
@@ -1,3 +1,4 @@
+* Reset the user sessions less often
 * Add straight values to wizard state view
 * Add strip option to Char fields
 * Strip only one wildcard
diff -r 15ef08043b65 -r 38bd66006727 trytond/ir/session.py
--- a/trytond/ir/session.py Sun Oct 02 00:22:56 2022 +0200
+++ b/trytond/ir/session.py Mon Oct 03 00:06:41 2022 +0200
@@ -4,9 +4,14 @@
 import json
 from secrets import token_hex
 
+from trytond.cache import Cache
 from trytond.config import config
 from trytond.model import ModelSQL, fields
 
+_session_timeout = datetime.timedelta(
+seconds=config.getint('session', 'timeout'))
+_reset_interval = _session_timeout // 10
+
 
 class Session(ModelSQL):
 "Session"
@@ -14,6 +19,7 @@
 _rec_name = 'key'
 
 key = fields.Char('Key', required=True, select=True, strip=False)
+_session_reset_cache = Cache('ir_session.session_reset', context=False)
 
 @classmethod
 def __setup__(cls):
@@ -32,6 +38,13 @@
 return token_hex(nbytes)
 
 @classmethod
+def write(cls, *args):
+super().write(*args)
+for sessions in args[0:None:2]:
+for session in sessions:
+cls._session_reset_cache.set(session.key, session.write_date)
+
+@classmethod
 def new(cls, values=None):
 "Create a new session for the transaction user and return the key."
 if values is None:
@@ -68,17 +81,20 @@
 ('create_uid', '=', user),
 domain or [],
 ])
-find = None
+find, last_reset = None, None
 to_delete = []
 for session in sessions:
 if abs(session.create_date - now) < timeout:
 if session.key == key:
 find = True
+last_reset = session.write_date or session.create_date
 else:
 if find is None and session.key == key:
 find = False
 to_delete.append(session)
 cls.delete(to_delete)
+if find:
+cls._session_reset_cache.set(key, last_reset)
 return find
 
 @classmethod
@@ -105,18 +121,18 @@
 def reset(cls, key, domain=None):
 "Reset key session timestamp"
 now = datetime.datetime.now()
-timeout = datetime.timedelta(
-seconds=config.getint('session', 'timeout'))
-timestamp = now - timeout
-sessions = cls.search([
-('key', '=', key),
-['OR',
-('create_date', '>=', timestamp),
-('write_date', '>=', timestamp),
-],
-domain or [],
-])
-cls.write(sessions, {})
+last_reset = cls._session_reset_cache.get(key)
+if last_reset is None or (now - _reset_interval) > last_reset:
+timestamp = now - _session_timeout
+sessions = cls.search([
+('key', '=', key),
+['OR',
+('create_date', '>=', timestamp),
+('write_date', '>=', timestamp),
+],
+domain or [],
+])
+cls.write(sessions, {})
 
 @classmethod
 def clear(cls, users, domain=None):



[tryton-commits] changeset in trytond:default Clear private caches when dropping ...

2022-10-02 Thread Nicolas Évrard
changeset f4c77eb02b5b in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset=f4c77eb02b5b
description:
Clear private caches when dropping database

issue11744
review413601003
diffstat:

 trytond/backend/postgresql/database.py |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 38bd66006727 -r f4c77eb02b5b trytond/backend/postgresql/database.py
--- a/trytond/backend/postgresql/database.pyMon Oct 03 00:06:41 2022 +0200
+++ b/trytond/backend/postgresql/database.pyMon Oct 03 00:15:12 2022 +0200
@@ -299,6 +299,8 @@
 cursor.execute(SQL("DROP DATABASE {}")
 .format(Identifier(database_name)))
 cls._list_cache.clear()
+cls._has_proc.pop(database_name, None)
+cls._search_full_text_languages.pop(database_name, None)
 
 def get_version(self, connection):
 version = connection.server_version



[tryton-commits] changeset in modules/account_payment_sepa:default Handle multipl...

2022-10-02 Thread Nicolas Évrard
changeset fc8e9d9cb870 in modules/account_payment_sepa:default
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=fc8e9d9cb870
description:
Handle multiple transactions in CAMT054 Ntry tags

issue11672
review413471003
diffstat:

 sepa_handler.py |  84 +---
 1 files changed, 44 insertions(+), 40 deletions(-)

diffs (122 lines):

diff -r e455de0a2feb -r fc8e9d9cb870 sepa_handler.py
--- a/sepa_handler.py   Fri Sep 16 23:37:38 2022 +0200
+++ b/sepa_handler.py   Mon Oct 03 00:13:39 2022 +0200
@@ -35,48 +35,59 @@
 element.clear()
 
 def handle_entry(self, element):
-payments = self.get_payments(element)
-if self.is_returned(element):
-for payment in payments:
-self.set_return_information(payment, element)
-self.Payment.save(payments)
-self.Payment.fail(payments)
-else:
-date_value = self.date_value(element)
+tag = etree.QName(element)
+failed, succeeded = [], []
+date_value = self.date_value(element)
+
+for transaction in element.findall('.//{%s}TxDtls' % tag.namespace):
+payments = self.get_payments(transaction)
+if self.is_returned(transaction):
+for payment in payments:
+self.set_return_information(payment, transaction)
+failed.extend(payments)
+else:
+succeeded.extend(payments)
+
+if failed:
+self.Payment.save(failed)
+self.Payment.fail(failed)
+if succeeded:
 with Transaction().set_context(date_value=date_value):
-self.Payment.succeed(payments)
+self.Payment.succeed(succeeded)
 
 def get_payment_kind(self, element):
-tag = etree.QName(element)
-return self._kinds[
-element.find('./{%s}CdtDbtInd' % tag.namespace).text]
+camt_ns = etree.QName(element).namespace
+for path in [
+'./camt:CdtDbtInd',
+'./ancestor::camt:NtryDtls/camt:Btch/camt:CdtDbtInd',
+'./ancestor::camt:Ntry/camt:CdtDbtInd',
+]:
+cdtdbtind = element.xpath(path, namespaces={'camt': camt_ns})
+if cdtdbtind:
+return self._kinds[cdtdbtind[0].text]
 _kinds = {
 'CRDT': 'payable',
 'DBIT': 'receivable',
 }
 
-def get_payments(self, element):
-tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-# Version 1 doesn't have NtryDtls but directly TxDtls
-details = element.find('./{%s}TxDtls' % tag.namespace)
-if details is None:
-return []
-instr_id = details.find('.//{%s}InstrId' % tag.namespace)
+def get_payments(self, transaction):
+tag = etree.QName(transaction)
+instr_id = transaction.find(
+'.//{%s}InstrId' % tag.namespace)
+end_to_end_id = transaction.find(
+'.//{%s}EndToEndId' % tag.namespace)
+payment_kind = self.get_payment_kind(transaction)
 if instr_id is not None:
-payments = self.Payment.search([
+return self.Payment.search([
 ('sepa_instruction_id', '=', instr_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
-end_to_end_id = details.find('.//{%s}EndToEndId' % tag.namespace)
-if end_to_end_id is not None:
-payments = self.Payment.search([
+elif end_to_end_id is not None:
+return self.Payment.search([
 ('sepa_end_to_end_id', '=', end_to_end_id.text),
-('kind', '=', self.get_payment_kind(element)),
+('kind', '=', payment_kind),
 ])
-return payments
+return []
 
 def date_value(self, element):
 tag = etree.QName(element)
@@ -92,25 +103,18 @@
 
 def is_returned(self, element):
 tag = etree.QName(element)
-details = element.find('./{%s}NtryDtls' % tag.namespace)
-if details is None:
-return
-return_reason = details.find('.//{%s}RtrInf' % tag.namespace)
-if return_reason is None:
-return False
-return True
+return_reason = element.find('.//{%s}RtrInf' % tag.namespace)
+return return_reason is not None
 
 def set_return_information(self, payment, element):
 tag = etree.QName(element)
 
 reason_code = element.find(
-'./{%(ns)s}NtryDtls//{%(ns)s}RtrInf/{%(ns)s}Rsn/{%(ns)s}Cd'
-% {'ns': tag.namespace})
+'.//{%(ns)s}RtrInf/{%(ns)s}Rsn/{%(ns)s}Cd' % {'ns': tag.namespace})
 if 

[tryton-commits] changeset in trytond:6.2 Catch get_connection errors in Cache li...

2022-09-29 Thread Nicolas Évrard
changeset ae0476e33d82 in trytond:6.2
details: https://hg.tryton.org/trytond?cmd=changeset=ae0476e33d82
description:
Catch get_connection errors in Cache listener

issue11563
review411271003
(grafted from 7123014d260c278bd36a25d9c4a7543db553733c)
diffstat:

 trytond/cache.py |  22 +-
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r 7073f9719d8a -r ae0476e33d82 trytond/cache.py
--- a/trytond/cache.py  Thu Sep 15 21:49:12 2022 +0200
+++ b/trytond/cache.py  Sat Sep 17 19:00:48 2022 +0200
@@ -346,15 +346,18 @@
 
 @classmethod
 def _listen(cls, dbname):
-database = backend.Database(dbname)
-if not database.has_channel():
-raise NotImplementedError
+current_thread = threading.current_thread()
+pid = os.getpid()
+conn = None
+try:
+database = backend.Database(dbname)
+if not database.has_channel():
+raise NotImplementedError
 
-logger.info("listening on channel '%s' of '%s'", cls._channel, dbname)
-conn = database.get_connection(autocommit=True)
-pid = os.getpid()
-current_thread = threading.current_thread()
-try:
+logger.info(
+"listening on channel '%s' of '%s'", cls._channel, dbname)
+conn = database.get_connection(autocommit=True)
+
 cursor = conn.cursor()
 cursor.execute('LISTEN "%s"' % cls._channel)
 current_thread.listening = True
@@ -380,7 +383,8 @@
 "cache listener on '%s' crashed", dbname, exc_info=True)
 raise
 finally:
-database.put_connection(conn)
+if conn:
+database.put_connection(conn)
 with cls._listener_lock[pid]:
 if cls._listener.get((pid, dbname)) == current_thread:
 del cls._listener[pid, dbname]



[tryton-commits] changeset in trytond:6.0 Catch get_connection errors in Cache li...

2022-09-29 Thread Nicolas Évrard
changeset ffac357d4312 in trytond:6.0
details: https://hg.tryton.org/trytond?cmd=changeset=ffac357d4312
description:
Catch get_connection errors in Cache listener

issue11563
review411271003
(grafted from 7123014d260c278bd36a25d9c4a7543db553733c)
diffstat:

 trytond/cache.py |  22 +-
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r cb78ca4f66ed -r ffac357d4312 trytond/cache.py
--- a/trytond/cache.py  Thu Sep 15 21:49:12 2022 +0200
+++ b/trytond/cache.py  Sat Sep 17 19:00:48 2022 +0200
@@ -347,15 +347,18 @@
 
 @classmethod
 def _listen(cls, dbname):
-database = backend.Database(dbname)
-if not database.has_channel():
-raise NotImplementedError
+current_thread = threading.current_thread()
+pid = os.getpid()
+conn = None
+try:
+database = backend.Database(dbname)
+if not database.has_channel():
+raise NotImplementedError
 
-logger.info("listening on channel '%s' of '%s'", cls._channel, dbname)
-conn = database.get_connection(autocommit=True)
-pid = os.getpid()
-current_thread = threading.current_thread()
-try:
+logger.info(
+"listening on channel '%s' of '%s'", cls._channel, dbname)
+conn = database.get_connection(autocommit=True)
+
 cursor = conn.cursor()
 cursor.execute('LISTEN "%s"' % cls._channel)
 current_thread.listening = True
@@ -381,7 +384,8 @@
 "cache listener on '%s' crashed", dbname, exc_info=True)
 raise
 finally:
-database.put_connection(conn)
+if conn:
+database.put_connection(conn)
 with cls._listener_lock[pid]:
 if cls._listener.get((pid, dbname)) == current_thread:
 del cls._listener[pid, dbname]



[tryton-commits] changeset in tryton:6.4 Select the clicked line when activating ...

2022-09-29 Thread Nicolas Évrard
changeset 60e29b9f6321 in tryton:6.4
details: https://hg.tryton.org/tryton?cmd=changeset=60e29b9f6321
description:
Select the clicked line when activating a button in list view

issue11212
review433141003
(grafted from e97626052a77e58d84dafbe11c32f7ccea4fdfaa)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 26069b017018 -r 60e29b9f6321 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Thu Sep 01 
22:07:13 2022 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Sat Sep 17 
18:58:55 2022 +0200
@@ -1305,11 +1305,17 @@
 store = self.view.treeview.get_model()
 record = store.get_value(store.get_iter(path), 0)
 
+if self.view.record and self.view.record != record:
+widget.stop_emission_by_name('clicked')
+return True
+
 state_changes = record.expr_eval(
 self.attrs.get('states', {}))
 if state_changes.get('invisible') \
 or state_changes.get('readonly'):
 return True
+
+self.view.treeview.set_cursor(path)
 widget.handler_block_by_func(self.button_clicked)
 try:
 self.view.screen.button(self.attrs)



[tryton-commits] changeset in tryton:6.2 Select the clicked line when activating ...

2022-09-29 Thread Nicolas Évrard
changeset 5ad7f307f7e5 in tryton:6.2
details: https://hg.tryton.org/tryton?cmd=changeset=5ad7f307f7e5
description:
Select the clicked line when activating a button in list view

issue11212
review433141003
(grafted from e97626052a77e58d84dafbe11c32f7ccea4fdfaa)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r b0a43b934892 -r 5ad7f307f7e5 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Thu Sep 01 
22:07:13 2022 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Sat Sep 17 
18:58:55 2022 +0200
@@ -1305,11 +1305,17 @@
 store = self.view.treeview.get_model()
 record = store.get_value(store.get_iter(path), 0)
 
+if self.view.record and self.view.record != record:
+widget.stop_emission_by_name('clicked')
+return True
+
 state_changes = record.expr_eval(
 self.attrs.get('states', {}))
 if state_changes.get('invisible') \
 or state_changes.get('readonly'):
 return True
+
+self.view.treeview.set_cursor(path)
 widget.handler_block_by_func(self.button_clicked)
 try:
 self.view.screen.button(self.attrs)



[tryton-commits] changeset in tryton:5.0 Select the clicked line when activating ...

2022-09-29 Thread Nicolas Évrard
changeset 58e384fcce26 in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset=58e384fcce26
description:
Select the clicked line when activating a button in list view

issue11212
review433141003
(grafted from e97626052a77e58d84dafbe11c32f7ccea4fdfaa)
diffstat:

 tryton/gui/window/view_form/view/list_gtk/widget.py |  6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 26f5b60e9b97 -r 58e384fcce26 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py   Tue Sep 06 
23:31:24 2022 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py   Sat Sep 17 
18:58:55 2022 +0200
@@ -1008,11 +1008,17 @@
 store = self.view.treeview.get_model()
 record = store.get_value(store.get_iter(path), 0)
 
+if self.view.record and self.view.record != record:
+widget.stop_emission_by_name('clicked')
+return True
+
 state_changes = record.expr_eval(
 self.attrs.get('states', {}))
 if state_changes.get('invisible') \
 or state_changes.get('readonly'):
 return True
+
+self.view.treeview.set_cursor(path)
 widget.handler_block_by_func(self.button_clicked)
 try:
 self.view.screen.button(self.attrs)



[tryton-commits] changeset in trytond:6.4 Catch get_connection errors in Cache li...

2022-09-29 Thread Nicolas Évrard
changeset a87d1206c5cc in trytond:6.4
details: https://hg.tryton.org/trytond?cmd=changeset=a87d1206c5cc
description:
Catch get_connection errors in Cache listener

issue11563
review411271003
(grafted from 7123014d260c278bd36a25d9c4a7543db553733c)
diffstat:

 trytond/cache.py |  26 --
 1 files changed, 16 insertions(+), 10 deletions(-)

diffs (45 lines):

diff -r a1b42a36e1f7 -r a87d1206c5cc trytond/cache.py
--- a/trytond/cache.py  Thu Sep 15 21:49:12 2022 +0200
+++ b/trytond/cache.py  Sat Sep 17 19:00:48 2022 +0200
@@ -348,16 +348,20 @@
 
 @classmethod
 def _listen(cls, dbname):
-database = backend.Database(dbname)
-if not database.has_channel():
-raise NotImplementedError
+current_thread = threading.current_thread()
+pid = os.getpid()
 
-logger.info("listening on channel '%s' of '%s'", cls._channel, dbname)
-conn = database.get_connection(autocommit=True)
-pid = os.getpid()
-selector = selectors.DefaultSelector()
-current_thread = threading.current_thread()
+conn, selector = None, None
 try:
+database = backend.Database(dbname)
+if not database.has_channel():
+raise NotImplementedError
+
+logger.info(
+"listening on channel '%s' of '%s'", cls._channel, dbname)
+conn = database.get_connection(autocommit=True)
+selector = selectors.DefaultSelector()
+
 cursor = conn.cursor()
 cursor.execute('LISTEN "%s"' % cls._channel)
 current_thread.listening = True
@@ -380,8 +384,10 @@
 "cache listener on '%s' crashed", dbname, exc_info=True)
 raise
 finally:
-selector.close()
-database.put_connection(conn)
+if selector:
+selector.close()
+if conn:
+database.put_connection(conn)
 with cls._listener_lock[pid]:
 if cls._listener.get((pid, dbname)) == current_thread:
 del cls._listener[pid, dbname]



<    1   2   3   4   5   >