~koi-accounting-modules-maintainer/koi-accounting-modules/7.0-fixed-asset

« back to all changes in this revision

Viewing changes to koi_account_asset/object_other/account_asset.py

  • Committer: Andhitia Rama
  • Date: 2014-05-07 12:17:52 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: andhitia.r@gmail.com-20140507121752-rlxmcufgkkigjivg
Perbaikan pembuatan penjurnalan dari depreciation board

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from dateutil.relativedelta import relativedelta
25
25
 
26
26
from openerp.osv import fields, osv
27
 
import openerp.addons.decimal_precision as dp
28
27
from tools.translate import _
29
28
 
30
29
 
34
33
    _description = 'Asset'
35
34
 
36
35
    _columns =  {
37
 
                        'purchase_date' : fields.date('First Depreciation Date', required=True, readonly=True, states={'draft':[('readonly',False)]}),
38
 
                        }
 
36
                'purchase_date' : fields.date('First Depreciation Date', required=True, readonly=True, states={'draft':[('readonly',False)]}),
 
37
                }
39
38
 
40
39
 
41
40
    def compute_depreciation_board(self, cr, uid, ids, context=None):
77
76
                # compute amount into company currency
78
77
                amount = currency_obj.compute(cr, uid, current_currency, company_currency, amount, context=context)
79
78
                residual_amount -= amount
80
 
                vals = {
81
 
                     'amount': amount,
82
 
                     'asset_id': asset.id,
83
 
                     'sequence': i,
84
 
                     'name': str(asset.id) +'/' + str(i),
85
 
                     'remaining_value': residual_amount,
86
 
                     'depreciated_value': (asset.purchase_value - asset.salvage_value) - (residual_amount + amount),
87
 
                     'depreciation_date': depreciation_date.strftime('%Y-%m-%d'),
88
 
                }
 
79
                vals =  {
 
80
                        'amount': amount,
 
81
                        'asset_id': asset.id,
 
82
                        'sequence': i,
 
83
                        'name': str(asset.id) +'/' + str(i),
 
84
                        'remaining_value': residual_amount,
 
85
                        'depreciated_value': (asset.purchase_value - asset.salvage_value) - (residual_amount + amount),
 
86
                        'depreciation_date': depreciation_date.strftime('%Y-%m-%d'),
 
87
                        }
89
88
                depreciation_lin_obj.create(cr, uid, vals, context=context)
90
89
                # Considering Depr. Period as months
91
90
                depreciation_date = (datetime(year, month, day) + relativedelta(months=+asset.method_period))
125
124
            asset_name = line.asset_id.name
126
125
            reference = line.name
127
126
            move_vals = {
128
 
                #'name': asset_name,
129
 
                'date': depreciation_date,
130
 
                'ref': reference,
131
 
                'period_id': period_ids and period_ids[0] or False,
132
 
                'journal_id': line.asset_id.category_id.journal_id.id,
133
 
                }
 
127
                        #'name': asset_name,
 
128
                        'date': depreciation_date,
 
129
                        'ref': reference,
 
130
                        'period_id': period_ids and period_ids[0] or False,
 
131
                        'journal_id': line.asset_id.category_id.journal_id.id,
 
132
                        }
134
133
            move_id = move_obj.create(cr, uid, move_vals, context=context)
135
134
            journal_id = line.asset_id.category_id.journal_id.id
136
135
            partner_id = line.asset_id.partner_id.id
137
136
            move_line_obj.create(cr, uid, {
138
 
                'name': asset_name,
 
137
                'name': _('Asset depreciation for [%s] - %s') % (line.asset_id.code and line.asset_id.code or '-', asset_name),
139
138
                'ref': reference,
140
139
                'move_id': move_id,
141
140
                'account_id': line.asset_id.category_id.account_depreciation_id.id,
149
148
                'date': depreciation_date,
150
149
            })
151
150
            move_line_obj.create(cr, uid, {
152
 
                'name': asset_name,
 
151
                'name': _('Asset depreciation for [%s] - %s') % (line.asset_id.code and line.asset_id.code or '-', asset_name),
153
152
                'ref': reference,
154
153
                'move_id': move_id,
155
154
                'account_id': line.asset_id.category_id.account_expense_depreciation_id.id,