diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 62daabe5abf..eb479206bad 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -259,7 +259,7 @@ class AccountMove(models.Model): aml = ac_move.line_ids.filtered(lambda x: x.account_id.reconcile or x.account_id.internal_type == 'liquidity') aml.remove_move_reconcile() #reconcile together the reconciliable (or the liquidity aml) and their newly created counterpart - for account in list(set([x.account_id for x in aml])): + for account in set([x.account_id for x in aml]): to_rec = aml.filtered(lambda y: y.account_id == account) to_rec |= reversed_move.line_ids.filtered(lambda y: y.account_id == account) #reconciliation will be full, so speed up the computation by using skip_full_reconcile_check in the context @@ -1311,6 +1311,8 @@ class AccountMoveLine(models.Model): ctx = {} if 'date' in vals: ctx['date'] = vals['date'] + elif 'date_maturity' in vals: + ctx['date'] = vals['date_maturity'] temp['currency_id'] = bank.currency_id.id temp['amount_currency'] = bank.company_id.currency_id.with_context(ctx).compute(tax_vals['amount'], bank.currency_id, round=True) if vals.get('tax_exigible'): diff --git a/addons/product/models/product_attribute.py b/addons/product/models/product_attribute.py index 0b319b6d8ce..ee9c7d4a95d 100644 --- a/addons/product/models/product_attribute.py +++ b/addons/product/models/product_attribute.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from odoo.osv import expression from odoo import api, fields, models, _ from odoo.addons import decimal_precision as dp from odoo.exceptions import UserError, ValidationError @@ -108,6 +109,7 @@ class ProductAttributeLine(models.Model): # search on a m2o and one on a m2m, probably this will quickly become # difficult to compute - check if performance optimization is required if name and operator in ('=', 'ilike', '=ilike', 'like', '=like'): - args = expression.AND([['|', ('attribute_id', operator, name), ('value_ids', operator, name)], args]) - return self.search(args, limit=limit).name_get() + args = args or [] + domain = ['|', ('attribute_id', operator, name), ('value_ids', operator, name)] + return self.search(expression.AND([domain, args]), limit=limit).name_get() return super(ProductAttributeLine, self).name_search(name=name, args=args, operator=operator, limit=limit) diff --git a/addons/purchase_requisition/models/purchase_requisition.py b/addons/purchase_requisition/models/purchase_requisition.py index 79a8e28a91c..650d442da1a 100644 --- a/addons/purchase_requisition/models/purchase_requisition.py +++ b/addons/purchase_requisition/models/purchase_requisition.py @@ -200,7 +200,7 @@ class PurchaseOrder(models.Model): self.partner_id = partner.id self.fiscal_position_id = fpos.id - self.payment_term_id = payment_term.id, + self.payment_term_id = payment_term.id self.company_id = requisition.company_id.id self.currency_id = currency.id if not self.origin or requisition.name not in self.origin.split(', '): diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 452d5507c3e..2525602d74e 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -356,6 +356,9 @@ class WebsiteSale(http.Controller): revive: Revival method when abandoned cart. Can be 'merge' or 'squash' """ order = request.website.sale_get_order() + if order and order.state != 'draft': + request.session['sale_order_id'] = None + order = request.website.sale_get_order() values = {} if access_token: abandoned_order = request.env['sale.order'].sudo().search([('access_token', '=', access_token)], limit=1) @@ -398,7 +401,7 @@ class WebsiteSale(http.Controller): @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True, csrf=False) def cart_update(self, product_id, add_qty=1, set_qty=0, **kw): - sale_order = request.website.sale_get_order(force_create=1) + sale_order = request.website.sale_get_order(force_create=True) if sale_order.state != 'draft': request.session['sale_order_id'] = None sale_order = request.website.sale_get_order(force_create=True) diff --git a/addons/website_sale_options/controllers/main.py b/addons/website_sale_options/controllers/main.py index 1f151f0dcf7..9f677bbcfbb 100644 --- a/addons/website_sale_options/controllers/main.py +++ b/addons/website_sale_options/controllers/main.py @@ -19,7 +19,10 @@ class WebsiteSaleOptions(WebsiteSale): if lang: request.website = request.website.with_context(lang=lang) - order = request.website.sale_get_order(force_create=1) + order = request.website.sale_get_order(force_create=True) + if order.state != 'draft': + request.session['sale_order_id'] = None + order = request.website.sale_get_order(force_create=True) product = request.env['product.product'].browse(int(product_id)) option_ids = product.optional_product_ids.mapped('product_variant_ids').ids