diff --git a/addons/account/account.py b/addons/account/account.py index 61851b30f1f..1817d50901e 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1078,24 +1078,13 @@ class account_move(osv.osv): 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"), 'amount': fields.function(_amount_compute, method=True, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount), 'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}), - 'type': fields.selection([ - ('pay_voucher','Cash Payment'), - ('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'), - ],'Entry Type', select=True , size=128, readonly=True, states={'draft':[('readonly',False)]}), - 'narration':fields.text('Narration', readonly=True, select=True, states={'draft':[('readonly',False)]}), + 'narration':fields.text('Narration', select=True), 'company_id': fields.related('journal_id','company_id',type='many2one',relation='res.company',string='Company',store=True), } _defaults = { 'name': lambda *a: '/', 'state': lambda *a: 'draft', 'period_id': _get_period, - 'type' : lambda *a : 'journal_voucher', 'date': lambda *a:time.strftime('%Y-%m-%d'), 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } @@ -1174,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'] @@ -1201,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): diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index ddd2cc2dabe..ae41562e124 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -424,7 +424,7 @@ [('type','=','out_invoice')] {'type':'out_invoice'} - Most of customer invoices are automatically generate in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund yours customers invoices here. A manual invoice can be created here. + Most of customer invoices are automatically generated in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund your customers' invoices here. A manual invoice can be created here. diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 76989d2f02c..40f3f113306 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -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 @@ -926,6 +926,7 @@ class account_move_line(osv.osv): def _check_date(self, cr, uid, vals, context=None, check=True): if context is None: context = {} + journal_id = False if 'date' in vals.keys(): if 'journal_id' in vals and 'journal_id' not in context: journal_id = vals['journal_id'] @@ -1110,10 +1111,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 +1187,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() diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index be650a4613f..1fd373a1bdc 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -670,7 +670,7 @@ - + @@ -906,43 +906,69 @@
- + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - @@ -952,7 +978,6 @@ - account.move.line.form2 account.move.line @@ -1000,6 +1025,19 @@ + + account.move.line.graph + account.move.line + graph + + + + + + + + + Entry Lines account.move.line @@ -1053,6 +1091,17 @@ Account.Entry Edition --> + + account.move.graph + account.move + graph + + + + + + + account.move.tree account.move @@ -1064,11 +1113,10 @@ - - +