Permalink
Browse files

[MERGE] forward port branch saas-14 up to 03a3539

  • Loading branch information...
KangOl committed Nov 5, 2018
2 parents 00829a0 + 03a3539 commit ca2b46c2d13068f322b93397a8e0acd4a7000303
@@ -151,7 +151,7 @@ def post(self):
if not journal.refund_sequence_id:
raise UserError(_('Please define a sequence for the refunds'))
sequence = journal.refund_sequence_id
new_name = sequence.with_context(ir_sequence_date=move.date).next_by_id()
else:
raise UserError(_('Please define a sequence on the journal.'))
@@ -254,7 +254,7 @@ def reverse_moves(self, date=None, journal_id=None):
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 and the liquidity aml and their newly created counterpart
for account in [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)
to_rec.reconcile()
@@ -1222,6 +1222,8 @@ def create(self, vals):
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)
tax_lines_vals.append(temp)
@@ -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
@@ -107,6 +108,7 @@ def name_search(self, name='', args=None, operator='ilike', limit=100):
# 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 = ['|', ('attribute_id', operator, name), ('value_ids', operator, name)]
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)
@@ -170,7 +170,7 @@ def _onchange_requisition_id(self):
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
self.origin = requisition.name
@@ -38,10 +38,12 @@ def _get_timesheet_cost(self, values):
return {}
unit_amount = values.get('unit_amount', 0.0) or self.unit_amount
user_id = values.get('user_id') or self.user_id.id or self._default_user()
emp = self.env['hr.employee'].search([('user_id', '=', user_id)], limit=1)
account = values.get('account_id') and self.env['account.analytic.account'].browse([values['account_id']]) or self.account_id or emp.account_id
user = self.env['res.users'].browse([user_id])
emp = self.env['hr.employee'].search([('user_id', '=', user_id), ('company_id', '=', user.company_id.id)], limit=1)
if not emp:
emp = self.env['hr.employee'].search([('user_id', '=', user_id)], limit=1).sudo()
cost = emp and emp.timesheet_cost or 0.0
uom = account.sudo().company_id.project_time_mode_id
uom = (emp or user).company_id.project_time_mode_id
# Nominal employee cost = 1 * company project UoM (project_time_mode_id)
return {
'amount': -unit_amount * cost,
@@ -348,6 +348,9 @@ def pricelist(self, promo, **post):
@http.route(['/shop/cart'], type='http', auth="public", website=True)
def cart(self, **post):
order = request.website.sale_get_order()
if order and order.state != 'draft':
request.session['sale_order_id'] = None
order = request.website.sale_get_order()
if order:
from_currency = order.company_id.currency_id
to_currency = order.pricelist_id.currency_id
@@ -374,7 +377,7 @@ def cart(self, **post):
@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)
@@ -18,7 +18,10 @@ def cart_options_update_json(self, product_id, add_qty=1, set_qty=0, goto_shop=N
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

0 comments on commit ca2b46c

Please sign in to comment.