Victor Tabuenca (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-improve_bank_statements-vta into 
lp:openobject-addons.

Requested reviews:
  Antony Lesuisse (OpenERP) (al-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-improve_bank_statements-vta/+merge/133276

Improved Bank Statement object.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-improve_bank_statements-vta/+merge/133276
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-improve_bank_statements-vta.
=== modified file 'account/account_view.xml'
--- account/account_view.xml	2012-10-31 14:57:08 +0000
+++ account/account_view.xml	2012-11-07 15:26:37 +0000
@@ -302,7 +302,7 @@
             <field name="domain">[('parent_id','=',False)]</field>
         </record>
 
-         <record id="view_account_gain_loss_tree" model="ir.ui.view">
+        <record id="view_account_gain_loss_tree" model="ir.ui.view">
            <field name="name">Unrealized Gain or Loss</field>
             <field name="model">account.account</field>
             <field name="arch" type="xml">
@@ -322,7 +322,7 @@
             </field>
         </record>
 
-          <record id="action_account_gain_loss" model="ir.actions.act_window">
+        <record id="action_account_gain_loss" model="ir.actions.act_window">
             <field name="name">Unrealized Gain or Loss</field>
             <field name="res_model">account.account</field>
             <field name="view_type">form</field>
@@ -650,7 +650,7 @@
                                     <field name="ref"/>
                                     <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
                                     <field name="type" on_change="onchange_type(partner_id, type)"/>
-                                    <field domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]" name="account_id"/>
+                                    <field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/>
                                     <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
                                     <field name="amount"/>
                                 </tree>
@@ -661,7 +661,7 @@
                                         <field name="ref"/>
                                         <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
                                         <field name="type" on_change="onchange_type(partner_id, type)"/>
-                                        <field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('company_id', '=', parent.company_id)]" name="account_id"/>
+                                        <field name="account_id" domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('company_id', '=', parent.company_id)]"/>
                                         <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
                                         <field name="amount"/>
                                         <field name="sequence" readonly="0"/>
@@ -680,6 +680,18 @@
             </field>
         </record>
 
+        <record id="view_bank_statement_form_journal_items" model="ir.ui.view">
+            <field name="name">account.bank.statement.journal.items.form.inherit</field>
+            <field name="model">account.bank.statement</field>
+            <field name="inherit_id" ref="view_bank_statement_form"/>
+            <field name="arch" type="xml">
+                <xpath expr="//div[@name='import_buttons']" position="inside">
+                    <button name=""
+                            string="Journal Items" type="action"
+                            attrs="{'invisible':[('state','!=','confirm')]}"/>
+                </xpath>
+            </field>
+        </record>
 
         <record id="action_bank_statement_tree" model="ir.actions.act_window">
             <field name="name">Bank Statements</field>
@@ -1055,7 +1067,7 @@
             </field>
         </record>
 
-         <record id="view_move_line_tree" model="ir.ui.view">
+        <record id="view_move_line_tree" model="ir.ui.view">
             <field name="name">account.move.line.tree</field>
             <field name="model">account.move.line</field>
             <field eval="4" name="priority"/>
@@ -1850,7 +1862,7 @@
             </field>
         </record>
 
-         <record id="view_subscription_search" model="ir.ui.view">
+        <record id="view_subscription_search" model="ir.ui.view">
             <field name="name">account.subscription.search</field>
             <field name="model">account.subscription</field>
             <field name="arch" type="xml">

=== modified file 'account_analytic_plans/account_analytic_plans_view.xml'
--- account_analytic_plans/account_analytic_plans_view.xml	2012-09-26 07:22:39 +0000
+++ account_analytic_plans/account_analytic_plans_view.xml	2012-11-07 15:26:37 +0000
@@ -276,7 +276,7 @@
                 </field>
             </field>
         </record>
-         <record model="ir.ui.view" id="view_default_inherit_tree">
+        <record model="ir.ui.view" id="view_default_inherit_tree">
             <field name="name">account.analytic.default.tree.plans</field>
             <field name="model">account.analytic.default</field>
             <field name="inherit_id" ref="account_analytic_default.view_account_analytic_default_tree"/>

