[FIX]: fix a problme bug/544287 - partner_bank to be partner_bank_id
lp bug: https://launchpad.net/bugs/544287 fixed bzr revid: mga@tinyerp.com-20100719134709-7vuwjnto8s5p43jz
This commit is contained in:
parent
0430e76c7e
commit
3adba48137
|
@ -2572,12 +2572,10 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')])
|
||||
data = data_pool.browse(cr, uid, data_id[0])
|
||||
view_id_cash = data.res_id
|
||||
#view_id_cash = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Bank/Cash Journal View')])[0] #TOFIX: why put fix name
|
||||
|
||||
|
||||
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view_multi')])
|
||||
data = data_pool.browse(cr, uid, data_id[0])
|
||||
ref_acc_bank = data.res_id
|
||||
#ref_acc_bank = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Bank/Cash Journal (Multi-Currency) View')])[0] #TOFIX: why put fix name
|
||||
ref_acc_bank = obj_multi.chart_template_id.bank_account_view_id
|
||||
|
||||
current_num = 1
|
||||
|
@ -2604,8 +2602,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
|
||||
if obj_multi.seq_journal:
|
||||
vals_seq={
|
||||
'name': _('Bank Journal ') + vals['name'],
|
||||
'code': 'account.journal',
|
||||
'name': _('Bank Journal ') + vals['name'],
|
||||
'code': 'account.journal',
|
||||
}
|
||||
seq_id = obj_sequence.create(cr,uid,vals_seq)
|
||||
|
||||
|
@ -2661,9 +2659,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
for position in obj_fiscal_position_template.browse(cr, uid, fp_ids):
|
||||
|
||||
vals_fp = {
|
||||
'company_id' : company_id,
|
||||
'name' : position.name,
|
||||
}
|
||||
'company_id' : company_id,
|
||||
'name' : position.name,
|
||||
}
|
||||
new_fp = obj_fiscal_position.create(cr, uid, vals_fp)
|
||||
|
||||
obj_tax_fp = self.pool.get('account.fiscal.position.tax')
|
||||
|
@ -2671,18 +2669,18 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
|
||||
for tax in position.tax_ids:
|
||||
vals_tax = {
|
||||
'tax_src_id' : tax_template_ref[tax.tax_src_id.id],
|
||||
'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
|
||||
'position_id' : new_fp,
|
||||
}
|
||||
'tax_src_id' : tax_template_ref[tax.tax_src_id.id],
|
||||
'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
|
||||
'position_id' : new_fp,
|
||||
}
|
||||
obj_tax_fp.create(cr, uid, vals_tax)
|
||||
|
||||
for acc in position.account_ids:
|
||||
vals_acc = {
|
||||
'account_src_id' : acc_template_ref[acc.account_src_id.id],
|
||||
'account_dest_id' : acc_template_ref[acc.account_dest_id.id],
|
||||
'position_id' : new_fp,
|
||||
}
|
||||
'account_src_id' : acc_template_ref[acc.account_src_id.id],
|
||||
'account_dest_id' : acc_template_ref[acc.account_dest_id.id],
|
||||
'position_id' : new_fp,
|
||||
}
|
||||
obj_ac_fp.create(cr, uid, vals_acc)
|
||||
|
||||
#fially inactive the demo chart of accounts
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<!--
|
||||
Invoices
|
||||
-->
|
||||
|
||||
<record id="view_invoice_line_calendar" model="ir.ui.view">
|
||||
<field name="name">account.invoice.calendar</field>
|
||||
<field name="model">account.invoice</field>
|
||||
|
@ -17,6 +16,7 @@
|
|||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_invoice_graph">
|
||||
<field name="name">account.invoice.graph</field>
|
||||
<field name="model">account.invoice</field>
|
||||
|
@ -28,6 +28,7 @@
|
|||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_invoice_line_tree" model="ir.ui.view">
|
||||
<field name="name">account.invoice.line.tree</field>
|
||||
<field name="model">account.invoice.line</field>
|
||||
|
@ -44,6 +45,7 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_invoice_line_form" model="ir.ui.view">
|
||||
<field name="name">account.invoice.line.form</field>
|
||||
<field name="model">account.invoice.line</field>
|
||||
|
@ -74,6 +76,7 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_invoice_tax_tree" model="ir.ui.view">
|
||||
<field name="name">account.invoice.tax.tree</field>
|
||||
<field name="model">account.invoice.tax</field>
|
||||
|
@ -89,6 +92,7 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_invoice_tax_form" model="ir.ui.view">
|
||||
<field name="name">account.invoice.tax.form</field>
|
||||
<field name="model">account.invoice.tax</field>
|
||||
|
@ -149,7 +153,7 @@
|
|||
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
|
||||
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change"/>
|
||||
<newline/>
|
||||
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" context="{'default_customer': 0}"/>
|
||||
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0}"/>
|
||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
||||
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
|
||||
<newline/>
|
||||
|
@ -212,7 +216,7 @@
|
|||
</group>
|
||||
</page>
|
||||
<page string="Other Info">
|
||||
<field domain="[('partner_id', '=', partner_id)]" name="partner_bank" on_change="onchange_partner_bank(partner_bank)"/>
|
||||
<field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)"/>
|
||||
|
||||
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
|
@ -245,7 +249,6 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="invoice_form" model="ir.ui.view">
|
||||
<field name="name">account.invoice.form</field>
|
||||
<field name="model">account.invoice</field>
|
||||
|
@ -259,7 +262,7 @@
|
|||
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
|
||||
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change"/>
|
||||
<newline/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" groups="base.group_user"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user"/>
|
||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
||||
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
|
||||
<newline/>
|
||||
|
@ -312,7 +315,7 @@
|
|||
<field name="date_due"/>
|
||||
<field name="user_id"/>
|
||||
<newline/>
|
||||
<field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank"
|
||||
<field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id"
|
||||
groups="base.group_extended"/>
|
||||
<field name="origin"/>
|
||||
<field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id"
|
||||
|
@ -403,6 +406,7 @@
|
|||
<field name="view_mode">tree</field>
|
||||
<field name="act_window_id" ref="action_invoice_tree"/>
|
||||
</record>
|
||||
|
||||
<record id="action_invoice_tree_view2" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
|
@ -421,11 +425,13 @@
|
|||
<field name="context">{'type':'out_invoice'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
</record>
|
||||
|
||||
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="act_window_id" ref="action_invoice_tree1"/>
|
||||
</record>
|
||||
|
||||
<record id="action_invoice_tree1_view2" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
|
@ -469,7 +475,6 @@
|
|||
<field name="view_id" ref="invoice_form"/>
|
||||
<field name="act_window_id" ref="action_invoice_tree3"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="menu_finance_receivables"/>
|
||||
|
||||
<record id="action_invoice_tree4" model="ir.actions.act_window">
|
||||
|
|
|
@ -299,7 +299,7 @@ class account_invoice(osv.osv):
|
|||
'account.move.line': (_get_invoice_from_line, None, 50),
|
||||
'account.move.reconcile': (_get_invoice_from_reconcile, None, 50),
|
||||
}, help="The Ledger Postings of the invoice have been reconciled with Ledger Postings of the payment(s)."),
|
||||
'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
help='Bank Account Number, Company bank account if Invoice is customer or supplier refund, otherwise Parner bank account number.', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'move_lines':fields.function(_get_lines , method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
|
||||
'residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual',
|
||||
|
@ -373,7 +373,7 @@ class account_invoice(osv.osv):
|
|||
# def get_invoice_address(self, cr, uid, ids):
|
||||
# res = self.pool.get('res.partner').address_get(cr, uid, [part], ['invoice'])
|
||||
# return [{}]
|
||||
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
|
||||
def onchange_partner_id(self, cr, uid, ids, type, partner_id,\
|
||||
date_invoice=False, payment_term=False, partner_bank=False, company_id=False):
|
||||
invoice_addr_id = False
|
||||
contact_addr_id = False
|
||||
|
@ -429,7 +429,7 @@ class account_invoice(osv.osv):
|
|||
}
|
||||
|
||||
if type in ('in_invoice', 'in_refund'):
|
||||
result['value']['partner_bank'] = bank_id
|
||||
result['value']['partner_bank_id'] = bank_id
|
||||
|
||||
if payment_term != partner_payment_term:
|
||||
if partner_payment_term:
|
||||
|
|
|
@ -68,7 +68,7 @@ class account_invoice_report(osv.osv):
|
|||
'address_contact_id': fields.many2one('res.partner.address', 'Contact Address Name', readonly=True),
|
||||
'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address Name', readonly=True),
|
||||
'account_id': fields.many2one('account.account', 'Account',readonly=True),
|
||||
'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
|
||||
'residual':fields.float('Total Residual', readonly=True),
|
||||
'delay_to_pay':fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class account_invoice_report(osv.osv):
|
|||
ai.address_contact_id as address_contact_id,
|
||||
ai.address_invoice_id as address_invoice_id,
|
||||
ai.account_id as account_id,
|
||||
ai.partner_bank as partner_bank,
|
||||
ai.partner_bank_id as partner_bank_id,
|
||||
sum(case when ai.type in ('out_refund','in_invoice') then
|
||||
ail.quantity * u.factor * -1
|
||||
else
|
||||
|
@ -152,7 +152,7 @@ class account_invoice_report(osv.osv):
|
|||
ai.address_contact_id,
|
||||
ai.address_invoice_id,
|
||||
ai.account_id,
|
||||
ai.partner_bank,
|
||||
ai.partner_bank_id,
|
||||
ai.residual
|
||||
)
|
||||
""")
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<field name="date_due" invisible="1"/>
|
||||
<field name="address_contact_id" invisible="1"/>
|
||||
<field name="address_invoice_id" invisible="1"/>
|
||||
<field name="partner_bank" invisible="1"/>
|
||||
<field name="partner_bank_id" invisible="1"/>
|
||||
<field name="account_id" invisible="1"/>
|
||||
<field name="nbr" sum="# of Lines"/>
|
||||
<field name="product_qty" sum="Qty"/>
|
||||
|
|
|
@ -93,8 +93,8 @@ class account_move_line(osv.osv):
|
|||
context=context)
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
line2bank[line.id] = False
|
||||
if line.invoice and line.invoice.partner_bank:
|
||||
line2bank[line.id] = line.invoice.partner_bank.id
|
||||
if line.invoice and line.invoice.partner_bank_id:
|
||||
line2bank[line.id] = line.invoice.partner_bank_id.id
|
||||
elif line.partner_id:
|
||||
if not line.partner_id.bank_ids:
|
||||
#raise osv.except_osv(_('Error !'), _('Partner '+ line.partner_id.name+ ' has no bank account defined'))
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="priority" eval="18"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_bank" position="replace">
|
||||
<field name="partner_bank"
|
||||
<field name="partner_bank_id" position="replace">
|
||||
<field name="partner_bank_id"
|
||||
domain="[('partner_id', '=', partner_id)]"
|
||||
on_change="onchange_partner_bank(partner_bank)"/>
|
||||
on_change="onchange_partner_bank(partner_bank_id)"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -35,8 +35,8 @@
|
|||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_bank" position="replace">
|
||||
<field name="partner_bank"
|
||||
<field name="partner_bank_id" position="replace">
|
||||
<field name="partner_bank_id"
|
||||
domain="[('partner_id.ref_companies', 'in', [company_id])]"/>
|
||||
</field>
|
||||
</field>
|
||||
|
|
|
@ -57,8 +57,8 @@ class AccountMoveLine(osv.osv):
|
|||
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
|
||||
context=context)
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.invoice and line.invoice.partner_bank:
|
||||
line2bank[line.id] = line.invoice.partner_bank.id
|
||||
if line.invoice and line.invoice.partner_bank_id:
|
||||
line2bank[line.id] = line.invoice.partner_bank_id.id
|
||||
elif line.partner_id:
|
||||
for bank in line.partner_id.bank_ids:
|
||||
if bank.state in bank_type:
|
||||
|
|
|
@ -82,7 +82,7 @@ class account_invoice(osv.osv):
|
|||
'reference_type': fields.selection(_get_reference_type,
|
||||
'Reference Type', required=True),
|
||||
### Partner bank link between bank and partner id
|
||||
'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
help='The partner bank account to pay\nKeep empty to use the default'
|
||||
),
|
||||
### Amount to pay
|
||||
|
@ -129,8 +129,8 @@ class account_invoice(osv.osv):
|
|||
on the BVR reference type and the invoice partner bank type"""
|
||||
for invoice in self.browse(cursor, user, ids):
|
||||
if invoice.type in 'in_invoice':
|
||||
if invoice.partner_bank and \
|
||||
invoice.partner_bank.state in \
|
||||
if invoice.partner_bank_id and \
|
||||
invoice.partner_bank_id.state in \
|
||||
('bvrbank', 'bvrpost') and \
|
||||
invoice.reference_type != 'bvr':
|
||||
return False
|
||||
|
@ -173,7 +173,7 @@ class account_invoice(osv.osv):
|
|||
bank_id = p.bank_ids[0].id
|
||||
|
||||
if type in ('in_invoice', 'in_refund'):
|
||||
res['value']['partner_bank'] = bank_id
|
||||
res['value']['partner_bank_id'] = bank_id
|
||||
|
||||
if partner_bank != bank_id:
|
||||
to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
|
||||
|
|
|
@ -39,22 +39,22 @@ def _check(self, cr, uid, data, context):
|
|||
pool = pooler.get_pool(cr.dbname)
|
||||
invoice_obj = pool.get('account.invoice')
|
||||
for invoice in invoice_obj.browse(cr, uid, data['ids'], context):
|
||||
if not invoice.partner_bank:
|
||||
if not invoice.partner_bank_is:
|
||||
raise wizard.except_wizard(_('UserError'),
|
||||
_('No bank specified on invoice:\n%s') % \
|
||||
invoice_obj.name_get(cr, uid, [invoice.id], context=context)[0][1])
|
||||
|
||||
if not re.compile('[0-9][0-9]-[0-9]{3,6}-[0-9]').match(
|
||||
invoice.partner_bank.bvr_number or ''):
|
||||
invoice.partner_bank_id.bvr_number or ''):
|
||||
raise wizard.except_wizard(_('UserError'),
|
||||
_('Your bank BVR number should be of the form 0X-XXX-X!\n' \
|
||||
'Please check your company ' \
|
||||
'information for the invoice:\n%s') % \
|
||||
invoice_obj.name_get(cr, uid, [invoice.id], context=context)[0][1])
|
||||
|
||||
if invoice.partner_bank.bvr_adherent_num \
|
||||
if invoice.partner_bank_id.bvr_adherent_num \
|
||||
and not re.compile('[0-9]*$').match(
|
||||
invoice.partner_bank.bvr_adherent_num):
|
||||
invoice.partner_bank_id.bvr_adherent_num):
|
||||
raise wizard.except_wizard(_('UserError'),
|
||||
_('Your bank BVR adherent number must contain exactly seven' \
|
||||
'digits!\nPlease check your company ' \
|
||||
|
|
Loading…
Reference in New Issue