[MERGE] forward port of branch 8.0 up to d39d191
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -347,7 +347,8 @@
|
||||
on_change="onchange_journal_id(journal_id)" options="{'no_create': True}"
|
||||
attrs="{'readonly':[('internal_number','!=',False)]}"/>
|
||||
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]"
|
||||
name="account_id" groups="account.group_account_user"/>
|
||||
name="account_id" groups="account.group_account_user"
|
||||
context="{'periods_special': False}"/>
|
||||
|
||||
<label for="currency_id" groups="base.group_multi_currency"/>
|
||||
<div groups="base.group_multi_currency">
|
||||
|
||||
@@ -245,6 +245,7 @@
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
<field name="search_view_id" ref="view_account_search"/>
|
||||
<field name="view_id" ref="view_account_list"/>
|
||||
<field name="context">{'periods_special': False}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to add an account.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user