=== modified file 'account_voucher/__openerp__.py'
--- account_voucher/__openerp__.py	2012-10-30 15:23:20 +0000
+++ account_voucher/__openerp__.py	2012-11-07 15:26:37 +0000
@@ -60,6 +60,9 @@
         'security/account_voucher_security.xml',
         'account_voucher_data.xml',
     ],
+    'js': [
+        'static/src/js/account_voucher.js',
+    ],
     'test' : [
         'test/case5_suppl_usd_usd.yml',
         'test/account_voucher.yml',

=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2012-11-06 12:37:59 +0000
+++ account_voucher/account_voucher.py	2012-11-07 15:26:37 +0000
@@ -267,6 +267,7 @@
     _order = "date desc, id desc"
 #    _rec_name = 'number'
     _columns = {
+        'active':fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the payment term without removing it."),
         'type':fields.selection([
             ('sale','Sale'),
             ('purchase','Purchase'),
@@ -328,6 +329,7 @@
         'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'),
     }
     _defaults = {
+        'active': lambda *a: True,
         'period_id': _get_period,
         'partner_id': _get_partner,
         'journal_id':_get_journal,
@@ -1504,6 +1506,15 @@
 class account_bank_statement(osv.osv):
     _inherit = 'account.bank.statement'
 
+    def button_confirm_bank(self, cr, uid, ids, context=None):
+        statementLine = self.pool.get('account.bank.statement.line')
+        voucher = self.pool.get('account.voucher')
+        for statement in self.browse(cr, uid, ids, context=context):
+            for line in statement.line_ids:
+                if line.voucher_id:
+                    voucher.write(cr, uid, line.voucher_id.id, {'active':True}, context=context)
+        return super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context)
+
     def button_cancel(self, cr, uid, ids, context=None):
         voucher_obj = self.pool.get('account.voucher')
         for st in self.browse(cr, uid, ids, context=context):
@@ -1534,6 +1545,13 @@
             return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
         return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)
 
+    def unlink(self, cr, uid, ids, context=None):
+        statementLine = self.pool.get('account.bank.statement.line')
+        for statement in self.read(cr, uid, ids, ['line_ids'], context=context):
+            statementLine.unlink(cr, uid, statement['line_ids'], context=context)
+        return super(account_bank_statement, self).unlink(cr, uid, ids, context=context)
+
+
 account_bank_statement()
 
 class account_bank_statement_line(osv.osv):
@@ -1565,7 +1583,7 @@
     _columns = {
         'amount_reconciled': fields.function(_amount_reconciled,
             string='Amount reconciled', type='float'),
-        'voucher_id': fields.many2one('account.voucher', 'Payment'),
+        'voucher_id': fields.many2one('account.voucher', 'Reconciliation'),
     }
 
     def unlink(self, cr, uid, ids, context=None):

=== modified file 'account_voucher/account_voucher_view.xml'
--- account_voucher/account_voucher_view.xml	2012-10-26 09:58:21 +0000
+++ account_voucher/account_voucher_view.xml	2012-11-07 15:26:37 +0000
@@ -200,7 +200,7 @@
             <field name="arch" type="xml">
                 <xpath expr="//div[@name='import_buttons']" position="inside">
                     <button name="%(action_view_account_statement_from_invoice_lines)d"
-                            string="Import Invoices" type="action" icon="gtk-execute"
+                            string="Import Invoices" type="action"
                             attrs="{'invisible':[('state','=','confirm')]}"/>
                 </xpath>
             </field>
@@ -212,7 +212,7 @@
             <field name="inherit_id" ref="account.view_bank_statement_form"/>
             <field name="arch" type="xml">
                 <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
-                    <field name="voucher_id" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
+                    <field name="voucher_id" widget="many2onebutton" options="{'label':{'create':'Reconcile','edit':'Reconciled'}}" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
                 </xpath>
             </field>
         </record>
@@ -223,10 +223,11 @@
             <field name="inherit_id" ref="account.view_bank_statement_form"/>
             <field name="arch" type="xml">
                 <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/form/group/field[@name='sequence']" position="before">
-                    <field name="voucher_id" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
+                    <field name="voucher_id" widget="many2onebutton" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
                 </xpath>
             </field>
         </record>
+
         <record id="view_cash_statement_tree_voucher" model="ir.ui.view">
             <field name="name">account.cash.statement.voucher.tree.inherit</field>
             <field name="model">account.bank.statement</field>

=== added directory 'account_voucher/static/src/js'
=== added file 'account_voucher/static/src/js/account_voucher.js'
--- account_voucher/static/src/js/account_voucher.js	1970-01-01 00:00:00 +0000
+++ account_voucher/static/src/js/account_voucher.js	2012-11-07 15:26:37 +0000
@@ -0,0 +1,12 @@
+openerp.account_voucher = function(instance) {
+
+    instance.web.form.Many2OneButton = instance.web.form.Many2OneButton.extend({
+        on_click: function() {
+            this._super.apply(this, arguments);
+            this.popup.on('create_completed write_completed', self, function(r) {
+                var voucher = new instance.web.Model('account.voucher');
+                voucher.call('write', [[r], {'active':false}]);
+            });
+        },
+    });
+}
\ No newline at end of file

=== modified file 'account_voucher/voucher_payment_receipt_view.xml'
--- account_voucher/voucher_payment_receipt_view.xml	2012-10-30 05:49:31 +0000
+++ account_voucher/voucher_payment_receipt_view.xml	2012-11-07 15:26:37 +0000
@@ -390,35 +390,33 @@
             <field name="model">account.voucher</field>
             <field name="arch" type="xml">
                 <form string="Receipt" version="7.0">
-                <header>
-                    <button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)" class="oe_highlight"/>
-                    <button name="cancel_voucher" string="Cancel" states="draft,proforma"  invisible="context.get('line_type', False)"/>
-                    <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile and cancel this record ?"/>
-                    <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="context.get('line_type', False)"/>
+                <header invisible="context.get('line_type', False)">
+                    <button name="proforma_voucher" string="Validate" states="draft" class="oe_highlight"/>
+                    <button name="cancel_voucher" string="Cancel" states="draft,proforma"/>
+                    <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" confirm="Are you sure to unreconcile and cancel this record ?"/>
+                    <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft"/>
                     <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
                 </header>
                 <sheet>
                     <h1 attrs="{'invisible': [('number','=',False)]}"><field name="number"/></h1>
