diff --git a/addons/account/account.py b/addons/account/account.py index 90d7e2c0d95..6512a9c1c1a 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -282,7 +282,9 @@ class account_account(osv.osv): required=True), 'check_history': fields.boolean('Display History', help="Check this box if you want to print all entries when printing the General Ledger, "\ - "otherwise it will only print its balance.") + "otherwise it will only print its balance."), + 'merge_invoice': fields.boolean('Merge Invoice Entries',help="Check this box if you want that all lines of "\ + "a customer or supplier invoice using this account are created in one line only"), } def _default_company(self, cr, uid, context={}): @@ -646,7 +648,7 @@ class account_move(osv.osv): data_move = self.pool.get('account.move').browse(cursor,user,ids) for move in data_move: if move.state=='draft': - name = '*' + move.name + name = '*' + str(move.id) else: name = move.name res.append((move.id, name)) @@ -669,7 +671,7 @@ class account_move(osv.osv): return result _columns = { - 'name': fields.char('Entry Name', size=64, required=True), + 'name': fields.char('Entry Number', size=64, required=True), 'ref': fields.char('Ref', size=64), 'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}), @@ -678,10 +680,22 @@ class account_move(osv.osv): 'to_check': fields.boolean('To Be Verified'), 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True), 'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2), store=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'), + ],'Type', readonly=True, select=True, states={'draft':[('readonly',False)]}), } _defaults = { + 'name': lambda *a: '/', 'state': lambda *a: 'draft', 'period_id': _get_period, + 'type' : lambda *a : 'journal_voucher', } def _check_centralisation(self, cursor, user, ids): @@ -714,6 +728,17 @@ class account_move(osv.osv): ] def post(self, cr, uid, ids, context=None): if self.validate(cr, uid, ids, context) and len(ids): + for move in self.browse(cr, uid, ids): + if move.name =='/': + new_name = False + journal = move.journal_id + if journal.sequence_id: + new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id) + else: + raise osv.except_osv(_('Error'), _('No sequence defined in the journal !')) + if new_name: + self.write(cr, uid, [move.id], {'name':new_name}) + cr.execute('update account_move set state=%s where id in ('+','.join(map(str,ids))+')', ('posted',)) else: raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non balanced entry !')) @@ -759,12 +784,6 @@ class account_move(osv.osv): l[2]['period_id'] = default_period context['period_id'] = default_period - if not 'name' in vals: - journal = self.pool.get('account.journal').browse(cr, uid, context.get('journal_id', vals.get('journal_id', False))) - if journal.sequence_id: - vals['name'] = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id) - else: - raise osv.except_osv(_('Error'), _('No sequence defined in the journal !')) accnt_journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id']) if 'line_id' in vals: c = context.copy() @@ -775,6 +794,13 @@ 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':'/',}) + return super(account_move, self).copy(cr, uid, id, default, context) + def unlink(self, cr, uid, ids, context={}, check=True): toremove = [] for move in self.browse(cr, uid, ids, context): diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 64b19713e5b..2b0a8aee54d 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -176,7 +176,7 @@ class account_move_line(osv.osv): if s>0: acc = acc1 v = self.pool.get('res.currency').compute(cr, uid, - account.company_id.currency_id.id, + account.company_id.currency_id.id, data['currency_id'], s, account=acc, account_invert=True) data['amount_currency'] = v @@ -277,7 +277,7 @@ class account_move_line(osv.osv): _columns = { 'name': fields.char('Name', size=64, required=True), - 'quantity': fields.float('Quantity', digits=(16,2), help="The optionnal quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very usefull for some reports."), + 'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very usefull for some reports."), 'debit': fields.float('Debit', digits=(16,2)), 'credit': fields.float('Credit', digits=(16,2)), 'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2), diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 4e51b8c99b9..5eb03163c51 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -130,6 +130,7 @@ + @@ -796,7 +797,8 @@ - + + @@ -811,13 +813,12 @@
- + - - + @@ -853,8 +854,8 @@ - - + + @@ -988,17 +989,17 @@ diff --git a/addons/account/data/account_data2.xml b/addons/account/data/account_data2.xml index 7fcd61cb62d..ba606287d6a 100644 --- a/addons/account/data/account_data2.xml +++ b/addons/account/data/account_data2.xml @@ -286,6 +286,16 @@ account.journal + + Sale Journal + account.journal + + + + Purchase Journal + account.journal + + - + --> + @@ -16,7 +16,7 @@ - + @@ -27,9 +27,9 @@ - + - + @@ -38,11 +38,11 @@ - - - + @@ -51,7 +51,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -69,7 +69,7 @@ - + - + diff --git a/addons/l10n_fr/wizard/fpdftemp.fdf b/addons/l10n_fr/wizard/fpdftemp.fdf index 140a9e5f69c..649917fce87 100755 Binary files a/addons/l10n_fr/wizard/fpdftemp.fdf and b/addons/l10n_fr/wizard/fpdftemp.fdf differ diff --git a/addons/l10n_lu/wizard/print_vat.py b/addons/l10n_lu/wizard/print_vat.py index 0a9e09a3215..2d0832667de 100644 --- a/addons/l10n_lu/wizard/print_vat.py +++ b/addons/l10n_lu/wizard/print_vat.py @@ -12,7 +12,7 @@ import pooler import sys from mx.DateTime import * import tools -from report.render import render +from report.render import render from report.interface import report_int import os import pdf_ext @@ -49,7 +49,6 @@ class external_pdf(render): class report_custom(report_int): def create(self, cr, uid, ids, datas, context={}): - print datas, ids, uid pool = pooler.get_pool(cr.dbname) @@ -70,7 +69,7 @@ class report_custom(report_int): result['info_address'] = partner.address[0].street result['info_address2'] = str(partner.address[0].zip) + ' ' + str(partner.address[0].city) - pdf_ext.fill_pdf('addons/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result) + pdf_ext.fill_pdf(tools.config['addons_path']+'/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result) self.obj = external_pdf(file('/tmp/output.pdf').read()) self.obj.render() return (self.obj.pdf, 'pdf') diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 6518fb6783b..906ac653b3e 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -410,6 +410,15 @@ class mrp_production(osv.osv): 'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/', } _order = 'date_planned asc, priority desc'; + def unlink(self, cr, uid, ids): + productions = self.read(cr, uid, ids, ['state']) + unlink_ids = [] + for s in productions: + if s['state'] in ['draft','cancel']: + unlink_ids.append(s['id']) + else: + raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!' % s['state'])) + return osv.osv.unlink(self, cr, uid, unlink_ids) def location_id_change(self, cr, uid, ids, src, dest, context={}): if dest: @@ -466,7 +475,7 @@ class mrp_production(osv.osv): if production.move_created_ids: self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in production.move_created_ids]) self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in production.move_lines]) - self.write(cr, uid, ids, {'state':'cancel','move_lines':[(6,0,[])]}) + self.write(cr, uid, ids, {'state':'cancel'}) #,'move_lines':[(6,0,[])]}) return True #XXX: may be a bug here; lot_lines are unreserved for a few seconds; @@ -771,6 +780,17 @@ class mrp_procurement(osv.osv): 'close_move': lambda *a: 0, 'procure_method': lambda *a: 'make_to_order', } + + def unlink(self, cr, uid, ids): + procurements = self.read(cr, uid, ids, ['state']) + unlink_ids = [] + for s in procurements: + if s['state'] in ['draft','cancel']: + unlink_ids.append(s['id']) + else: + raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state'])) + return osv.osv.unlink(self, cr, uid, unlink_ids) + def onchange_product_id(self, cr, uid, ids, product_id, context={}): if product_id: w=self.pool.get('product.product').browse(cr,uid,product_id, context) @@ -1034,10 +1054,10 @@ class mrp_procurement(osv.osv): def action_cancel(self, cr, uid, ids): todo = [] for proc in self.browse(cr, uid, ids): - if proc.move_id: + if proc.move_id and proc.move_id.state=='waiting': todo.append(proc.move_id.id) if len(todo): - self.pool.get('stock.move').action_cancel(cr, uid, [proc.move_id.id]) + self.pool.get('stock.move').write(cr, uid, todo, {'state':'assigned'}) self.write(cr, uid, ids, {'state':'cancel'}) wf_service = netsvc.LocalService("workflow") @@ -1211,7 +1231,7 @@ class StockPicking(osv.osv): # Explode picking by replacing phantom BoMs # def action_explode(self, cr, uid, picks, *args): - for move in picks: + for move in self.pool.get('stock.move').browse(cr, uid, picks): self.pool.get('stock.move')._action_explode(cr, uid, move) return picks diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 77edb606ab1..6223c00aaa5 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -421,9 +421,11 @@ + +