[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:
commit
899166ecac
|
@ -849,18 +849,17 @@ class account_move_line(osv.osv):
|
||||||
(tuple(ids), ))
|
(tuple(ids), ))
|
||||||
r = cr.fetchall()
|
r = cr.fetchall()
|
||||||
#TODO: move this check to a constraint in the account_move_reconcile object
|
#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:
|
if not unrec_lines:
|
||||||
raise osv.except_osv(_('Error!'), _('Entry is already reconciled.'))
|
raise osv.except_osv(_('Error!'), _('Entry is already reconciled.'))
|
||||||
account = account_obj.browse(cr, uid, account_id, context=context)
|
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:
|
if r[0][1] != None:
|
||||||
raise osv.except_osv(_('Error!'), _('Some entries are already reconciled.'))
|
raise osv.except_osv(_('Error!'), _('Some entries are already reconciled.'))
|
||||||
|
|
||||||
if context.get('fy_closing'):
|
if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \
|
||||||
# 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 \
|
|
||||||
(account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))):
|
(account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))):
|
||||||
if not writeoff_acc_id:
|
if not writeoff_acc_id:
|
||||||
raise osv.except_osv(_('Warning!'), _('You have to provide an account for the write off/exchange difference entry.'))
|
raise osv.except_osv(_('Warning!'), _('You have to provide an account for the write off/exchange difference entry.'))
|
||||||
|
|
|
@ -224,14 +224,6 @@ class account_fiscalyear_close(osv.osv_memory):
|
||||||
query_2nd_part = ""
|
query_2nd_part = ""
|
||||||
query_2nd_part_args = []
|
query_2nd_part_args = []
|
||||||
for account in obj_acc_account.browse(cr, uid, account_ids, context={'fiscalyear': fy_id}):
|
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
|
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 not currency_obj.is_zero(cr, uid, company_currency_id, abs(account.balance)):
|
||||||
if query_2nd_part:
|
if query_2nd_part:
|
||||||
|
@ -246,7 +238,7 @@ class account_fiscalyear_close(osv.osv_memory):
|
||||||
period.id,
|
period.id,
|
||||||
account.id,
|
account.id,
|
||||||
account.currency_id and account.currency_id.id or None,
|
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,
|
account.company_id.id,
|
||||||
'draft')
|
'draft')
|
||||||
if query_2nd_part:
|
if query_2nd_part:
|
||||||
|
|
|
@ -64,7 +64,7 @@ class test_message_compose(TestMail):
|
||||||
'body_html': '${object.description}',
|
'body_html': '${object.description}',
|
||||||
'user_signature': True,
|
'user_signature': True,
|
||||||
'attachment_ids': [(0, 0, _attachments[0]), (0, 0, _attachments[1])],
|
'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'
|
'email_cc': 'd@d.d'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class test_message_compose(TestMail):
|
||||||
email_template.write(cr, uid, [email_template_id], {
|
email_template.write(cr, uid, [email_template_id], {
|
||||||
'model_id': user_model_id,
|
'model_id': user_model_id,
|
||||||
'body_html': '${object.login}',
|
'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),
|
'partner_to': '%i,%i' % (p_b_id, p_c_id),
|
||||||
'email_cc': 'd@d',
|
'email_cc': 'd@d',
|
||||||
})
|
})
|
||||||
|
|
|
@ -137,7 +137,7 @@ class mail_compose_message(osv.TransientModel):
|
||||||
def _get_or_create_partners_from_values(self, cr, uid, rendered_values, context=None):
|
def _get_or_create_partners_from_values(self, cr, uid, rendered_values, context=None):
|
||||||
""" Check for email_to, email_cc, partner_to """
|
""" Check for email_to, email_cc, partner_to """
|
||||||
partner_ids = []
|
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:
|
for mail in mails:
|
||||||
partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context)
|
partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context)
|
||||||
partner_ids.append(partner_id)
|
partner_ids.append(partner_id)
|
||||||
|
|
|
@ -76,10 +76,11 @@ class account_analytic_account(osv.osv):
|
||||||
|
|
||||||
def on_change_partner_id(self, cr, uid, ids, partner_id, name, context=None):
|
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)
|
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)
|
if partner_id:
|
||||||
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
|
part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
||||||
if pricelist:
|
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
|
||||||
res['value']['pricelist_id'] = pricelist
|
if pricelist:
|
||||||
|
res['value']['pricelist_id'] = pricelist
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def set_close(self, cr, uid, ids, context=None):
|
def set_close(self, cr, uid, ids, context=None):
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import pytz
|
import pytz
|
||||||
from openerp import SUPERUSER_ID
|
from openerp import SUPERUSER_ID, workflow
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
from operator import attrgetter
|
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)
|
po_ids = purchase_order_obj.search(cr, user_id, [('invoice_ids', 'in', ids)], context=context)
|
||||||
for po_id in po_ids:
|
for po_id in po_ids:
|
||||||
purchase_order_obj.message_post(cr, user_id, po_id, body=_("Invoice received"), context=context)
|
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
|
return res
|
||||||
|
|
||||||
def confirm_paid(self, cr, uid, ids, context=None):
|
def confirm_paid(self, cr, uid, ids, context=None):
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
<record id="trans_router_invoice_no_order" model="workflow.transition">
|
<record id="trans_router_invoice_no_order" model="workflow.transition">
|
||||||
<field name="act_from" ref="act_router"/>
|
<field name="act_from" ref="act_router"/>
|
||||||
<field name="act_to" ref="act_invoice_end"/>
|
<field name="act_to" ref="act_invoice_end"/>
|
||||||
<field name="condition">invoice_method<>'order' and invoiced</field>
|
<field name="condition">invoice_method<>'order'</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="trans_except_picking_picking_done" model="workflow.transition">
|
<record id="trans_except_picking_picking_done" model="workflow.transition">
|
||||||
<field name="act_from" ref="act_except_picking"/>
|
<field name="act_from" ref="act_except_picking"/>
|
||||||
|
@ -200,6 +200,7 @@
|
||||||
<record id="trans_invoice_end_done" model="workflow.transition">
|
<record id="trans_invoice_end_done" model="workflow.transition">
|
||||||
<field name="act_from" ref="act_invoice_end"/>
|
<field name="act_from" ref="act_invoice_end"/>
|
||||||
<field name="act_to" ref="act_done"/>
|
<field name="act_to" ref="act_done"/>
|
||||||
|
<field name="condition">invoiced</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Procurement -->
|
<!-- Procurement -->
|
||||||
|
|
Loading…
Reference in New Issue