diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 8ae66ba34b7..df99132a631 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1288,11 +1288,11 @@
-
+
-
-
-
+
+
+
diff --git a/addons/account/test/chart_of_account.yml b/addons/account/test/chart_of_account.yml
index 39d7428ea73..09271f778be 100644
--- a/addons/account/test/chart_of_account.yml
+++ b/addons/account/test/chart_of_account.yml
@@ -25,21 +25,19 @@
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_account_tree2")],
"tz": False, "active_id": ref("account.menu_action_account_tree2"), })
--
- In order to test Account Move Line Wizard I check the move line entries using this wizard
--
- !record {model: account.move.line.select, id: account_move_line_select_0}:
- {}
--
- I clicked on Button to open the account move lines
--
- !python {model: account.move.line.select}: |
- self.open_window(cr, uid, [ref("account_move_line_select_0")], {"lang": 'en_US',
- "state": "all", "tz": False, "active_model": "account.account", "active_ids":
- [ref("account.a_recv")], "fiscalyear": 1, "active_id": ref("account.a_recv"),
- })
-
-
+#-
+# In order to test Account Move Line Wizard I check the move line entries using this wizard
+#-
+# !record {model: account.move.line.select, id: account_move_line_select_0}:
+# {}
+#-
+# I clicked on Button to open the account move lines
+#-
+# !python {model: account.move.line.select}: |
+# self.open_window(cr, uid, [ref("account_move_line_select_0")], {"lang": 'en_US',
+# "state": "all", "tz": False, "active_model": "account.account", "active_ids":
+# [ref("account.a_recv")], "fiscalyear": 1, "active_id": ref("account.a_recv"),
+# })
-
In order to test the Analytic Charts of Account wizard I will generate chart
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index 0f1885689c2..0b1b9b01b23 100644
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -112,7 +112,6 @@ class account_voucher(osv.osv):
('bank_pay_voucher','Bank Payment'),
('rec_voucher','Cash Receipt'),
('bank_rec_voucher','Bank Receipt'),
-# ('cont_voucher','Contra'),
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
@@ -120,9 +119,9 @@ class account_voucher(osv.osv):
'date':fields.date('Date', readonly=True, states={'draft':[('readonly',False)]}, help="Effective date for accounting entries"),
'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, domain=[('type','<>','view')]),
- 'payment_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=False, states={'draft':[('readonly',True)]}),
- 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'posted':[('readonly',True)]}),
- 'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}, required=False),
+ 'payment_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=True, states={'draft':[('readonly',False)]}),
+ 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'posted':[('readonly',False)]}),
+ 'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state':fields.selection(
@@ -262,26 +261,33 @@ class account_voucher(osv.osv):
move_line_pool = self.pool.get('account.move.line')
analytic_pool = self.pool.get('account.analytic.line')
currency_pool = self.pool.get('res.currency')
+ invoice_pool = self.pool.get('account.invoice')
for inv in self.browse(cr, uid, ids):
-
+
if inv.move_id:
continue
-
- company_currency = inv.company_id.currency_id.id
- diff_currency_p = inv.currency_id.id <> company_currency
-
+
journal = journal_pool.browse(cr, uid, inv.journal_id.id)
if journal.sequence_id:
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
+ ref = False
+ if inv.type in ('journal_pur_voucher', 'bank_rec_voucher', 'rec_voucher'):
+ ref = inv.reference
+ else:
+ ref = invoice_pool._convert_ref(cr, uid, name)
+
+ company_currency = inv.company_id.currency_id.id
+ diff_currency_p = inv.currency_id.id <> company_currency
+
move = {
- 'name' : name,
- 'journal_id': journal.id,
- 'type' : inv.type,
- 'narration' : inv.narration and inv.narration or inv.name,
+ 'name':name,
+ 'journal_id':journal.id,
+ 'type':inv.type,
+ 'narration':inv.narration and inv.narration or inv.name,
'date':inv.date,
- 'ref':inv.reference
+ 'ref':ref
}
if inv.period_id:
@@ -301,7 +307,7 @@ class account_voucher(osv.osv):
'journal_id': inv.journal_id.id,
'period_id': inv.period_id.id,
'partner_id': False,
- 'ref': inv.reference,
+ 'ref':ref,
'date': inv.date
}
if diff_currency_p:
@@ -321,18 +327,22 @@ class account_voucher(osv.osv):
line_ids += [move_line_pool.create(cr, uid, move_line)]
for line in inv.payment_ids:
amount=0.0
+
+ if inv.type in ('bank_pay_voucher', 'pay_voucher', 'journal_voucher'):
+ ref = line.ref
+
move_line = {
- 'name': line.name,
- 'debit': False,
- 'credit': False,
- 'account_id': line.account_id.id or False,
- 'move_id': move_id ,
- 'journal_id': inv.journal_id.id,
- 'period_id': inv.period_id.id,
- 'partner_id': line.partner_id.id or False,
- 'ref': line.ref,
- 'date': inv.date,
- 'analytic_account_id': False
+ 'name':line.name,
+ 'debit':False,
+ 'credit':False,
+ 'account_id':line.account_id.id or False,
+ 'move_id':move_id ,
+ 'journal_id':inv.journal_id.id,
+ 'period_id':inv.period_id.id,
+ 'partner_id':line.partner_id.id or False,
+ 'ref':ref,
+ 'date':inv.date,
+ 'analytic_account_id':False
}
if diff_currency_p:
@@ -400,9 +410,9 @@ class account_voucher(osv.osv):
context={}
ids = []
if name:
- ids = self.search(cr, user, [('number','=',name)]+ args, limit=limit, context=context)
+ ids = self.search(cr, user, [('number','=',name)]+args, limit=limit, context=context)
if not ids:
- ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
+ ids = self.search(cr, user, [('name',operator,name)]+args, limit=limit, context=context)
return self.name_get(cr, user, ids, context)
def copy(self, cr, uid, id, default=None, context=None):
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index 2677f7be5d6..f97b41a1caf 100644
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -6,7 +6,7 @@
account.voucher
tree
-
+
@@ -34,7 +34,7 @@
-
+
@@ -55,7 +55,6 @@
-
@@ -88,11 +87,13 @@
-
+
+
-
-
+
+
+
@@ -106,7 +107,6 @@
-
@@ -120,15 +120,25 @@
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account_voucher_payment/account_voucher_payment.py b/addons/account_voucher_payment/account_voucher_payment.py
index 38c8bf93f4a..3d860146520 100755
--- a/addons/account_voucher_payment/account_voucher_payment.py
+++ b/addons/account_voucher_payment/account_voucher_payment.py
@@ -22,7 +22,6 @@
from osv import fields, osv
from tools.translate import _
-
class account_move_line(osv.osv):
_inherit = "account.move.line"
_columns = {
@@ -45,26 +44,33 @@ class account_voucher(osv.osv):
analytic_pool = self.pool.get('account.analytic.line')
currency_pool = self.pool.get('res.currency')
invoice_pool = self.pool.get('account.invoice')
+ invoice_pool = self.pool.get('account.invoice')
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
-
- company_currency = inv.company_id.currency_id.id
- diff_currency_p = inv.currency_id.id <> company_currency
journal = journal_pool.browse(cr, uid, inv.journal_id.id)
if journal.sequence_id:
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
+ ref = False
+ if inv.type in ('journal_pur_voucher', 'bank_rec_voucher', 'rec_voucher'):
+ ref = inv.reference
+ else:
+ ref = invoice_pool._convert_ref(cr, uid, name)
+
+ company_currency = inv.company_id.currency_id.id
+ diff_currency_p = inv.currency_id.id <> company_currency
+
move = {
'name' : name,
'journal_id': journal.id,
'type' : inv.type,
'narration' : inv.narration and inv.narration or inv.name,
'date':inv.date,
- 'ref':inv.reference
+ 'ref':ref
}
if inv.period_id:
@@ -76,16 +82,16 @@ class account_voucher(osv.osv):
#create the first line manually
move_line = {
- 'name': inv.name,
- 'debit': False,
+ 'name':inv.name,
+ 'debit':False,
'credit':False,
- 'account_id': inv.account_id.id or False,
- 'move_id': move_id ,
- 'journal_id': inv.journal_id.id,
- 'period_id': inv.period_id.id,
- 'partner_id': False,
- 'ref': inv.reference,
- 'date': inv.date
+ 'account_id':inv.account_id.id or False,
+ 'move_id':move_id ,
+ 'journal_id':inv.journal_id.id,
+ 'period_id':inv.period_id.id,
+ 'partner_id':False,
+ 'ref':ref,
+ 'date':inv.date
}
if diff_currency_p:
amount_currency = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
@@ -103,20 +109,25 @@ class account_voucher(osv.osv):
line_ids = []
line_ids += [move_line_pool.create(cr, uid, move_line)]
rec_ids = []
+
for line in inv.payment_ids:
amount=0.0
+
+ if inv.type in ('bank_pay_voucher', 'pay_voucher', 'journal_voucher'):
+ ref = line.ref
+
move_line = {
- 'name': line.name,
- 'debit': False,
- 'credit': False,
- 'account_id': line.account_id.id or False,
- 'move_id': move_id ,
- 'journal_id': inv.journal_id.id,
- 'period_id': inv.period_id.id,
- 'partner_id': line.partner_id.id or False,
- 'ref': line.ref,
- 'date': inv.date,
- 'analytic_account_id': False
+ 'name':line.name,
+ 'debit':False,
+ 'credit':False,
+ 'account_id':line.account_id.id or False,
+ 'move_id':move_id ,
+ 'journal_id':inv.journal_id.id,
+ 'period_id':inv.period_id.id,
+ 'partner_id':line.partner_id.id or False,
+ 'ref':ref,
+ 'date':inv.date,
+ 'analytic_account_id':False
}
if diff_currency_p:
@@ -151,9 +162,7 @@ class account_voucher(osv.osv):
rec_ids += [move_line_id]
for move_line in line.invoice_id.move_id.line_id:
if line.account_id.id == move_line.account_id.id:
- rec_ids += [move_line.id]
- #move_line_pool.reconcile_partial(cr, uid, rec_ids)
-
+ rec_ids += [move_line.id]
if rec_ids:
move_line_pool.reconcile_partial(cr, uid, rec_ids)