diff --git a/addons/account/__init__.py b/addons/account/__init__.py
index 8e83d9aa7a7..da397978bd2 100644
--- a/addons/account/__init__.py
+++ b/addons/account/__init__.py
@@ -33,5 +33,4 @@ import product
import sequence
import company
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/account.py b/addons/account/account.py
index a6e3c09884a..99ce9b60339 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -18,19 +18,16 @@
# along with this program. If not, see .
#
##############################################################################
-
import time
-import netsvc
-
-from osv import fields, osv
-import decimal_precision as dp
-
-from tools.misc import currency
-from tools.translate import _
-import pooler
from datetime import datetime
from dateutil.relativedelta import relativedelta
+import netsvc
+import pooler
+from osv import fields, osv
+import decimal_precision as dp
+from tools.misc import currency
+from tools.translate import _
from tools import config
class account_payment_term(osv.osv):
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index c599c7c4447..7dbbd0356be 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -18,13 +18,12 @@
# along with this program. If not, see .
#
##############################################################################
-
import time
+from datetime import datetime
+
import netsvc
from osv import fields, osv
from tools.translate import _
-
-from datetime import datetime
import decimal_precision as dp
import tools
diff --git a/addons/account/company.py b/addons/account/company.py
index 2301cc16d9a..8aa41dc47c6 100644
--- a/addons/account/company.py
+++ b/addons/account/company.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
@@ -33,3 +33,5 @@ out after this mail was sent, please consider the present one as \
void. Do not hesitate to contact our accounting department'
}
res_company()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/installer.py b/addons/account/installer.py
index 44eb081d7be..6141e4adf9e 100644
--- a/addons/account/installer.py
+++ b/addons/account/installer.py
@@ -21,12 +21,13 @@
import time
import datetime
from dateutil.relativedelta import relativedelta
-from tools.translate import _
+from os.path import join as opj
from operator import itemgetter
+
+from tools.translate import _
from osv import fields, osv
import netsvc
import tools
-from os.path import join as opj
class account_installer(osv.osv_memory):
_name = 'account.installer'
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index f68e57b4bb4..2dbb91e1e28 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -772,11 +772,18 @@ class account_invoice(osv.osv):
# one move line per tax line
iml += ait_obj.move_line_get(cr, uid, inv.id)
-
+
+ entry_type=''
if inv.type in ('in_invoice', 'in_refund'):
ref = inv.reference
+ entry_type = 'journal_pur_voucher'
+ if inv.type in ('in_refund'):
+ entry_type = 'cont_voucher'
else:
ref = self._convert_ref(cr, uid, inv.number)
+ entry_type = 'journal_sale_vou'
+ if inv.type in ('out_refund'):
+ entry_type = 'cont_voucher'
diff_currency_p = inv.currency_id.id <> company_currency
# create one move line for the total and possibly adjust the other lines amount
@@ -847,7 +854,7 @@ class account_invoice(osv.osv):
line = self.finalize_invoice_move_lines(cr, uid, inv, line)
- move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date}
+ move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date, 'type': entry_type}
period_id=inv.period_id and inv.period_id.id or False
if not period_id:
period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
@@ -1070,10 +1077,18 @@ class account_invoice(osv.osv):
else:
amount_currency = False
currency_id = False
+ entry_type=''
if invoice.type in ('in_invoice', 'in_refund'):
ref = invoice.reference
+ entry_type = 'journal_pur_voucher'
+ if invoice.type in ('in_refund'):
+ entry_type = 'cont_voucher'
else:
ref = self._convert_ref(cr, uid, invoice.number)
+ entry_type = 'journal_sale_vou'
+ if invoice.type in ('out_refund'):
+ entry_type = 'cont_voucher'
+
# Pay attention to the sign for both debit/credit AND amount_currency
l1 = {
'debit': direction * pay_amount>0 and direction * pay_amount,
@@ -1104,7 +1119,7 @@ class account_invoice(osv.osv):
l2['name'] = name
lines = [(0, 0, l1), (0, 0, l2)]
- move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date}
+ move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date, 'type': entry_type}
move_id = self.pool.get('account.move').create(cr, uid, move, context=context)
line_ids = []
diff --git a/addons/account/product.py b/addons/account/product.py
index b2963a34fec..0d17b83ea58 100644
--- a/addons/account/product.py
+++ b/addons/account/product.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,11 +15,12 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
import time
+
import netsvc
from osv import fields, osv
diff --git a/addons/account/sequence.py b/addons/account/sequence.py
index e23ec1e3def..c90e9ef93c7 100644
--- a/addons/account/sequence.py
+++ b/addons/account/sequence.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,11 +15,10 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
-
from osv import fields,osv
class ir_sequence_fiscalyear(osv.osv):