[FIX] account_asset: Corrected field name and coding conventions.
bzr revid: uco@tinyerp.com-20110520052005-7sdpwk5qabsk7ejg
This commit is contained in:
parent
029c429945
commit
2c05c96a40
|
@ -37,7 +37,7 @@ class account_asset_category(osv.osv):
|
|||
'account_expense_depreciation_id': fields.many2one('account.account', 'Depr. Expense Account', required=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'on_change_state': fields.boolean('Skip Draft State', help="Check this if you want to skip draft state for asset when it is created by invoice."),
|
||||
'asset_normal': fields.boolean('Skip Draft State', help="Check this if you want to skip draft state for asset when it is created by invoice."),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -26,7 +26,7 @@ class account_invoice(osv.osv):
|
|||
_inherit = 'account.invoice'
|
||||
def line_get_convert(self, cr, uid, x, part, date, context={}):
|
||||
res = super(account_invoice, self).line_get_convert(cr, uid, x, part, date, context)
|
||||
res['asset_category_id'] = x.get('asset_category_id', False)
|
||||
res['asset_id'] = x.get('asset_id', False)
|
||||
return res
|
||||
account_invoice()
|
||||
|
||||
|
@ -36,17 +36,16 @@ class account_invoice_line(osv.osv):
|
|||
'asset_category_id': fields.many2one('account.asset.category', 'Asset Category'),
|
||||
}
|
||||
def move_line_get_item(self, cr, uid, line, context={}):
|
||||
res = super(account_invoice_line, self).move_line_get_item(cr, uid, line, context)
|
||||
res['asset_category_id'] = line.asset_category_id.id or False
|
||||
asset_obj = self.pool.get('account.asset.asset')
|
||||
if line.asset_category_id.id:
|
||||
res = super(account_invoice_line, self).move_line_get_item(cr, uid, line, context)
|
||||
if line.asset_category_id and line.asset_category_id.id:
|
||||
vals = {
|
||||
'name': line.product_id and (line.name + ": " + line.product_id.name) or line.name,
|
||||
'category_id': line.asset_category_id.id,
|
||||
'purchase_value': line.price_subtotal
|
||||
}
|
||||
asset_id = asset_obj.create(cr, uid, vals, context=context)
|
||||
if line.asset_category_id.on_change_state:
|
||||
if line.asset_category_id.asset_normal:
|
||||
asset_obj.validate(cr, uid, [asset_id], context=context)
|
||||
return res
|
||||
account_invoice_line()
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<field name="account_asset_id"/>
|
||||
<field name="account_depreciation_id"/>
|
||||
<field name="account_expense_depreciation_id"/>
|
||||
<field name="on_change_state"/>
|
||||
<field name="asset_normal"/>
|
||||
<group col="4" colspan="4" groups="analytic.group_analytic_accounting">
|
||||
<separator string="Analytic information" colspan="4" />
|
||||
<newline/>
|
||||
|
|
Loading…
Reference in New Issue