# 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']
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):
##############################################################################
import time
from datetime import datetime
-
import netsvc
from osv import fields, osv
from tools.translate import _
context=context)
dt = period.date_start
return dt
+
def _get_currency(self, cr, uid, context={}):
if not context.get('journal_id', False):
return False
#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:
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()
<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>
<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>