From 7a63d471edec45a106fef5f783aeb7eaf43447f6 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 22 Jan 2018 12:04:27 +0100 Subject: [PATCH 1/9] [FIX] website_event_track: use event timezone Depending on the location, on the website different timezone were used to display tracks: - in `Agenda` day date (as of saas-14): the current user timezone - in `Agenda` track times: the event timezone - in `Talks` subtitle: the event timezone - in `Talks` tracks: the current user timezone - in a track page: the first user (admin) timezone With this change in all those instance the event timezone is used. There is still a usability hindrance in the backend: the timezone used when encoding track or event datetime is the browser timezone. So if the browser is GMT+2 and the event is GMT+6, encoding a 4h00 time would save it as 2h00 (in UTC) and display it on the website as 8h00. This would make sense to encode these datetime in user timezone but currently there is no framework option to do it. opw-805358 closes #22427 --- addons/website_event_track/controllers/main.py | 4 +++- .../views/website_event_track_templates.xml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/website_event_track/controllers/main.py b/addons/website_event_track/controllers/main.py index 296ba70ecc6..cf69304a87c 100644 --- a/addons/website_event_track/controllers/main.py +++ b/addons/website_event_track/controllers/main.py @@ -14,7 +14,7 @@ class WebsiteEventTrackController(http.Controller): @http.route(['''/event//track/
Date
-
+ + () +
Duration