-                    <group>
+                    <group invisible="context.get('line_type', False)">
                         <group>
-                            <field name="partner_id" domain="[('customer','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
+                            <field name="partner_id" domain="[('customer','=',True)]" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
                             <field name="currency_id" invisible="1"/>
                             <field name="amount" class="oe_inline"
                                 string="Paid Amount"
                                 widget="monetary" options="{'currency_field': 'currency_id'}"
-                                invisible="context.get('line_type', False)"
                                 on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
                             <field name="journal_id"
                                 domain="[('type','in',['bank', 'cash'])]"
-                                invisible="context.get('line_type', False)"
                                 widget="selection"
                                 on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"
                                 string="Payment Method"/>
                         </group>
                         <group>
-                            <field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
-                            <field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="e.g. 003/10"/>
-                            <field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="e.g. Invoice SAJ/0042"/>
+                            <field name="date" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
+                            <field name="reference" string="Payment Ref" placeholder="e.g. 003/10"/>
+                            <field name="name" colspan="2" placeholder="e.g. Invoice SAJ/0042"/>
                             <field name="company_id" widget="selection" groups="base.group_multi_company"/>
 
                             <field name="account_id"
@@ -430,7 +428,7 @@
                     </group>
                     <notebook>
                         <page string="Payment Information" groups="base.group_user">
-                            <label for="line_cr_ids"/>
+                            <label for="line_cr_ids" invisible="context.get('line_type', False)"/>
                             <field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
                                 <tree string="Invoices and outstanding transactions" editable="bottom" colors="gray:amount==0">
                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
@@ -511,8 +509,12 @@
                         </page>
                     </notebook>
                     </sheet>
+<<<<<<< TREE
                     <div class="oe_chatter">
                         <field name="message_follower_ids" widget="mail_followers"/>
+=======
+                    <div class="oe_chatter" invisible="context.get('line_type', False)">
+>>>>>>> MERGE-SOURCE
                         <field name="message_ids" widget="mail_thread"/>
                     </div>
                 </form>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to