From 8a84f96641c6f0330a420ad0943c42ff24a0f4f1 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 9 May 2019 12:04:39 +0000 Subject: [PATCH 1/5] [FIX] sale: timesheet in hours - Create a SO - Add a product service that will generate a task to the confirmation. Its UOM must be Hour(s) - Confirm the so an go into the task - Add a timesheet line with "00h20min" and save it Quantity saved into the delivery qty of the SO is 0.34 instead of 0.33. The default rounding method is `UP`, so we use `HALF-UP` instead. opw-1975014 closes odoo/odoo#33276 Signed-off-by: Nicolas Martinelli (nim) --- addons/sale/models/sale_analytic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/sale_analytic.py b/addons/sale/models/sale_analytic.py index 77c2bb0f8c6..e2c5f53c324 100644 --- a/addons/sale/models/sale_analytic.py +++ b/addons/sale/models/sale_analytic.py @@ -34,7 +34,7 @@ class SaleOrderLine(models.Model): lines.setdefault(line, 0.0) uom = self.env['product.uom'].browse(d['product_uom_id'][0]) if line.product_uom.category_id == uom.category_id: - qty = uom._compute_quantity(d['unit_amount'], line.product_uom) + qty = uom._compute_quantity(d['unit_amount'], line.product_uom, rounding_method='HALF-UP') else: qty = d['unit_amount'] lines[line] += qty From 394642e1dc31b18b32c3b3f37774a4d5e531fd46 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 10 May 2019 15:29:21 +0000 Subject: [PATCH 2/5] [FIX] base: do not recompute `res.users.share` on add/remove multi-company This is a performance patch. Writing on the field `users` of `res.groups` had the side effect to recompute the field `share` of `res.users`. This is because the trigger of this field is `@api.depends('groups_id')`. The more users you had, the more time it took to add or remove the second company of a user. This also slowed down the creation of employee users when the multi-company group was added to the inherited groups of the employee group (basically when checking "Multi-Company" in the General Settings) as then all new employee matched the condition `if len(user.company_ids) <= 1 and user.id in group_multi_company.users.ids:` (Multi-Company group checked, but only one company set, by default). closes odoo/odoo#33305 Signed-off-by: Denis Ledoux --- odoo/addons/base/res/res_users.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/odoo/addons/base/res/res_users.py b/odoo/addons/base/res/res_users.py index 12b31da37ec..98c57af7760 100644 --- a/odoo/addons/base/res/res_users.py +++ b/odoo/addons/base/res/res_users.py @@ -853,9 +853,9 @@ class UsersView(models.Model): group_multi_company = self.env.ref('base.group_multi_company', False) if group_multi_company and 'company_ids' in values: if len(user.company_ids) <= 1 and user.id in group_multi_company.users.ids: - group_multi_company.write({'users': [(3, user.id)]}) + user.write({'groups_id': [(3, group_multi_company.id)]}) elif len(user.company_ids) > 1 and user.id not in group_multi_company.users.ids: - group_multi_company.write({'users': [(4, user.id)]}) + user.write({'groups_id': [(4, group_multi_company.id)]}) return user @api.multi @@ -866,9 +866,9 @@ class UsersView(models.Model): if group_multi_company and 'company_ids' in values: for user in self: if len(user.company_ids) <= 1 and user.id in group_multi_company.users.ids: - group_multi_company.write({'users': [(3, user.id)]}) + user.write({'groups_id': [(3, group_multi_company.id)]}) elif len(user.company_ids) > 1 and user.id not in group_multi_company.users.ids: - group_multi_company.write({'users': [(4, user.id)]}) + user.write({'groups_id': [(4, group_multi_company.id)]}) return res def _remove_reified_groups(self, values): From 9054d23d02d09dc44520c9da9c10c1e664374b95 Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Tue, 2 Oct 2018 11:26:36 +0000 Subject: [PATCH 3/5] [FIX] stock: inventory display archived product Usecase to reproduce: - Archive a stockable product with quantity on hand - Start an inventory with all products. -> Archived product is displayed It happens because the search is an SQL request that is build and it thus does not benefits from the automatic search on active objects. This commit add an active search on quant for inventory lines. closes odoo/odoo#33077 backport odoo/odoo#27384 from 11.0 closes odoo/odoo#33098 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock/models/stock_inventory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index ed3d354b295..84a50bdb4d0 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -224,7 +224,7 @@ class Inventory(models.Model): def _get_inventory_lines_values(self): # TDE CLEANME: is sql really necessary ? I don't think so locations = self.env['stock.location'].search([('id', 'child_of', [self.location_id.id])]) - domain = ' location_id in %s' + domain = ' location_id in %s AND active = TRUE' args = (tuple(locations.ids),) vals = [] @@ -265,6 +265,8 @@ class Inventory(models.Model): self.env.cr.execute("""SELECT product_id, sum(qty) as product_qty, location_id, lot_id as prod_lot_id, package_id, owner_id as partner_id FROM stock_quant + LEFT JOIN product_product + ON product_product.id = stock_quant.product_id WHERE %s GROUP BY product_id, location_id, lot_id, package_id, partner_id """ % domain, args) From b03af37462c6b1fc1f3be7907871c0562ad5c0db Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Tue, 8 Jan 2019 13:59:25 +0000 Subject: [PATCH 4/5] [FIX] point_of_sale: negative value payment before fix negative values will be added after -0.00 resulting in a value like for instance -0.008543 while is should be -8543.00. Also when removing the value there will be a traceback for '-' not being a number. added extra checks for negative values on input. resolves https://github.com/odoo/odoo/issues/29910 resolves https://github.com/odoo/odoo/issues/29909 closes odoo/odoo#30035 Signed-off-by: Nicolas Martinelli (nim) --- addons/point_of_sale/static/src/js/gui.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/gui.js b/addons/point_of_sale/static/src/js/gui.js index 6107d3a979e..fdc73a13987 100644 --- a/addons/point_of_sale/static/src/js/gui.js +++ b/addons/point_of_sale/static/src/js/gui.js @@ -457,7 +457,9 @@ var Gui = core.Class.extend({ newbuf = newbuf.substring(1,newbuf.length); } } else if (input === '-') { - if ( newbuf[0] === '-' ) { + if (options.firstinput) { + newbuf = '-0'; + } else if ( newbuf[0] === '-' ) { newbuf = newbuf.substring(1,newbuf.length); } else { newbuf = '-' + newbuf; @@ -471,6 +473,9 @@ var Gui = core.Class.extend({ newbuf += input; } } + if (newbuf === "-") { + newbuf = ""; + } // End of input buffer at 12 characters. if (newbuf.length > buffer.length && newbuf.length > 12) { From 2a14eea095e9758eaba4d1bee1e0783c7a9c3304 Mon Sep 17 00:00:00 2001 From: Johan Demaret Rivarola Date: Mon, 13 May 2019 15:35:31 +0000 Subject: [PATCH 5/5] [FIX] website_{crm_partner_assign,customer}: fix 404 when crawling When website_customer is not installed, some endpoints are not handled by the router, causing the following tests to fail: - test_10_crawl_public - test_20_crawl_demo - test_30_crawl_admin Those tests were failing due to /customers responding with 404. Indeed, the route /customers is defined in website_customer, but had some usage within website_crm_partner_assign, causing tests to fail when the former module is not installed. The new behavior can be explained as follows: - module website_crm_partner_assign on its own will lose the hyperlink. - module website_customer will now inherit the view definition in order to wrap the targeted HTML text elements with an anchor tag. Closes #33344 Signed-off-by: Christophe Simonis --- .../views/website_crm_partner_assign_templates.xml | 12 +++--------- .../views/website_customer_templates.xml | 9 +++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml index cbae6b073e1..3806cce6491 100644 --- a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml +++ b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml @@ -170,18 +170,12 @@ diff --git a/addons/website_customer/views/website_customer_templates.xml b/addons/website_customer/views/website_customer_templates.xml index d4c743cdcd5..81b83e89e1d 100644 --- a/addons/website_customer/views/website_customer_templates.xml +++ b/addons/website_customer/views/website_customer_templates.xml @@ -208,4 +208,13 @@ + +