From 42230ed22efdbc58fbaf3fdfb753560b1c4cdb2a Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 20 Dec 2018 12:01:53 +0100 Subject: [PATCH 1/3] [FIX] website_sale: make eCommerce animations work in all browsers The eCommerce sometimes animates product images when they are put in the cart / wishlist / comparison panel. Those animations did not work on Firefox and IE and made strange scrollbars appear instead. --- addons/website_sale/static/src/css/website_sale.css | 2 +- addons/website_sale/static/src/css/website_sale.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/static/src/css/website_sale.css b/addons/website_sale/static/src/css/website_sale.css index 8f71e5bbfbd..78c6e86126e 100644 --- a/addons/website_sale/static/src/css/website_sale.css +++ b/addons/website_sale/static/src/css/website_sale.css @@ -643,7 +643,7 @@ a.no-decoration { .o_website_sale_animate { opacity: 0.7; - position: absolute; + position: absolute !important; height: 150px; width: 150px; z-index: 1020; diff --git a/addons/website_sale/static/src/css/website_sale.sass b/addons/website_sale/static/src/css/website_sale.sass index 3c1abfeb323..3bf9b0e8c97 100644 --- a/addons/website_sale/static/src/css/website_sale.sass +++ b/addons/website_sale/static/src/css/website_sale.sass @@ -567,7 +567,7 @@ a.no-decoration .o_website_sale_animate opacity: 0.7 - position: absolute + position: absolute !important height: 150px width: 150px z-index: 1020 From b131658966a347ec0058b713610e123347799cd7 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 8 Jan 2019 10:48:20 +0000 Subject: [PATCH 2/3] [FIX] account: error in Base amount tax opw-1917605 Before this commit, when accounting is set to global rounding, the base amount per tax is not correctly calculated. Now, the Base amount per tax is calculated adding the rounded lines. To test this issue, you need to set to global rounding and create a customer invoice with the following lines : line 1 = Qty:40; unit price:2.27; tax:15%; discount: 10% line 2 = Qty:21; unit price:2.77; tax:15%; discount: 10% line 3 = Qty:21; unit price:2.77; tax:15%; discount: 10% When the invoce is printed, you would notice that the amount is 186.43 and it should be 186.42. closes odoo/odoo#30021 --- addons/account/models/account_invoice.py | 4 +- .../tests/test_account_customer_invoice.py | 63 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 240d63ea7fc..aff495072ce 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -642,6 +642,7 @@ class AccountInvoice(models.Model): @api.multi def get_taxes_values(self): tax_grouped = {} + round_curr = self.currency_id.round for line in self.invoice_line_ids: price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0) taxes = line.invoice_line_tax_ids.compute_all(price_unit, self.currency_id, line.quantity, line.product_id, self.partner_id)['taxes'] @@ -651,9 +652,10 @@ class AccountInvoice(models.Model): if key not in tax_grouped: tax_grouped[key] = val + tax_grouped[key]['base'] = round_curr(val['base']) else: tax_grouped[key]['amount'] += val['amount'] - tax_grouped[key]['base'] += val['base'] + tax_grouped[key]['base'] += round_curr(val['base']) return tax_grouped @api.multi diff --git a/addons/account/tests/test_account_customer_invoice.py b/addons/account/tests/test_account_customer_invoice.py index 0c559892644..12a164cd3cb 100644 --- a/addons/account/tests/test_account_customer_invoice.py +++ b/addons/account/tests/test_account_customer_invoice.py @@ -107,3 +107,66 @@ class TestAccountCustomerInvoice(AccountTestUsers): # I clicked on refund button. self.account_invoice_refund_0.invoice_refund() + + def test_customer_invoice_tax(self): + + self.env.user.company_id.tax_calculation_rounding_method = 'round_globally' + + payment_term = self.env.ref('account.account_payment_term_advance') + journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0] + partner3 = self.env.ref('base.res_partner_3') + account_id = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id + + tax = self.env['account.tax'].create({ + 'name': 'Tax 15.0', + 'amount': 15.0, + 'amount_type': 'percent', + 'type_tax_use': 'sale', + }) + + invoice_line_data = [ + (0, 0, + { + 'product_id': self.env.ref('product.product_product_1').id, + 'quantity': 40.0, + 'account_id': account_id, + 'name': 'product test 1', + 'discount' : 10.00, + 'price_unit': 2.27, + 'invoice_line_tax_ids': [(6, 0, [tax.id])], + } + ), + (0, 0, + { + 'product_id': self.env.ref('product.product_product_2').id, + 'quantity': 21.0, + 'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id, + 'name': 'product test 2', + 'discount' : 10.00, + 'price_unit': 2.77, + 'invoice_line_tax_ids': [(6, 0, [tax.id])], + } + ), + (0, 0, + { + 'product_id': self.env.ref('product.product_product_3').id, + 'quantity': 21.0, + 'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id, + 'name': 'product test 3', + 'discount' : 10.00, + 'price_unit': 2.77, + 'invoice_line_tax_ids': [(6, 0, [tax.id])], + } + ) + ] + + invoice = self.env['account.invoice'].create(dict( + name="Test Customer Invoice", + reference_type="none", + payment_term_id=payment_term.id, + journal_id=journalrec.id, + partner_id=partner3.id, + invoice_line_ids=invoice_line_data + )) + + self.assertEquals(invoice.amount_untaxed, sum([x.base for x in invoice.tax_line_ids])) From 5f12e244f6e57b8edb56788147774150e2ae134d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 10 Jan 2019 13:48:40 +0000 Subject: [PATCH 3/3] [IMP] base: compute implied groups in SQL SQL improve the speed of the implied group VS the orm version. closes odoo/odoo#30108 --- odoo/addons/base/res/res_users.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/odoo/addons/base/res/res_users.py b/odoo/addons/base/res/res_users.py index 8c7194d4279..12b31da37ec 100644 --- a/odoo/addons/base/res/res_users.py +++ b/odoo/addons/base/res/res_users.py @@ -657,8 +657,26 @@ class GroupsImplied(models.Model): if values.get('users') or values.get('implied_ids'): # add all implied groups (to all users of each group) for group in self: - vals = {'users': zip(repeat(4), group.with_context(active_test=False).users.ids)} - super(GroupsImplied, group.trans_implied_ids).write(vals) + self._cr.execute(""" + WITH RECURSIVE group_imply(gid, hid) AS ( + SELECT gid, hid + FROM res_groups_implied_rel + UNION + SELECT i.gid, r.hid + FROM res_groups_implied_rel r + JOIN group_imply i ON (i.hid = r.gid) + ) + INSERT INTO res_groups_users_rel (gid, uid) + SELECT i.hid, r.uid + FROM group_imply i, res_groups_users_rel r + WHERE r.gid = i.gid + AND i.gid = %(gid)s + EXCEPT + SELECT r.gid, r.uid + FROM res_groups_users_rel r + JOIN group_imply i ON (r.gid = i.hid) + WHERE i.gid = %(gid)s + """, dict(gid=group.id)) return res