diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 187b803cf8b..1792177ed49 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -79,7 +79,7 @@ module named account_vouchers
'wizard/account_invoice_state_view.xml',
'wizard/account_partner_balance_report_view.xml',
'wizard/account_balance_report_view.xml',
- 'wizard/account_move_line_select_view.xml',
+# 'wizard/account_move_line_select_view.xml',
'wizard/account_aged_trial_balance_view.xml',
'wizard/account_compare_account_balance_report_view.xml',
'wizard/account_third_party_ledger.xml',
diff --git a/addons/account/account.py b/addons/account/account.py
index b01f659a70d..67abf8b4520 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -629,8 +629,8 @@ class account_journal(osv.osv):
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
'entry_posted': fields.boolean('Skip \'Draft\' State for Created Entries', help='Check this box if you don\'t want new account moves to pass through the \'draft\' state and instead goes directly to the \'posted state\' without any manual validation.'),
'company_id': fields.many2one('res.company', 'Company', required=True, select=1, help="Company related to this journal"),
- 'invoice_sequence_id': fields.many2one('ir.sequence', 'Invoice Sequence', \
- help="The sequence used for invoice numbers in this journal."),
+# 'invoice_sequence_id': fields.many2one('ir.sequence', 'Invoice Sequence', \
+# help="The sequence used for invoice numbers in this journal."),
'allow_date':fields.boolean('Check Date not in the Period', help= 'If set to True then do not accept the entry if the entry date is not into the period dates'),
}
@@ -695,13 +695,13 @@ class account_journal(osv.osv):
'sequence_id':seq_id
})
- if journal.type in journal_type and not journal.invoice_sequence_id:
- res_ids = date_pool.search(cr, uid, [('model','=','ir.sequence'), ('name','=',journal_seq.get(journal.type, 'sale'))])
- inv_seq_id = date_pool.browse(cr, uid, res_ids[0]).res_id
- inv_seq_id
- res.update({
- 'invoice_sequence_id':inv_seq_id
- })
+# if journal.type in journal_type and not journal.invoice_sequence_id:
+# res_ids = date_pool.search(cr, uid, [('model','=','ir.sequence'), ('name','=',journal_seq.get(journal.type, 'sale'))])
+# inv_seq_id = date_pool.browse(cr, uid, res_ids[0]).res_id
+# inv_seq_id
+# res.update({
+# 'invoice_sequence_id':inv_seq_id
+# })
result = self.write(cr, uid, [journal.id], res)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 192b4dc7ff2..9dfb5fe1e6a 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -400,7 +400,7 @@ class account_move_line(osv.osv):
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')),
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", states={'valid':[('readonly',True)]}, help="The move of this entry line.", select=2),
-
+ 'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Narration'),
'ref': fields.char('Ref.', size=64),
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2),
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 77267fb18cc..8ae66ba34b7 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -395,15 +395,14 @@
-
-
-
-
-
+
+
+
+
@@ -977,7 +976,8 @@
-
+
+
@@ -1055,22 +1055,27 @@
-
-
+
-
+
+
+
+
-
+
+
+
+
@@ -1096,6 +1101,23 @@
+
+ Journal Items
+ account.move.line
+ form
+ tree,form
+
+
+ [('account_id', 'child_of', active_id)]
+
+
+
+ tree_but_open
+ account.account
+ Open Journal Items
+
+
+
@@ -1152,28 +1174,75 @@
@@ -1217,11 +1286,13 @@
-
+
-
-
-
+
+
+
+
+
@@ -1828,7 +1899,7 @@
form
tree,form
- [('tax_code_id','=',active_id),('state','<>','draft')]
+ [('tax_code_id','child_of',active_id),('state','<>','draft')]
tree_but_open
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 03e4b844b36..ef056e454a9 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -219,7 +219,7 @@ class account_invoice(osv.osv):
_name = "account.invoice"
_description = 'Invoice'
- _order = "number"
+ _order = "id"
_columns = {
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
@@ -231,7 +231,8 @@ class account_invoice(osv.osv):
('in_refund','Supplier Refund'),
],'Type', readonly=True, select=True, change_default=True),
- 'number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."),
+ 'number': fields.related('move_id','name', type='char', readonly=True, size=64, relation='account.move', store=True, string='Number'),
+ #'number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."),
'reference': fields.char('Invoice Reference', size=64, help="The partner reference of this invoice."),
'reference_type': fields.selection(_get_reference_type, 'Reference Type',
required=True, readonly=True, states={'draft':[('readonly',False)]}),
@@ -768,8 +769,8 @@ class account_invoice(osv.osv):
cur_obj = self.pool.get('res.currency')
context = {}
for inv in self.browse(cr, uid, ids):
- if not inv.journal_id.invoice_sequence_id:
- raise osv.except_osv(_('Error !'), _('Please define invoice sequence on invoice journal'))
+ if not inv.journal_id.sequence_id:
+ raise osv.except_osv(_('Error !'), _('Please define sequence on invoice journal'))
if not inv.invoice_line:
raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.'))
if inv.move_id:
@@ -875,7 +876,14 @@ 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, 'type': entry_type}
+ move = {
+ 'ref': inv.number,
+ 'line_id': line,
+ 'journal_id': journal_id,
+ 'date': date,
+ 'type': entry_type,
+ 'narration':inv.comment
+ }
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'))])
@@ -919,44 +927,32 @@ class account_invoice(osv.osv):
}
def action_number(self, cr, uid, ids, *args):
+ #TODO: not correct fix but required a frech values before reading it.
+ self.write(cr, uid, ids, {})
+
for obj_inv in self.browse(cr, uid, ids):
id = obj_inv.id
invtype = obj_inv.type
number = obj_inv.number
move_id = obj_inv.move_id and obj_inv.move_id.id or False
reference = obj_inv.reference or ''
- if not number:
- tmp_context = {
- 'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id
- }
- if obj_inv.journal_id.invoice_sequence_id:
- sequence_id = obj_inv.journal_id.invoice_sequence_id.id
- number = self.pool.get('ir.sequence').get_id(cr, uid,
- sequence_id,
- 'id',
- context=tmp_context)
- else:
- number = self.pool.get('ir.sequence').get_id(cr, uid,
- 'account.invoice.%s' % invtype,
- 'code',
- context=tmp_context)
- if invtype in ('in_invoice', 'in_refund'):
- ref = reference
- else:
- ref = self._convert_ref(cr, uid, number)
- cr.execute('UPDATE account_invoice SET number=%s ' \
- 'WHERE id=%s', (number, id))
- cr.execute('UPDATE account_move SET ref=%s ' \
- 'WHERE id=%s AND (ref is null OR ref = \'\')',
+
+ if invtype in ('in_invoice', 'in_refund'):
+ ref = reference
+ else:
+ ref = self._convert_ref(cr, uid, number)
+
+ cr.execute('UPDATE account_move SET ref=%s ' \
+ 'WHERE id=%s AND (ref is null OR ref = \'\')',
+ (ref, move_id))
+ cr.execute('UPDATE account_move_line SET ref=%s ' \
+ 'WHERE move_id=%s AND (ref is null OR ref = \'\')',
+ (ref, move_id))
+ cr.execute('UPDATE account_analytic_line SET ref=%s ' \
+ 'FROM account_move_line ' \
+ 'WHERE account_move_line.move_id = %s ' \
+ 'AND account_analytic_line.move_id = account_move_line.id',
(ref, move_id))
- cr.execute('UPDATE account_move_line SET ref=%s ' \
- 'WHERE move_id=%s AND (ref is null OR ref = \'\')',
- (ref, move_id))
- cr.execute('UPDATE account_analytic_line SET ref=%s ' \
- 'FROM account_move_line ' \
- 'WHERE account_move_line.move_id = %s ' \
- 'AND account_analytic_line.move_id = account_move_line.id',
- (ref, move_id))
for inv_id, name in self.name_get(cr, uid, [id]):
message = _('Invoice ') + " '" + name + "' "+ _("is validated.")
self.log(cr, uid, inv_id, message)
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index 1dea8e8d4f3..3f6bd126251 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -45,7 +45,9 @@ import account_open_closed_fiscalyear
import account_compare_account_balance_report
import account_invoice_state
import account_chart
-import account_move_line_select
+#TODO: remove this file no moe used
+# also remove related view fiel
+#import account_move_line_select
import account_validate_account_move
import account_use_model
diff --git a/addons/account/wizard/account_move_line_select_view.xml b/addons/account/wizard/account_move_line_select_view.xml
index bf3831baea0..8c462318271 100644
--- a/addons/account/wizard/account_move_line_select_view.xml
+++ b/addons/account/wizard/account_move_line_select_view.xml
@@ -7,12 +7,12 @@
account.move.line.select
form
-
@@ -27,13 +27,13 @@
new
-
- tree_but_open
- account.account
- Open Account
-
-
-
+
+
+
+
+
+
+