diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 719a4fe8a4d..b48e842caf5 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -849,18 +849,17 @@ class account_move_line(osv.osv):
(tuple(ids), ))
r = cr.fetchall()
#TODO: move this check to a constraint in the account_move_reconcile object
+ if len(r) != 1:
+ raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! '))
if not unrec_lines:
raise osv.except_osv(_('Error!'), _('Entry is already reconciled.'))
account = account_obj.browse(cr, uid, account_id, context=context)
+ if not account.reconcile:
+ raise osv.except_osv(_('Error'), _('The account is not defined to be reconciled !'))
if r[0][1] != None:
raise osv.except_osv(_('Error!'), _('Some entries are already reconciled.'))
- if context.get('fy_closing'):
- # We don't want to generate any write-off when being called from the
- # wizard used to close a fiscal year (and it doesn't give us any
- # writeoff_acc_id).
- pass
- elif (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \
+ if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \
(account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))):
if not writeoff_acc_id:
raise osv.except_osv(_('Warning!'), _('You have to provide an account for the write off/exchange difference entry.'))
diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py
index 928f0647084..266b8ccbc50 100644
--- a/addons/account/wizard/account_fiscalyear_close.py
+++ b/addons/account/wizard/account_fiscalyear_close.py
@@ -224,14 +224,6 @@ class account_fiscalyear_close(osv.osv_memory):
query_2nd_part = ""
query_2nd_part_args = []
for account in obj_acc_account.browse(cr, uid, account_ids, context={'fiscalyear': fy_id}):
- balance_in_currency = 0.0
- if account.currency_id:
- cr.execute('SELECT sum(COALESCE(amount_currency,0.0)) as balance_in_currency FROM account_move_line ' \
- 'WHERE account_id = %s ' \
- 'AND ' + query_line + ' ' \
- 'AND currency_id = %s', (account.id, account.currency_id.id))
- balance_in_currency = cr.dictfetchone()['balance_in_currency']
-
company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id
if not currency_obj.is_zero(cr, uid, company_currency_id, abs(account.balance)):
if query_2nd_part:
@@ -246,7 +238,7 @@ class account_fiscalyear_close(osv.osv_memory):
period.id,
account.id,
account.currency_id and account.currency_id.id or None,
- balance_in_currency,
+ account.foreign_balance if account.currency_id else 0.0,
account.company_id.id,
'draft')
if query_2nd_part:
diff --git a/addons/email_template/tests/test_mail.py b/addons/email_template/tests/test_mail.py
index a43bbe79713..631754e3883 100644
--- a/addons/email_template/tests/test_mail.py
+++ b/addons/email_template/tests/test_mail.py
@@ -64,7 +64,7 @@ class test_message_compose(TestMail):
'body_html': '${object.description}',
'user_signature': True,
'attachment_ids': [(0, 0, _attachments[0]), (0, 0, _attachments[1])],
- 'email_to': 'b@b.b c@c.c',
+ 'email_to': 'b@b.b, c@c.c',
'email_cc': 'd@d.d'
})
@@ -192,7 +192,7 @@ class test_message_compose(TestMail):
email_template.write(cr, uid, [email_template_id], {
'model_id': user_model_id,
'body_html': '${object.login}',
- 'email_to': '${object.email} c@c',
+ 'email_to': '${object.email}, c@c',
'partner_to': '%i,%i' % (p_b_id, p_c_id),
'email_cc': 'd@d',
})
diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py
index cd417a19d3c..f8bf45b2ba0 100644
--- a/addons/email_template/wizard/mail_compose_message.py
+++ b/addons/email_template/wizard/mail_compose_message.py
@@ -137,7 +137,7 @@ class mail_compose_message(osv.TransientModel):
def _get_or_create_partners_from_values(self, cr, uid, rendered_values, context=None):
""" Check for email_to, email_cc, partner_to """
partner_ids = []
- mails = tools.email_split(rendered_values.pop('email_to', '') + ' ' + rendered_values.pop('email_cc', ''))
+ mails = tools.email_split(rendered_values.pop('email_to', '')) + tools.email_split(rendered_values.pop('email_cc', ''))
for mail in mails:
partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context)
partner_ids.append(partner_id)
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
index ecfe9a1ead3..945a6b81d76 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
@@ -76,10 +76,11 @@ class account_analytic_account(osv.osv):
def on_change_partner_id(self, cr, uid, ids, partner_id, name, context=None):
res = super(account_analytic_account, self).on_change_partner_id(cr, uid, ids, partner_id, name, context=context)
- part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
- pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
- if pricelist:
- res['value']['pricelist_id'] = pricelist
+ if partner_id:
+ part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
+ pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
+ if pricelist:
+ res['value']['pricelist_id'] = pricelist
return res
def set_close(self, cr, uid, ids, context=None):
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 4c0bed5cae7..f3471d79f1f 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -21,7 +21,7 @@
import time
import pytz
-from openerp import SUPERUSER_ID
+from openerp import SUPERUSER_ID, workflow
from datetime import datetime
from dateutil.relativedelta import relativedelta
from operator import attrgetter
@@ -1290,6 +1290,7 @@ class account_invoice(osv.Model):
po_ids = purchase_order_obj.search(cr, user_id, [('invoice_ids', 'in', ids)], context=context)
for po_id in po_ids:
purchase_order_obj.message_post(cr, user_id, po_id, body=_("Invoice received"), context=context)
+ workflow.trg_write(uid, 'purchase.order', po_id, cr)
return res
def confirm_paid(self, cr, uid, ids, context=None):
diff --git a/addons/purchase/purchase_workflow.xml b/addons/purchase/purchase_workflow.xml
index 68a6cd12733..ec4632c45a9 100644
--- a/addons/purchase/purchase_workflow.xml
+++ b/addons/purchase/purchase_workflow.xml
@@ -147,7 +147,7 @@
- invoice_method<>'order' and invoiced
+ invoice_method<>'order'
@@ -200,6 +200,7 @@
+ invoiced