[FIX]: account.move: improve a copy method
[IMP]: improvement for a views bzr revid: mga@tinyerp.com-20100724181802-lqx0gx47fg8j1et0
This commit is contained in:
parent
ba6f53f2c1
commit
8c04abda1b
|
@ -1163,8 +1163,20 @@ class account_move(osv.osv):
|
|||
# TODO: Check if period is closed !
|
||||
#
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
if 'line_id' in vals:
|
||||
if 'journal_id' in vals:
|
||||
if 'line_id' in vals and context.get('copy'):
|
||||
for l in vals['line_id']:
|
||||
if not l[0]:
|
||||
l[2].update({
|
||||
'reconcile_id':False,
|
||||
'reconcil_partial_id':False,
|
||||
'analytic_lines':False,
|
||||
'invoice':False,
|
||||
'ref':False,
|
||||
'balance':False,
|
||||
'account_tax_id':False,
|
||||
})
|
||||
|
||||
if 'journal_id' in vals and vals.get('journal_id', False):
|
||||
for l in vals['line_id']:
|
||||
if not l[0]:
|
||||
l[2]['journal_id'] = vals['journal_id']
|
||||
|
@ -1190,11 +1202,14 @@ class account_move(osv.osv):
|
|||
result = super(account_move, self).create(cr, uid, vals, context)
|
||||
return result
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
default.update({'state':'draft', 'name':'/',})
|
||||
def copy(self, cr, uid, id, default={}, context={}):
|
||||
default.update({
|
||||
'state':'draft',
|
||||
'name':'/',
|
||||
})
|
||||
context.update({
|
||||
'copy':True
|
||||
})
|
||||
return super(account_move, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def unlink(self, cr, uid, ids, context={}, check=True):
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
##############################################################################
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
@ -454,6 +453,7 @@ class account_move_line(osv.osv):
|
|||
context=context)
|
||||
dt = period.date_start
|
||||
return dt
|
||||
|
||||
def _get_currency(self, cr, uid, context={}):
|
||||
if not context.get('journal_id', False):
|
||||
return False
|
||||
|
@ -1110,10 +1110,10 @@ class account_move_line(osv.osv):
|
|||
|
||||
#if not 'currency_id' in vals:
|
||||
# vals['currency_id'] = account.company_id.currency_id.id
|
||||
|
||||
|
||||
result = super(osv.osv, self).create(cr, uid, vals, context)
|
||||
# CREATE Taxes
|
||||
if vals.get('account_tax_id',False):
|
||||
if vals.get('account_tax_id', False):
|
||||
tax_id = tax_obj.browse(cr, uid, vals['account_tax_id'])
|
||||
total = vals['debit'] - vals['credit']
|
||||
if journal.refund_journal:
|
||||
|
@ -1186,7 +1186,7 @@ class account_move_line(osv.osv):
|
|||
if check and ((not context.get('no_store_function')) or journal.entry_posted):
|
||||
tmp = self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
|
||||
if journal.entry_posted and tmp:
|
||||
self.pool.get('account.move').button_validate(cr,uid, [vals['move_id']],context)
|
||||
rs = self.pool.get('account.move').button_validate(cr,uid, [vals['move_id']],context)
|
||||
return result
|
||||
account_move_line()
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@
|
|||
<field name="partner_id"/>
|
||||
<field name="line_id"/>
|
||||
<field name="to_check" groups="base.group_extended"/>
|
||||
<field name="amount"/>
|
||||
<field name="amount" operator="+"/>
|
||||
<field name="state"/>
|
||||
<button name="button_validate" states="draft" string="Approve" type="object" icon="terp-camera_test"/>
|
||||
</tree>
|
||||
|
@ -1125,7 +1125,6 @@
|
|||
<field name="period_id"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="company_id" required="1" groups="base.group_multi_company"/>
|
||||
|
||||
<field name="partner_id" invisible="1" select="1"/>
|
||||
<field name="amount" invisible="1" select="1"/>
|
||||
</group>
|
||||
|
|
Loading…
Reference in New Issue