diff --git a/addons/account/account.py b/addons/account/account.py
index 0041cfdd269..8c8d58002a8 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -315,7 +315,7 @@ class account_account(osv.osv):
res = {}
null_result = dict((fn, 0.0) for fn in field_names)
if children_and_consolidated:
- aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=dict(context or {}, periods_special=False))
+ aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
wheres = [""]
if query.strip():
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index ff54a5c0590..c945f3e5596 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -33,9 +33,11 @@ import math
class account_bank_statement(osv.osv):
def create(self, cr, uid, vals, context=None):
+ if not context:
+ context = {}
if vals.get('name', '/') == '/':
journal_id = vals.get('journal_id', self._default_journal_id(cr, uid, context=context))
- vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=context)
+ vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=dict(context, period_id=vals.get('period_id')))
if 'line_ids' in vals:
for idx, line in enumerate(vals['line_ids']):
line[2]['sequence'] = idx + 1
@@ -78,7 +80,7 @@ class account_bank_statement(osv.osv):
def _compute_default_statement_name(self, cr, uid, journal_id, context=None):
context = dict(context or {})
obj_seq = self.pool.get('ir.sequence')
- period = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, context=context), context=context)
+ period = self.pool.get('account.period').browse(cr, uid, context.get('period_id') or self._get_period(cr, uid, context=context), context=context)
context['ir_sequence_date'] = period.date_start
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, None)
return obj_seq.next_by_id(cr, uid, journal.sequence_id.id, context=context)
@@ -987,7 +989,7 @@ class account_bank_statement_line(osv.osv):
user = self.pool.get("res.users").browse(cr, uid, uid)
return ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id]), ('journal_entry_ids', '=', False), ('account_id', '=', False)]
- _order = "statement_id desc, sequence"
+ _order = "statement_id desc, sequence, id"
_name = "account.bank.statement.line"
_description = "Bank Statement Line"
_inherit = ['ir.needaction_mixin']
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 954e6f0bbce..a6f82917936 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -347,7 +347,8 @@
on_change="onchange_journal_id(journal_id)" options="{'no_create': True}"
attrs="{'readonly':[('internal_number','!=',False)]}"/>
Click to add an account. diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 9cc3d69ebf4..3cae9755258 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1047,6 +1047,8 @@ class pos_order(osv.osv): 'currency_id': order.pricelist_id.currency_id.id, # considering partner's sale pricelist's currency } inv.update(inv_ref.onchange_partner_id(cr, uid, [], 'out_invoice', order.partner_id.id)['value']) + # FORWARDPORT TO SAAS-6 ONLY! + inv.update({'fiscal_position': False}) if not inv.get('account_id', None): inv['account_id'] = acc inv_id = inv_ref.create(cr, uid, inv, context=context) @@ -1063,8 +1065,7 @@ class pos_order(osv.osv): inv_line.update(inv_line_ref.product_id_change(cr, uid, [], line.product_id.id, line.product_id.uom_id.id, - line.qty, partner_id = order.partner_id.id, - fposition_id=order.partner_id.property_account_position.id)['value']) + line.qty, partner_id = order.partner_id.id)['value']) if not inv_line.get('account_analytic_id', False): inv_line['account_analytic_id'] = \ self._prepare_analytic_account(cr, uid, line, diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 76f5044d14c..4059565680d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2396,8 +2396,6 @@ class stock_move(osv.osv): quants = quant_obj.quants_get_prefered_domain(cr, uid, ops.location_id, move.product_id, qty, domain=domain, prefered_domain_list=[], restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context) quant_obj.quants_reserve(cr, uid, quants, move, record, context=context) for move in todo_moves: - if move.linked_move_operation_ids: - continue #then if the move isn't totally assigned, try to find quants without any specific domain if move.state != 'assigned': qty_already_assigned = move.reserved_availability diff --git a/addons/website_sale/models/payment.py b/addons/website_sale/models/payment.py index e72b609cbd3..b1b3c32c269 100644 --- a/addons/website_sale/models/payment.py +++ b/addons/website_sale/models/payment.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- +import logging from openerp import SUPERUSER_ID from openerp.osv import orm, fields +_logger = logging.getLogger(__name__) + class PaymentTransaction(orm.Model): _inherit = 'payment.transaction' @@ -19,12 +22,15 @@ class PaymentTransaction(orm.Model): res = super(PaymentTransaction, self).form_feedback(cr, uid, data, acquirer_name, context=context) # fetch the tx, check its state, confirm the potential SO - tx_find_method_name = '_%s_form_get_tx_from_data' % acquirer_name - if hasattr(self, tx_find_method_name): - tx = getattr(self, tx_find_method_name)(cr, uid, data, context=context) - if tx and tx.state == 'done' and tx.acquirer_id.auto_confirm == 'at_pay_confirm' and tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']: - self.pool['sale.order'].action_button_confirm(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=dict(context, send_email=True)) - elif tx and tx.state not in ['cancel'] and tx.sale_order_id and tx.sale_order_id.state in ['draft']: - self.pool['sale.order'].force_quotation_send(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=context) + try: + tx_find_method_name = '_%s_form_get_tx_from_data' % acquirer_name + if hasattr(self, tx_find_method_name): + tx = getattr(self, tx_find_method_name)(cr, uid, data, context=context) + if tx and tx.state == 'done' and tx.acquirer_id.auto_confirm == 'at_pay_confirm' and tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']: + self.pool['sale.order'].action_button_confirm(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=dict(context, send_email=True)) + elif tx and tx.state not in ['cancel'] and tx.sale_order_id and tx.sale_order_id.state in ['draft']: + self.pool['sale.order'].force_quotation_send(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=context) + except Exception: + _logger.exception('Fail to confirm the order or send the confirmation email%s', tx and ' for the transaction %s' % tx.reference or '') return res