banking-addons-team team mailing list archive
-
banking-addons-team team
-
Mailing list archive
-
Message #00710
lp:~camptocamp/banking-addons/bank-statement-reconcile-70-account_statement_ext-improvement-20130628 into lp:banking-addons/bank-statement-reconcile-70
Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-70-account_statement_ext-improvement-20130628 into lp:banking-addons/bank-statement-reconcile-70.
Requested reviews:
Banking Addons Core Editors (banking-addons-team)
For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-account_statement_ext-improvement-20130628/+merge/172068
--
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-account_statement_ext-improvement-20130628/+merge/172068
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-70-account_statement_ext-improvement-20130628 into lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py 2013-05-24 09:38:35 +0000
+++ account_statement_ext/statement.py 2013-06-28 15:12:26 +0000
@@ -38,7 +38,7 @@
stat_mod.account_bank_statement.write = fixed_write
-class AccountStatementProfil(Model):
+class AccountStatementProfile(Model):
"""
A Profile will contain all infos related to the type of
bank statement, and related generated entries. It defines the
@@ -47,10 +47,12 @@
_name = "account.statement.profile"
_inherit = ['mail.thread']
- _description = "Statement Profil"
+ _description = "Statement Profile"
+ _order = 'sequence'
_columns = {
'name': fields.char('Name', required=True),
+ 'sequence': fields.integer('Sequence', help="Gives a sequence in lists, the first profile will be used as default"),
'partner_id': fields.many2one(
'res.partner',
'Bank/Payment Office partner',
@@ -135,12 +137,24 @@
periods = period_obj.find(cr, uid, dt=context.get('date'), context=context)
return periods and periods[0] or False
+ def _default_profile(self, cr, uid, context=None):
+ """
+ Statement default period
+ """
+ if context is None:
+ context = {}
+ user_obj = self.pool.get('res.users')
+ profile_obj = self.pool.get('account.statement.profile')
+ user = user_obj.browse(cr, uid, uid, context=context)
+ profile_ids = profile_obj.search(cr, uid, [('company_id', '=', user.company_id.id)], context=context)
+
+ return profile_ids[0] if profile_ids else False
+
_columns = {
'profile_id': fields.many2one(
'account.statement.profile',
- 'Profil',
+ 'Bank Account Profile',
required=True,
- readonly=True,
states={'draft': [('readonly', False)]}),
'credit_partner_id': fields.related(
'profile_id',
@@ -175,6 +189,7 @@
_defaults = {
'period_id': _default_period,
+ 'profile_id': _default_profile,
}
def create(self, cr, uid, vals, context=None):
@@ -283,7 +298,7 @@
uid,
st_line,
context=context)
- # get the right partner according to the chosen profil
+ # get the right partner according to the chosen profile
if st_line.statement_id.profile_id.force_partner_on_bank:
bank_partner_id = st_line.statement_id.profile_id.partner_id.id
return bank_partner_id
=== modified file 'account_statement_ext/statement_view.xml'
--- account_statement_ext/statement_view.xml 2013-02-13 08:21:48 +0000
+++ account_statement_ext/statement_view.xml 2013-06-28 15:12:26 +0000
@@ -99,51 +99,49 @@
<field name="arch" type="xml">
<!-- Add before the group : profile and related infos -->
- <xpath expr="/form/sheet/group/group/field[@name='journal_id']" position="replace">
- </xpath>
+ <field name="journal_id" position="attributes">
+ <attribute name="invisible">True</attribute>
+ </field>
- <xpath expr="/form/sheet/group" position="after">
+ <label for="name" position="before">
<group>
<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="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>
- <field name="credit_partner_id"/>
- <field name="account_id" invisible="1"/>
- <field name="balance_check" invisible="1"/>
+ <field name="balance_check" invisible="1"/>
</group>
- </xpath>
+ </label>
# Make balance visible or not depending on profile
- <xpath expr="/form/sheet/group/group/field[@name='balance_start']" position="attributes">
- <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
- </xpath>
- <xpath expr="/form/sheet/group/group/field[@name='balance_end_real']" position="attributes">
- <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
- </xpath>
- <xpath expr="/form/sheet/group/group/field[@name='balance_end_real']" position="after">
+ <field name="balance_start" position="attributes">
+ <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
+ </field>
+ <field name="balance_end_real" position="attributes">
+ <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
+ </field>
+ <field name="balance_end_real" position="after">
<field name="balance_end" widget="monetary" options='{"currency_field" : "currency"}' attrs="{'invisible':[('balance_check','=',False)]}"/>
- </xpath>
-
- <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='sequence']" position="after">
- <field name="id" readonly="1" />
- </xpath>
-
- <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='date']" position="before">
- <field name="id" readonly="1" />
- </xpath>
- # Adapt onchange signature
- <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='partner_id']" position="replace">
+ </field>
+
+ <xpath expr="//field[@name='line_ids']/tree/field[@name='sequence']" position="after">
+ <field name="id" readonly="1" />
+ </xpath>
+
+ <xpath expr="//field[@name='line_ids']/form//field[@name='date']" position="before">
+ <field name="id" readonly="1" />
+ </xpath>
+ # Adapt onchange signature
+ <xpath expr="//field[@name='line_ids']/tree/field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
</xpath>
- <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='partner_id']" position="replace">
+ <xpath expr="//field[@name='line_ids']/form//field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
</xpath>
- <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='type']" position="replace">
+ <xpath expr="//field[@name='line_ids']/form//field[@name='type']" position="replace">
<field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
</xpath>
- <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='type']" position="replace">
- <field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
+ # also set type hidden as it has no impact on reconciliation
+ <xpath expr="//field[@name='line_ids']/tree/field[@name='type']" position="replace">
+ <field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)" invisible="1"/>
</xpath>
</field>
Follow ups