[MERGE] Sync with trunk, to have last fixes about CRM.

bzr revid: tde@openerp.com-20121218140842-ctuzgms6dqr6c296
This commit is contained in:
Thibault Delavallée 2012-12-18 15:08:42 +01:00
commit 50d0533939
7 changed files with 28 additions and 15 deletions

View File

@ -1137,7 +1137,7 @@
<separator/>
<filter string="Next Partner to Reconcile" help="Next Partner Entries to reconcile" name="next_partner" context="{'next_partner_only': 1}" icon="terp-gtk-jump-to-ltr" domain="[('account_id.reconcile','=',True),('reconcile_id','=',False)]"/>
<field name="move_id" string="Number (Move)"/>
<field name="account_id" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/>
<field name="account_id"/>
<field name="partner_id"/>
<field name="journal_id" context="{'journal_id':self}" widget="selection"/> <!-- it's important to keep widget='selection' in this filter viewbecause without that the value passed in the context is not the ID but the textual value (name) of the selected journal -->
<field name="period_id" context="{'period_id':self}" widget="selection"/> <!-- it's important to keep the widget='selection' in this field, for the same reason as explained above -->
@ -2243,8 +2243,8 @@
<field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,confirm"/>
</header>
<sheet string="Statement">
<label for="name" class="oe_edit_only" attrs="{'invisible':[('name','=','/')]}"/>
<h1><field name="name" class="oe_inline" attrs="{'invisible':[('name','=','/')]}"/></h1>
<label for="name" class="oe_edit_only"/>
<h1><field name="name" class="oe_inline"/></h1>
<group>
<group>
<field name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection" domain="[('type', '=', 'cash')]" />

View File

@ -62,6 +62,7 @@
<field name="name">res.partner.followup.form.inherit</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="model">res.partner</field>
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="arch" type="xml" >
<page string="Accounting" position="before" version="7.0">
<page string="Payment Follow-up" groups="account.group_account_invoice" name="followup_tab">

View File

@ -249,7 +249,7 @@ class crm_lead(base_stage, format_address, osv.osv):
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
'date_closed': fields.datetime('Closed', readonly=True),
'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility=1,
domain="[('fold', '=', False), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"),
domain="['&', '&', ('fold', '=', False), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"),
'user_id': fields.many2one('res.users', 'Salesperson', track_visibility=1),
'referred': fields.char('Referred By', size=64),
'date_open': fields.datetime('Opened', readonly=True),

View File

@ -100,7 +100,7 @@
states="cancel"/>
<button name="case_cancel" string="Cancel" type="object"
states="draft,open,pending"/>
<field name="stage_id" widget="statusbar"
<field name="stage_id" widget="statusbar" clickable="True"
on_change="onchange_stage_id(stage_id)"/>
</header>
<sheet>

View File

@ -180,7 +180,7 @@
<field name="model">crm.case.stage</field>
<field name="arch" type="xml">
<tree string="Stages">
<field name="sequence"/>
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="probability"/>
<field name="state"/>

View File

@ -90,19 +90,30 @@ class account_coda_import(osv.osv_memory):
raise osv.except_osv(_('Error') + ' R1002', _('Foreign bank accounts with IBAN structure are not supported '))
else: # Something else, not supported
raise osv.except_osv(_('Error') + ' R1003', _('Unsupported bank account structure '))
bank_ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', statement['acc_number'])])
not_found_except = osv.except_osv(_('Error') + ' R1004', _("No matching Bank Account.\n\nPlease set-up a Bank Account with as Account Number '%s' and as Currency '%s'.") % (statement['acc_number'], statement['currency']))
statement['journal_id'] = False
statement['bank_account'] = False
# Belgian Account Numbers are composed of 12 digits.
# In OpenERP, the user can fill the bank number in any format: With or without IBan code, with or without spaces, with or without '-'
# The two following sql requests handle those cases.
if len(statement['acc_number']) >= 12:
# If the Account Number is >= 12 digits, it is mostlikely a Belgian Account Number (With or without IBAN).
# The following request try to find the Account Number using a 'like' operator.
# So, if the Account Number is stored with IBAN code, it can be found thanks to this.
cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') like %s", ('%' + statement['acc_number'] + '%',))
else:
# This case is necessary to avoid cases like the Account Number in the CODA file is set to a single or few digits,
# and so a 'like' operator would return the first account number in the database which matches.
cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') = %s", (statement['acc_number'],))
bank_ids = [id[0] for id in cr.fetchall()]
if bank_ids and len(bank_ids) > 0:
bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids)
for bank_acc in bank_accs:
if (bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency']):
raise not_found_except
else:
if not (bank_acc.journal_id and (bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency'])):
statement['journal_id'] = bank_acc.journal_id
statement['bank_account'] = bank_acc
break
else:
raise not_found_except
if statement['bank_account'] == False:
raise osv.except_osv(_('Error') + ' R1004', _("No matching Bank Account (with Account Journal) found.\n\nPlease set-up a Bank Account with as Account Number '%s' and as Currency '%s' and an Account Journal.") % (statement['acc_number'], statement['currency']))
statement['description'] = rmspaces(line[90:125])
statement['balance_start'] = float(rmspaces(line[43:58])) / 1000
statement['balance_start_date'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[58:64]), '%d%m%y'))

View File

@ -471,8 +471,9 @@ class mail_thread(osv.AbstractModel):
# 2. Look for a matching mail.alias entry
# Delivered-To is a safe bet in most modern MTAs, but we have to fallback on To + Cc values
# for all the odd MTAs out there, as there is no standard header for the envelope's `rcpt_to` value.
rcpt_tos = decode_header(message, 'Delivered-To') or \
','.join([decode_header(message, 'To'),
rcpt_tos = \
','.join([decode_header(message, 'Delivered-To'),
decode_header(message, 'To'),
decode_header(message, 'Cc'),
decode_header(message, 'Resent-To'),
decode_header(message, 'Resent-Cc')])