[IMP] improve view + add functional field in statement to disable list button

bzr revid: rgaopenerp-20120822053401-vyczfhzo3l3zavty
This commit is contained in:
RGA(OpenERP) 2012-08-22 11:04:01 +05:30
parent c9c4fd2e0f
commit c6502634bf
4 changed files with 19 additions and 7 deletions

View File

@ -21,12 +21,12 @@
<label for="latest_date"/>
<field name="latest_date"/>
</div>
<div>
<div class="oe_reconcile_row">
<a type="button" class="oe_reconcile oe_reconcile_button" name="%(action_view_account_move_line_reconcile)d">Reconcile</a>
<a type="button" class="oe_nothing_to_reconcile oe_reconcile_button" name="skip_partner">Nothing to Reconcile</a>
<field name="reconciliation_progress" widget="progressbar"/>
</div>
<div name="div4">
<div name="div4" class="oe_reconcile_row">
</div>
</group>
</form>

View File

@ -73,7 +73,9 @@
.openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar {
width: 200px !important;
}
.openerp .oe_extended_form_view div.oe_reconcile_row{
margin-top:7px;
}
.openerp .oe_list_content > tbody > tr > td > button.reconcile_btn {
color: white;
background-color: #8a89ba;

View File

@ -1499,8 +1499,6 @@ class account_bank_statement_line(osv.osv):
statement_id = ids[0]
statement = self.browse(cr, uid, statement_id, context=context)
voucher = statement.voucher_id or False
if voucher and voucher.state == 'posted':
return voucher.cancel_voucher(context=context)
mod_obj = self.pool.get('ir.model.data')
if voucher and voucher.type == 'customer':
res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
@ -1529,7 +1527,16 @@ class account_bank_statement_line(osv.osv):
else:
res[line.id] = 0.0
return res
def _is_reconciled(self, cr, uid, ids, name, args, context=None):
res = {}
for line in self.browse(cr, uid, ids, context=context):
if line.voucher_id and line.voucher_id.state == 'posted':
res[line.id] = True
else:
res[line.id] = False
return res
def _check_amount(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
if obj.voucher_id:
@ -1543,6 +1550,8 @@ class account_bank_statement_line(osv.osv):
]
_columns = {
'is_reconciled': fields.function(_is_reconciled,
string='Statement is reconciled?', type='boolean'),
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', type='float'),
'voucher_id': fields.many2one('account.voucher', 'Payment'),

View File

@ -217,7 +217,8 @@
<button type="button" class="oe_mail_button_follow oe_mail_button_mouseout">Reconcile</button>
<button type="button" class="oe_mail_button_unfollow oe_mail_button_mouseout">Unreconcile</button>
-->
<button class="reconcile_btn" name="action_payment_reconcile" string="Reconcile" type="object"/>
<button class="reconcile_btn" attrs="{'readonly':[('is_reconciled','=',True)]}" name="action_payment_reconcile" string="Reconcile" type="object"/>
<field name="is_reconciled" invisible="1"/>
</xpath>
</field>
</record>