[MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9761 revid:dle@openerp.com-20140114164804-zhfy9lb308554kp1

bzr revid: dle@openerp.com-20140114173653-xhh85ubx27uu1306
This commit is contained in:
Denis Ledoux 2014-01-14 18:36:53 +01:00
commit 899166ecac
7 changed files with 18 additions and 24 deletions

View File

@ -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.'))

View File

@ -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:

View File

@ -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',
})

View File

@ -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)

View File

@ -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):

View File

@ -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):

View File

@ -147,7 +147,7 @@
<record id="trans_router_invoice_no_order" model="workflow.transition">
<field name="act_from" ref="act_router"/>
<field name="act_to" ref="act_invoice_end"/>
<field name="condition">invoice_method&lt;&gt;'order' and invoiced</field>
<field name="condition">invoice_method&lt;&gt;'order'</field>
</record>
<record id="trans_except_picking_picking_done" model="workflow.transition">
<field name="act_from" ref="act_except_picking"/>
@ -200,6 +200,7 @@
<record id="trans_invoice_end_done" model="workflow.transition">
<field name="act_from" ref="act_invoice_end"/>
<field name="act_to" ref="act_done"/>
<field name="condition">invoiced</field>
</record>
<!-- Procurement -->