Modifs
bzr revid: fp@tinyerp.com-119a042c5e35a4555ad17fa4005cb89bc83d5aa7
This commit is contained in:
parent
3fdc785db0
commit
6faae72a83
|
@ -167,11 +167,11 @@ class account_move_line(osv.osv):
|
|||
'credit': fields.float('Credit', digits=(16,2), states={'reconciled':[('readonly',True)]}),
|
||||
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", states={'reconciled':[('readonly',True)]}, domain=[('type','<>','view'), ('type', '<>', 'closed')]),
|
||||
|
||||
'move_id': fields.many2one('account.move', 'Entry', required=True, ondelete="cascade", states={'reconciled':[('readonly',True)]}, help="The entry of this entry line.", select=True),
|
||||
'move_id': fields.many2one('account.move', 'Entry', required=True, ondelete="cascade", states={'reconciled':[('readonly',True)]}, help="The entry of this entry line.", select=2),
|
||||
|
||||
'ref': fields.char('Ref.', size=32),
|
||||
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=True),
|
||||
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=True),
|
||||
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2),
|
||||
'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optionnal other currency if it is a multi-currency entry."),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', help="The optionnal other currency if it is a multi-currency entry."),
|
||||
|
||||
|
|
|
@ -961,7 +961,11 @@
|
|||
name="account.move.bank.reconcile"
|
||||
menu="False"
|
||||
id="action_account_bank_reconcile_tree" />
|
||||
<menuitem name="Financial Management/Periodical Processing/Bank reconciliation" id="menu_action_account_bank_reconcile_tree" action="action_account_bank_reconcile_tree" type="wizard"/>
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Reconciliation/Bank reconciliation"
|
||||
id="menu_action_account_bank_reconcile_tree"
|
||||
action="action_account_bank_reconcile_tree"
|
||||
type="wizard"/>
|
||||
|
||||
|
||||
<menuitem name="Financial Management/Reporting" sequence="8"/>
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
name="account.automatic.reconcile"
|
||||
menu="False"
|
||||
id="wizard_automatic_reconcile"/>
|
||||
<menuitem name="Financial Management/Periodical Processing/Automatic reconciliation"
|
||||
<menuitem name="Financial Management/Periodical Processing/Reconciliation/Automatic reconciliation"
|
||||
action="wizard_automatic_reconcile"
|
||||
type="wizard"
|
||||
id="menu_automatic_reconcile"/>
|
||||
|
@ -76,7 +76,7 @@
|
|||
menu="False"
|
||||
id="wizard_reconcile_select"/>
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Manual reconciliation"
|
||||
name="Financial Management/Periodical Processing/Reconciliation/Manual reconciliation"
|
||||
action="wizard_reconcile_select"
|
||||
type="wizard"
|
||||
id="menu_reconcile_select"/>
|
||||
|
@ -95,7 +95,7 @@
|
|||
menu="False"
|
||||
id="wizard_unreconcile_select"/>
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Manual unreconciliation"
|
||||
name="Financial Management/Periodical Processing/Reconciliation/Manual unreconciliation"
|
||||
action="wizard_unreconcile_select"
|
||||
type="wizard"
|
||||
id="menu_unreconcile_select"/>
|
||||
|
|
|
@ -401,17 +401,15 @@ class account_invoice(osv.osv):
|
|||
if journal.sequence_id:
|
||||
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
|
||||
|
||||
move = {'name': name, 'line_id': line, 'journal_id': journal_id} #, 'state':'posted'}
|
||||
move = {'name': name, 'line_id': line, 'journal_id': journal_id}
|
||||
if inv.period_id:
|
||||
move['period_id'] = inv.period_id.id
|
||||
for i in line:
|
||||
i[2]['period_id'] = inv.period_id.id
|
||||
move_id = self.pool.get('account.move').create(cr, uid, move)
|
||||
|
||||
# make the invoice point to that move
|
||||
self.write(cr, uid, [inv.id], {'move_id': move_id})
|
||||
|
||||
#self.pool.get('account.move').write(cr, uid, [move_id], {'state':'posted'})
|
||||
self.pool.get('account.move').write(cr, uid, [move_id], {'state':'posted'})
|
||||
self._log_event(cr, uid, ids)
|
||||
return True
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class account_asset_asset(osv.osv):
|
|||
'period_id': _get_period,
|
||||
}
|
||||
def _compute_period(self, cr, uid, property, context={}):
|
||||
if len(property.entry_asset_ids or [])>=property.method_delay:
|
||||
if (len(property.entry_asset_ids or [])/2)>=property.method_delay:
|
||||
return False
|
||||
if len(property.entry_asset_ids):
|
||||
cp = property.entry_asset_ids[-1].period_id
|
||||
|
@ -122,12 +122,16 @@ class account_asset_asset(osv.osv):
|
|||
for move in property.asset_id.entry_ids:
|
||||
total += move.debit-move.credit
|
||||
for move in property.entry_asset_ids:
|
||||
if move.account_id == property.account_asset_ids:
|
||||
total += move.debit-move.credit
|
||||
periods = len(property.entry_asset_ids) - property.method_delay
|
||||
periods = (len(property.entry_asset_ids)/2) - property.method_delay
|
||||
if periods==1:
|
||||
amount = total
|
||||
else:
|
||||
if property.method == 'linear':
|
||||
amount = total / periods
|
||||
else:
|
||||
amount = total / periods
|
||||
amount = total * property.method_progress_factor
|
||||
|
||||
move_id = self.pool.get('account.move').create(cr, uid, {
|
||||
'journal_id': property.journal_id.id,
|
||||
|
@ -148,10 +152,7 @@ class account_asset_asset(osv.osv):
|
|||
'partner_id': property.asset_id.partner_id.id,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
})
|
||||
self.pool.get('account.asset.property').write(cr, uid, [property.id], {
|
||||
'entry_asset_ids': [(4, id, [])]
|
||||
})
|
||||
id = self.pool.get('account.move.line').create(cr, uid, {
|
||||
id2 = self.pool.get('account.move.line').create(cr, uid, {
|
||||
'name': property.name or property.asset_id.name,
|
||||
'move_id': move_id,
|
||||
'account_id': property.account_actif_id.id,
|
||||
|
@ -164,9 +165,9 @@ class account_asset_asset(osv.osv):
|
|||
'date': time.strftime('%Y-%m-%d'),
|
||||
})
|
||||
self.pool.get('account.asset.property').write(cr, uid, [property.id], {
|
||||
'entry_actif_ids': [(4, id, False)]
|
||||
'entry_asset_ids': [(4, id2, False),(4,id,False)]
|
||||
})
|
||||
if property.method_delay - len(property.entry_asset_ids)<=1:
|
||||
if property.method_delay - (len(property.entry_asset_ids)/2)<=1:
|
||||
self.pool.get('account.asset.property')._close(cr, uid, property, context)
|
||||
return result
|
||||
return result
|
||||
|
@ -202,7 +203,7 @@ class account_asset_property(osv.osv):
|
|||
def _amount_residual(self, cr, uid, ids, name, args, context={}):
|
||||
id_set=",".join(map(str,ids))
|
||||
cr.execute("""SELECT
|
||||
r.asset_property_id,abs(SUM(l.debit-l.credit)) AS amount
|
||||
r.asset_property_id,SUM(abs(l.debit-l.credit)) AS amount
|
||||
FROM
|
||||
account_move_asset_entry_rel r
|
||||
LEFT JOIN
|
||||
|
@ -243,6 +244,7 @@ class account_asset_property(osv.osv):
|
|||
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic account'),
|
||||
|
||||
'method': fields.selection([('linear','Linear'),('progressif','Progressive')], 'Computation method', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'method_progress_factor': fields.float('Progressif factor', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'method_time': fields.selection([('delay','Delay'),('end','Ending period')], 'Time method', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'method_delay': fields.integer('Number of interval', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'method_period': fields.integer('Period per interval', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -251,7 +253,6 @@ class account_asset_property(osv.osv):
|
|||
'date': fields.date('Date created'),
|
||||
|
||||
'entry_asset_ids': fields.many2many('account.move.line', 'account_move_asset_entry_rel', 'asset_property_id', 'move_id', 'Asset Entries'),
|
||||
'entry_actif_ids': fields.many2many('account.move.line', 'account_move_asset_actif_entry_rel', 'asset_property_id', 'move_id', 'Asset Entries'),
|
||||
'board_ids': fields.one2many('account.asset.board', 'asset_id', 'Asset board'),
|
||||
|
||||
'value_total': fields.function(_amount_total, method=True, digits=(16,2),string='Gross value'),
|
||||
|
@ -264,6 +265,7 @@ class account_asset_property(osv.osv):
|
|||
'state': lambda obj, cr, uid, context: 'draft',
|
||||
'method': lambda obj, cr, uid, context: 'linear',
|
||||
'method_time': lambda obj, cr, uid, context: 'delay',
|
||||
'method_progress_factor': lambda obj, cr, uid, context: 0.3,
|
||||
'method_delay': lambda obj, cr, uid, context: 5,
|
||||
'method_period': lambda obj, cr, uid, context: 12,
|
||||
'date': lambda obj, cr, uid, context: time.strftime('%Y-%m-%d')
|
||||
|
@ -273,7 +275,7 @@ account_asset_property()
|
|||
class account_move_line(osv.osv):
|
||||
_inherit = 'account.move.line'
|
||||
_columns = {
|
||||
'asset_id': fields.many2one('account.asset.asset', 'Asset', relate=True),
|
||||
'asset_id': fields.many2one('account.asset.asset', 'Asset'),
|
||||
}
|
||||
account_move_line()
|
||||
|
||||
|
|
|
@ -80,18 +80,22 @@
|
|||
<field name="type"/>
|
||||
<field name="account_analytic_id"/>
|
||||
<field name="journal_analytic_id"/>
|
||||
<separator string="Depreciation duration" colspan="3"/>
|
||||
<button name="%(wizard_asset_modify)d" states="open" string="Change duration" type="action"/>
|
||||
<separator string="Depreciation duration" colspan="4"/>
|
||||
<field name="method"/>
|
||||
<field name="method_progress_factor"/>
|
||||
<field name="method_time"/>
|
||||
<newline/>
|
||||
<field name="method_delay"/>
|
||||
<field name="method_period"/>
|
||||
<button
|
||||
name="%(wizard_asset_modify)d"
|
||||
states="open"
|
||||
string="Change duration"
|
||||
type="action"
|
||||
colspan="2"/>
|
||||
<!-- <field name="method_end"/> -->
|
||||
</page>
|
||||
<page string="Depreciation entries">
|
||||
<field name="entry_asset_ids" colspan="4" nolabel="1" readonly="1"/>
|
||||
<field name="entry_actif_ids" colspan="4" nolabel="1" readonly="1"/>
|
||||
</page>
|
||||
<page string="Change history">
|
||||
<field name="history_ids" colspan="4" nolabel="1" readonly="1"/>
|
||||
|
|
|
@ -69,6 +69,8 @@ class account_move_line(osv.osv):
|
|||
if c[0]=='journal_id':
|
||||
ok = False
|
||||
break
|
||||
if 'journal_id' in context:
|
||||
ok=False
|
||||
if ok:
|
||||
plus = ''
|
||||
for state in context.get('journal_state', []):
|
||||
|
|
Loading…
Reference in New Issue