[IMP] account_asset: rename field, add onchange method on purchase_value, salvage_value and account_check_writing: Move Total Field below Payment Method field
bzr revid: jap@tinyerp.com-20121126101353-seazfz9jn10abhat
This commit is contained in:
parent
828cce9be0
commit
9ed5746c0c
|
@ -41,7 +41,7 @@ class account_asset_category(osv.osv):
|
||||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||||
'method': fields.selection([('linear','Linear'),('degressive','Degressive')], 'Computation Method', required=True, help="Choose the method to use to compute the amount of depreciation lines.\n"\
|
'method': fields.selection([('linear','Linear'),('degressive','Degressive')], 'Computation Method', required=True, help="Choose the method to use to compute the amount of depreciation lines.\n"\
|
||||||
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
|
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
|
||||||
" * Degressive: Calculated on basis of: Remaining Value * Degressive Factor"),
|
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor"),
|
||||||
'method_number': fields.integer('Number of Depreciations'),
|
'method_number': fields.integer('Number of Depreciations'),
|
||||||
'method_period': fields.integer('Period Length', help="State here the time between 2 depreciations, in months", required=True),
|
'method_period': fields.integer('Period Length', help="State here the time between 2 depreciations, in months", required=True),
|
||||||
'method_progress_factor': fields.float('Degressive Factor'),
|
'method_progress_factor': fields.float('Degressive Factor'),
|
||||||
|
@ -222,6 +222,16 @@ class account_asset_asset(osv.osv):
|
||||||
else:
|
else:
|
||||||
val['currency_id'] = company.currency_id.id
|
val['currency_id'] = company.currency_id.id
|
||||||
return {'value': val}
|
return {'value': val}
|
||||||
|
|
||||||
|
def onchange_value_residual(self, cr, uid, ids, purchase_value, salvage_value=False, context=None):
|
||||||
|
val = {}
|
||||||
|
asset = self.browse(cr, uid, ids, context=context)
|
||||||
|
for i in asset:
|
||||||
|
if purchase_value:
|
||||||
|
val['value_residual'] = purchase_value - salvage_value
|
||||||
|
if salvage_value:
|
||||||
|
val['value_residual'] = purchase_value - salvage_value
|
||||||
|
return {'value': val}
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'account_move_line_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
|
'account_move_line_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
|
@ -243,9 +253,9 @@ class account_asset_asset(osv.osv):
|
||||||
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True, states={'draft':[('readonly',False)]}),
|
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
'method': fields.selection([('linear','Linear'),('degressive','Degressive')], 'Computation Method', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="Choose the method to use to compute the amount of depreciation lines.\n"\
|
'method': fields.selection([('linear','Linear'),('degressive','Degressive')], 'Computation Method', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="Choose the method to use to compute the amount of depreciation lines.\n"\
|
||||||
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
|
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
|
||||||
" * Degressive: Calculated on basis of: Remaining Value * Degressive Factor"),
|
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor"),
|
||||||
'method_number': fields.integer('Number of Depreciations', readonly=True, states={'draft':[('readonly',False)]}, help="Calculates Depreciation within specified interval"),
|
'method_number': fields.integer('Number of Depreciations', readonly=True, states={'draft':[('readonly',False)]}, help="Calculates Depreciation within specified interval"),
|
||||||
'method_period': fields.integer('Number of Months in a Period', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="State here the time during 2 depreciations, in months"),
|
'method_period': fields.integer('Number of Months in a Period', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The amount of time between two depreciations, in months"),
|
||||||
'method_end': fields.date('Ending Date', readonly=True, states={'draft':[('readonly',False)]}),
|
'method_end': fields.date('Ending Date', readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
'method_progress_factor': fields.float('Degressive Factor', readonly=True, states={'draft':[('readonly',False)]}),
|
'method_progress_factor': fields.float('Degressive Factor', readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
'value_residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual Value'),
|
'value_residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual Value'),
|
||||||
|
@ -359,8 +369,8 @@ class account_asset_depreciation_line(osv.osv):
|
||||||
'sequence': fields.integer('Sequence', required=True),
|
'sequence': fields.integer('Sequence', required=True),
|
||||||
'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),
|
'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),
|
||||||
'parent_state': fields.related('asset_id', 'state', type='char', string='State of Asset'),
|
'parent_state': fields.related('asset_id', 'state', type='char', string='State of Asset'),
|
||||||
'amount': fields.float('Depreciation Amount', digits_compute=dp.get_precision('Account'), required=True),
|
'amount': fields.float('Current Depreciation', digits_compute=dp.get_precision('Account'), required=True),
|
||||||
'remaining_value': fields.float('Amount to Depreciate', digits_compute=dp.get_precision('Account'),required=True),
|
'remaining_value': fields.float('Next Period Depreciation', digits_compute=dp.get_precision('Account'),required=True),
|
||||||
'depreciated_value': fields.float('Amount Already Depreciated', required=True),
|
'depreciated_value': fields.float('Amount Already Depreciated', required=True),
|
||||||
'depreciation_date': fields.date('Depreciation Date', select=1),
|
'depreciation_date': fields.date('Depreciation Date', select=1),
|
||||||
'move_id': fields.many2one('account.move', 'Depreciation Entry'),
|
'move_id': fields.many2one('account.move', 'Depreciation Entry'),
|
||||||
|
@ -460,7 +470,7 @@ class account_asset_history(osv.osv):
|
||||||
help="The method to use to compute the dates and number of depreciation lines.\n"\
|
help="The method to use to compute the dates and number of depreciation lines.\n"\
|
||||||
"Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
|
"Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
|
||||||
"Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
|
"Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
|
||||||
'method_number': fields.integer('Number of Depreciations'),
|
'method_number': fields.integer('Number of Depreciations', help="The number of depreciations needed to depreciate your asset"),
|
||||||
'method_period': fields.integer('Period Length', help="Time in month between two depreciations"),
|
'method_period': fields.integer('Period Length', help="Time in month between two depreciations"),
|
||||||
'method_end': fields.date('Ending date'),
|
'method_end': fields.date('Ending date'),
|
||||||
'note': fields.text('Note'),
|
'note': fields.text('Note'),
|
||||||
|
|
|
@ -108,8 +108,8 @@
|
||||||
<page string="General">
|
<page string="General">
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="purchase_value" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
<field name="purchase_value" widget="monetary" options="{'currency_field': 'currency_id'}" on_change="onchange_value_residual(purchase_value)"/>
|
||||||
<field name="salvage_value" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
<field name="salvage_value" widget="monetary" options="{'currency_field': 'currency_id'}" on_change="onchange_value_residual(purchase_value,salvage_value)"/>
|
||||||
<field name="value_residual" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
<field name="value_residual" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||||
<field name="partner_id"/>
|
<field name="partner_id"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<field name="model">account.voucher</field>
|
<field name="model">account.voucher</field>
|
||||||
<field name="inherit_id" ref="account_voucher.view_vendor_payment_form" />
|
<field name="inherit_id" ref="account_voucher.view_vendor_payment_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="journal_id" position="after">
|
<field name="amount" position="after">
|
||||||
<newline/>
|
<newline/>
|
||||||
<field name="allow_check" invisible="1"/>
|
<field name="allow_check" invisible="1"/>
|
||||||
<field name="amount_in_word" attrs="{'invisible':[('allow_check','!=',1)]}" nolabel="1" colspan="6"/>
|
<field name="amount_in_word" attrs="{'invisible':[('allow_check','!=',1)]}" nolabel="1" colspan="6"/>
|
||||||
|
|
|
@ -139,13 +139,13 @@
|
||||||
<group>
|
<group>
|
||||||
<field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" string="Supplier"/>
|
<field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" string="Supplier"/>
|
||||||
<field name="currency_id" invisible="1"/>
|
<field name="currency_id" invisible="1"/>
|
||||||
<field name="amount" 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)" class="oe_inline" widget='monetary' options='{"currency_field": "currency_id"}'/>
|
|
||||||
<field name="journal_id"
|
<field name="journal_id"
|
||||||
domain="[('type','in',['bank', 'cash'])]"
|
domain="[('type','in',['bank', 'cash'])]"
|
||||||
invisible="context.get('line_type', False)"
|
invisible="context.get('line_type', False)"
|
||||||
widget="selection"
|
widget="selection"
|
||||||
on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"
|
on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"
|
||||||
string="Payment Method"/>
|
string="Payment Method"/>
|
||||||
|
<field name="amount" 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)" class="oe_inline" widget='monetary' options='{"currency_field": "currency_id"}'/>
|
||||||
</group>
|
</group>
|
||||||
<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="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
|
||||||
|
|
Loading…
Reference in New Issue