Location
From 779afb7ac534f003eee0cf3fd0afae401682095d Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 19 Jan 2018 15:47:02 +0100 Subject: [PATCH 2/9] [FIX] point_of_sale: pos manager should have unlink rights --- addons/point_of_sale/security/ir.model.access.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/security/ir.model.access.csv b/addons/point_of_sale/security/ir.model.access.csv index b83298d0c09..48dfef83314 100644 --- a/addons/point_of_sale/security/ir.model.access.csv +++ b/addons/point_of_sale/security/ir.model.access.csv @@ -28,7 +28,7 @@ access_product_category_manager,product.category manager,product.model_product_c access_product_pricelist_manager,product.pricelist manager,product.model_product_pricelist,group_pos_manager,1,0,0,0 access_pos_session_user,pos.session user,model_pos_session,group_pos_user,1,1,1,0 access_pos_config_user,pos.config user,model_pos_config,group_pos_user,1,0,0,0 -access_pos_config_manager,pos.config user,model_pos_config,group_pos_manager,1,1,1,0 +access_pos_config_manager,pos.config manager,model_pos_config,group_pos_manager,1,1,1,1 access_product_category_pos_manager,pos.category manager,model_pos_category,group_pos_manager,1,1,1,1 access_product_category_pos_user,pos.category user,model_pos_category,group_pos_user,1,0,0,0 access_barcode_nomenclature_pos_user,barcode.nomenclature.pos.user,barcodes.model_barcode_nomenclature,group_pos_user,1,0,0,0 From 296c5a2106950b57445c4fd1cb6cac4cd4be15af Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 17 Jan 2018 13:31:59 +0100 Subject: [PATCH 3/9] [FIX] point_of_sale: automatic reconciliation with returns In the case where: 1- Do an order on the pos selling a product A (amount = 10) 2- Do another order returning a certain quantity of A (with a quantity < 0) 3- Do a third order selling something else (amount = 5) Before this commit, the account move lines of the payment move and of the sale move of operation 2 weren't reconciled This was because the credit to the receivable account of the return was reconciled with the debit of the first operation, leaving the debit of the payment of the return alone (i. e. the lines number 1 & 3 & 5 were reconciled together, instead of 1 & 2 & 5, and 3 & 4) We end up in a situation like this (at validation time) RECEIVABLE D | C || OPERATION | Line Number ---------------------------------------------------------------------------- 15 | || (1 & 3-Engaging Sale) | 1 | 10 || (1-Payment) | 2 | 10 || (2-Engaging Return) | 3 10 | || (2-Payment Return) | 4 | 5 || (3-Payment) | 5 After this commit, we reconcile the returns for each order before reconciling other transaction chains The fix is limited in its scope as the automatic reconciliation for the pos transaction is fairly recent and a "nice to have" OPW 787298 --- addons/point_of_sale/models/pos_order.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 94d198c0f3d..ca379710e9d 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -339,15 +339,22 @@ class PosOrder(models.Model): for order in self: aml = order.statement_ids.mapped('journal_entry_ids').mapped('line_ids') | order.account_move.line_ids | order.invoice_id.move_id.line_ids aml = aml.filtered(lambda r: not r.reconciled and r.account_id.internal_type == 'receivable' and r.partner_id == order.partner_id.commercial_partner_id) + + # Reconcile returns first + # to avoid mixing up the credit of a payment and the credit of a return + # in the receivable account + aml_returns = aml.filtered(lambda l: (l.journal_id.type == 'sale' and l.credit) or (l.journal_id.type != 'sale' and l.debit)) try: - aml.reconcile() + aml_returns.reconcile() + (aml - aml_returns).reconcile() except: # There might be unexpected situations where the automatic reconciliation won't # work. We don't want the user to be blocked because of this, since the automatic # reconciliation is introduced for convenience, not for mandatory accounting # reasons. - _logger.error('Reconciliation did not work for order %s', order.name) - continue + # It may be interesting to have the Traceback logged anyway + # for debugging and support purposes + _logger.exception('Reconciliation did not work for order %s', order.name) def _default_session(self): return self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)], limit=1) From b3b8a471cc3e02488dcc0da991fd1d828978220d Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Thu, 21 Dec 2017 13:38:41 +0100 Subject: [PATCH 4/9] [FIX] stock: To avoid singleton error In this way, it ensures that a single record is used when calling the function _get_move_values opw:806668 --- addons/stock/models/stock_inventory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index c6bfc0549dd..81d273da48e 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -454,9 +454,9 @@ class InventoryLine(models.Model): continue diff = line.theoretical_qty - line.product_qty if diff < 0: # found more than expected - vals = self._get_move_values(abs(diff), line.product_id.property_stock_inventory.id, line.location_id.id) + vals = line._get_move_values(abs(diff), line.product_id.property_stock_inventory.id, line.location_id.id) else: - vals = self._get_move_values(abs(diff), line.location_id.id, line.product_id.property_stock_inventory.id) + vals = line._get_move_values(abs(diff), line.location_id.id, line.product_id.property_stock_inventory.id) move = moves.create(vals) if diff > 0: From 822a5e9085ebb2a774c44ca9b5d91d006f379968 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 23 Jan 2018 13:37:06 +0100 Subject: [PATCH 5/9] [FIX] account: default FY day and month In any piece of code, execute the following: ``` self.env['account.config.settings'].create({}) ``` It overwrites the values of `fiscalyear_last_day` and `fiscalyear_last_month` to 31 and 12. Setting a default value on a related field will automatically write these values on the related. opw-805205 --- addons/account/models/res_config.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py index a14a05dc265..1d10392719d 100644 --- a/addons/account/models/res_config.py +++ b/addons/account/models/res_config.py @@ -15,6 +15,12 @@ class AccountConfigSettings(models.TransientModel): _name = 'account.config.settings' _inherit = 'res.config.settings' + def _default_fiscalyear_last_day(self): + return self.env.user.company_id.fiscalyear_last_day or 31 + + def _default_fiscalyear_last_month(self): + return self.env.user.company_id.fiscalyear_last_month or 12 + @api.one @api.depends('company_id') def _get_currency_id(self): @@ -70,8 +76,10 @@ class AccountConfigSettings(models.TransientModel): the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete''') - fiscalyear_last_day = fields.Integer(related='company_id.fiscalyear_last_day', default=31) - fiscalyear_last_month = fields.Selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')], related='company_id.fiscalyear_last_month', default=12) + fiscalyear_last_day = fields.Integer(related='company_id.fiscalyear_last_day', + default=lambda self: self._default_fiscalyear_last_day()) + fiscalyear_last_month = fields.Selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')], + related='company_id.fiscalyear_last_month', default=lambda self: self._default_fiscalyear_last_month()) period_lock_date = fields.Date(string="Lock Date for Non-Advisers", related='company_id.period_lock_date', help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date. Use it for period locking inside an open fiscal year, for example.") fiscalyear_lock_date = fields.Date(string="Lock Date", related='company_id.fiscalyear_lock_date', help="No users, including Advisers, can edit accounts prior to and inclusive of this date. Use it for fiscal year locking for example.") From bc69b470731480d5add57c4441599a1f7d639a6c Mon Sep 17 00:00:00 2001 From: tbe-odoo Date: Tue, 26 Dec 2017 12:16:08 +0100 Subject: [PATCH 6/9] [FIX] http: Implicit session deactivation -> Explicit destruction - Replace the implicit session deactivation with explicit destruction. --- odoo/addons/base/res/res_users.py | 8 +++++++- odoo/http.py | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/odoo/addons/base/res/res_users.py b/odoo/addons/base/res/res_users.py index 8a79813ba96..a68abf41026 100644 --- a/odoo/addons/base/res/res_users.py +++ b/odoo/addons/base/res/res_users.py @@ -14,6 +14,7 @@ from odoo.exceptions import AccessDenied, AccessError, UserError, ValidationErro from odoo.osv import expression from odoo.service.db import check_super from odoo.tools import partition +from odoo.http import root _logger = logging.getLogger(__name__) @@ -372,6 +373,8 @@ class Users(models.Model): if any(key.startswith('context_') or key in ('lang', 'tz') for key in values): self.context_get.clear_cache(self) if any(key in values for key in ['active'] + USER_PRIVATE_FIELDS): + # force deletion of all sessions for these users + root.session_store.delete_sessions_for_uids(self.ids) db = self._cr.dbname for id in self.ids: self.__uid_cache[db].pop(id, None) @@ -385,7 +388,10 @@ class Users(models.Model): db = self._cr.dbname for id in self.ids: self.__uid_cache[db].pop(id, None) - return super(Users, self).unlink() + res = super(Users, self).unlink() + # force deletion of all sessions for these users + root.session_store.delete_sessions_for_uids(self.ids) + return res @api.model def name_search(self, name='', args=None, operator='ilike', limit=100): diff --git a/odoo/http.py b/odoo/http.py index 56b1f8e6930..46d744f2f36 100644 --- a/odoo/http.py +++ b/odoo/http.py @@ -1040,7 +1040,6 @@ class OpenERPSession(werkzeug.contrib.sessions.Session): self.db = db self.uid = uid self.login = login - self.password = password request.uid = uid request.disable_db = False @@ -1055,7 +1054,6 @@ class OpenERPSession(werkzeug.contrib.sessions.Session): """ if not self.db or not self.uid: raise SessionExpiredException("Session expired") - security.check(self.db, self.uid, self.password) def logout(self, keep_db=False): for k in self.keys(): @@ -1068,7 +1066,6 @@ class OpenERPSession(werkzeug.contrib.sessions.Session): self.setdefault("db", None) self.setdefault("uid", None) self.setdefault("login", None) - self.setdefault("password", None) self.setdefault("context", {}) def get_context(self): @@ -1281,6 +1278,17 @@ class DisableCacheMiddleware(object): start_response(status, new_headers) return self.app(environ, start_wrapped) +class OdooSessionStore(werkzeug.contrib.sessions.FilesystemSessionStore): + def delete_sessions_for_uids(self, uids): + # pretty expensive on large session stores, especially non-local! + uids = set(uids) + _logger.info('Deleting all HTTP sessions for UIDs %s', uids) + for sid in self.list(): + s = self.get(sid) + if s.uid and s.uid in uids: + _logger.debug('Deleting session %s', sid) + self.delete(s) + class Root(object): """Root WSGI application for the OpenERP Web Client. """ @@ -1292,7 +1300,7 @@ class Root(object): # Setup http sessions path = odoo.tools.config.session_dir _logger.debug('HTTP sessions stored in: %s', path) - return werkzeug.contrib.sessions.FilesystemSessionStore(path, session_class=OpenERPSession) + return OdooSessionStore(path, session_class=OpenERPSession) @lazy_property def nodb_routing_map(self): From 1ac7257dd24492a294f14903baaab68a1058a73a Mon Sep 17 00:00:00 2001 From: Sergei Ruzki Date: Wed, 17 Jan 2018 18:39:20 +0300 Subject: [PATCH 7/9] [CLA] signature for sergeiruzkiicode Done at #22307 --- doc/cla/individual/sergeiruzkiicode.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/sergeiruzkiicode.md diff --git a/doc/cla/individual/sergeiruzkiicode.md b/doc/cla/individual/sergeiruzkiicode.md new file mode 100644 index 00000000000..44af0359a97 --- /dev/null +++ b/doc/cla/individual/sergeiruzkiicode.md @@ -0,0 +1,11 @@ +Belarus, 2017-01-17 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Sergei Ruzki sergei.ruzki@icode.by https://github.com/sergeiruzkiicode From 53e221fc169ba54c677b356379e93a933340883c Mon Sep 17 00:00:00 2001 From: Sergei Ruzki Date: Wed, 17 Jan 2018 18:22:25 +0300 Subject: [PATCH 8/9] [FIX] base: adding BYN to currenciest list From 2016-07-01 BYN is new currency sign for Belarus See https://en.wikipedia.org/wiki/Belarusian_ruble BYR is no longer used. Kept for backward compatibility and stability reason Closes #22307 --- odoo/addons/base/res/res_country_data.xml | 4 ++-- odoo/addons/base/res/res_currency_data.xml | 9 +++++++++ odoo/addons/base/res/res_currency_demo.xml | 6 ++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/odoo/addons/base/res/res_country_data.xml b/odoo/addons/base/res/res_country_data.xml index 59808f3d6ab..5da077bc962 100644 --- a/odoo/addons/base/res/res_country_data.xml +++ b/odoo/addons/base/res/res_country_data.xml @@ -258,8 +258,8 @@ Belarus by - - + + Belize diff --git a/odoo/addons/base/res/res_currency_data.xml b/odoo/addons/base/res/res_currency_data.xml index 8b108fa978d..6785bc98c00 100644 --- a/odoo/addons/base/res/res_currency_data.xml +++ b/odoo/addons/base/res/res_currency_data.xml @@ -406,6 +406,15 @@ BR 0.01 + Ruble BYR + Kapeyka + + + + BYN + Br + 0.01 + diff --git a/odoo/addons/base/res/res_currency_demo.xml b/odoo/addons/base/res/res_currency_demo.xml index a6e406e783d..ba316d0a7db 100644 --- a/odoo/addons/base/res/res_currency_demo.xml +++ b/odoo/addons/base/res/res_currency_demo.xml @@ -349,6 +349,12 @@ 10228.19 + + + 2016-07-01 + 2.23151 + + 2010-01-01 From 0ac6043ec746ef4c4d4ddb66edc93c0ae098ca0b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 24 Jan 2018 11:39:56 +0100 Subject: [PATCH 9/9] [FIX] base: bad back-port 53e221fc was intended for 11.0 and backported too quickly in 10.0 Remove fields that do not exist yet --- odoo/addons/base/res/res_currency_data.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/odoo/addons/base/res/res_currency_data.xml b/odoo/addons/base/res/res_currency_data.xml index 6785bc98c00..8746f4d0b1b 100644 --- a/odoo/addons/base/res/res_currency_data.xml +++ b/odoo/addons/base/res/res_currency_data.xml @@ -406,8 +406,6 @@ BR 0.01 - Ruble BYR - Kapeyka