[MIGR] Adapt views, fix import and depedencies

This commit is contained in:
Joel Grand-Guillaume
2012-12-18 20:51:26 +01:00
parent a38ccb448d
commit a4836b6f89
3 changed files with 69 additions and 95 deletions

View File

@@ -25,7 +25,7 @@
'maintainer': 'Camptocamp', 'maintainer': 'Camptocamp',
'category': 'Finance', 'category': 'Finance',
'complexity': 'normal', #easy, normal, expert 'complexity': 'normal', #easy, normal, expert
'depends': ['account'], 'depends': ['account','report_webkit'],
'description': """ 'description': """
Improve the basic bank statement, by adding various new features, Improve the basic bank statement, by adding various new features,
and help dealing with huge volume of reconciliation through payment offices such as Paypal, Lazer, and help dealing with huge volume of reconciliation through payment offices such as Paypal, Lazer,

View File

@@ -19,12 +19,11 @@
# #
############################################################################## ##############################################################################
from tools.translate import _ import time
import datetime
import netsvc
logger = netsvc.Logger()
from openerp.osv.orm import Model, fields from openerp.osv.orm import Model, fields
from openerp.osv import fields, osv from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class AccountStatementProfil(Model): class AccountStatementProfil(Model):
""" """
@@ -216,7 +215,7 @@ class AccountBankSatement(Model):
""" """
if context is None: if context is None:
context = {} context = {}
res = super(AccountBankSatement, self)._prepare_move_line_vals(self, cr, uid, st_line, move_id, debit, res = super(AccountBankSatement, self)._prepare_move_line_vals(cr, uid, st_line, move_id, debit,
credit, currency_id = currency_id, amount_currency = amount_currency, account_id = account_id, credit, currency_id = currency_id, amount_currency = amount_currency, account_id = account_id,
analytic_id = analytic_id, partner_id = partner_id, context = context) analytic_id = analytic_id, partner_id = partner_id, context = context)
ctx = context.copy() ctx = context.copy()
@@ -225,7 +224,7 @@ class AccountBankSatement(Model):
res.update({'period_id': period_id}) res.update({'period_id': period_id})
return res return res
def _get_counter_part_partner(sefl, cr, uid, st_line, context=None): def _get_counter_part_partner(self, cr, uid, st_line, context=None):
""" """
We change the move line generated from the lines depending on the profile: We change the move line generated from the lines depending on the profile:
- If partner_id is set and force_partner_on_bank is ticked, we'll let the partner of each line - If partner_id is set and force_partner_on_bank is ticked, we'll let the partner of each line
@@ -236,11 +235,10 @@ class AccountBankSatement(Model):
create the move from. create the move from.
:return: int/long of the res.partner to use as counterpart :return: int/long of the res.partner to use as counterpart
""" """
bank_partner_id = super(AccountBankSatement, self)._get_counter_part_partner(cr, uid, st_line, context=context)
# GET THE RIGHT PARTNER ACCORDING TO THE CHOSEN PROFIL # GET THE RIGHT PARTNER ACCORDING TO THE CHOSEN PROFIL
if st_line.statement_id.profile_id.force_partner_on_bank: if st_line.statement_id.profile_id.force_partner_on_bank:
bank_partner_id = st_line.statement_id.profile_id.partner_id.id bank_partner_id = st_line.statement_id.profile_id.partner_id.id
else:
bank_partner_id = ((st_line.partner_id) and st_line.partner_id.id) or False
return bank_partner_id return bank_partner_id
def _get_st_number_period_profile(self, cr, uid, date, profile_id): def _get_st_number_period_profile(self, cr, uid, date, profile_id):
@@ -329,7 +327,7 @@ class AccountBankSatement(Model):
'name': st_number, 'name': st_number,
'balance_end_real': st.balance_end 'balance_end_real': st.balance_end
}, context=context) }, context=context)
self.log(cr, uid, st.id, _('Statement %s is confirmed, journal items are created.') % (st_number,)) self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st_number,), context=context)
return self.write(cr, uid, ids, {'state':'confirm'}, context=context) return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
def get_account_for_counterpart(self, cursor, uid, def get_account_for_counterpart(self, cursor, uid,

View File

@@ -73,32 +73,20 @@
<menuitem string="Bank Statements Profile" action="action_treasury_statement_profile_tree" id="menu_treasury_statement_profile_tree" parent="account.menu_configuration_misc" sequence="30"/> <menuitem string="Bank Statements Profile" action="action_treasury_statement_profile_tree" id="menu_treasury_statement_profile_tree" parent="account.menu_configuration_misc" sequence="30"/>
<record model="ir.ui.view" id="id_in_statement_line">
<field name="name">account.bank.statement.line.inherit</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_periodic_form"/>
<field name="priority" eval="30"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page[@string='Journal Entries']/field/tree/field[@name='ref']" position="before">
<field name="id" />
</xpath>
</field>
</record>
<record id="view_treasury_statement_search" model="ir.ui.view"> <record id="view_treasury_statement_search" model="ir.ui.view">
<field name="name">account.bank.statement.search</field> <field name="name">account.bank.statement.search</field>
<field name="model">account.bank.statement</field> <field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_search"/> <field name="inherit_id" ref="account.view_bank_statement_search"/>
<field name="type">search</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="/search/group/field[@name='name']" position="before"> <xpath expr="/search/field[@name='name']" position="before">
<field name="id"/> <field name="id"/>
<field name="profile_id"/> <field name="profile_id"/>
<field name="credit_partner_id"/> <field name="credit_partner_id"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>
</xpath> </xpath>
<xpath expr="/search/group/field[@name='period_id']" position="replace"> <xpath expr="/search/field[@name='period_id']" position="replace">
</xpath> </xpath>
<xpath expr="/search/group/filter[@string='Period']" position="replace"> <xpath expr="/search/group/filter[@string='Period']" position="replace">
<filter string="Financial Partner" context="{'group_by': 'credit_partner_id'}" icon="terp-partner"/> <filter string="Financial Partner" context="{'group_by': 'credit_partner_id'}" icon="terp-partner"/>
@@ -124,76 +112,64 @@
</field> </field>
</record> </record>
<record id="view_treasury_statement_form" model="ir.ui.view"> <record id="view_treasury_statement_form" model="ir.ui.view">
<field name="name">account.bank.statement.form</field> <field name="name">account.bank.statement.form</field>
<field name="model">account.bank.statement</field> <field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/> <field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<!-- Remove name and date from group tag -->
<xpath expr="/form/group/field[@name='name']" position="replace"> <!-- Add before the group : profile and related infos -->
</xpath> <xpath expr="/form/sheet/group/group/field[@name='journal_id']" position="replace">
<xpath expr="/form/group/field[@name='date']" position="replace"> </xpath>
</xpath>
<!-- Add a new group before the first one with name, profile and date --> <xpath expr="/form/sheet/group" position="after">
<xpath expr="/form/group[@col='7']" position="before"> <group>
<group col="8" colspan="4"> <field name="profile_id" select="1" required="1" on_change="onchange_imp_config_id(profile_id)" widget="selection"/>
<field name="profile_id" select="1" required="1" on_change="onchange_imp_config_id(profile_id)" widget="selection"/> <separator string="Profile Details" colspan="4"/>
<field name="date" select="1" on_change="onchange_date(date, company_id)"/> <field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="name" select="1"/> <field name="credit_partner_id"/>
</group> <field name="account_id" invisible="1"/>
<separator string="Profile Details" colspan="4"/> <field name="balance_check" invisible="1"/>
</xpath> </group>
<!-- Make balance visible or not depending on profile --> </xpath>
<xpath expr="/form/group/field[@name='balance_start']" position="replace">
</xpath> # Make balance visible or not depending on profile
<xpath expr="/form/group/field[@name='balance_end_real']" position="replace"> <xpath expr="/form/sheet/group/group/field[@name='balance_start']" position="attributes">
</xpath> <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
<xpath expr="/form/group[@col='7']" position="after"> </xpath>
<separator string="Balance Check" colspan="4" attrs="{'invisible':[('balance_check','=',False)]}"/> <xpath expr="/form/sheet/group/group/field[@name='balance_end_real']" position="attributes">
<group col="6" colspan="4" attrs="{'invisible':[('balance_check','=',False)]}"> <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
<field name="balance_start" /> </xpath>
<field name="balance_end_real" /> <xpath expr="/form/sheet/group/group/field[@name='balance_end_real']" position="after">
</group> <field name="balance_end" widget="monetary" options='{"currency_field" : "currency"}'/>
</xpath> </xpath>
<xpath expr="/form/group/field[@name='balance_end']" position="replace">
<field name="balance_end"/> <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='sequence']" position="after">
</xpath> <field name="id"/>
</xpath>
<xpath expr="/form/group/field[@name='journal_id']" position="attributes">
<attribute name="widget"></attribute> <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='date']" position="before">
</xpath> <field name="id"/>
<xpath expr="/form/group/field[@name='period_id']" position="replace"> </xpath>
<field name="credit_partner_id"/> # Adapt onchange signature
<field name="account_id" invisible="1"/> <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='partner_id']" position="replace">
<field name="balance_check" invisible="1"/> <field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
</xpath> </xpath>
<xpath expr="/form/notebook/page/field/tree/field[@name='sequence']" position="after">
<field name="id"/> <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='partner_id']" position="replace">
</xpath> <field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
<xpath expr="/form/notebook/page/field/tree/field[@name='partner_id']" position="replace"> </xpath>
<field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)"/> <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='type']" position="replace">
</xpath> <field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
<xpath expr="/form/notebook/page/field/form/field[@name='date']" position="before"> </xpath>
<field name="id"/> <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='type']" position="replace">
</xpath> <field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
<!-- Adapt onchange signature --> </xpath>
<xpath expr="/form/notebook/page/field/tree/field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)"/> </field>
</xpath> </record>
<xpath expr="/form/notebook/page/field/form/field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)"/>
</xpath>
<xpath expr="/form/notebook/page/field/form/field[@name='type']" position="replace">
<field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
</xpath>
<xpath expr="/form/notebook/page/field/tree/field[@name='type']" position="replace">
<field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
</xpath>
</field>
</record>
<act_window id="act_bank_statement_from_profile" <act_window id="act_bank_statement_from_profile"