From e82cf76be73d03cb0b3e1b4f2131ebc30f39f107 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 26 Dec 2008 12:20:18 +0530 Subject: [PATCH 1/9] Bugfix:name_get on pricelist bzr revid: jvo@tinyerp.com-20081226065018-8249xplpekt34oz1 --- addons/product/pricelist.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index bd612c246e8..01749be89cb 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -91,11 +91,15 @@ class product_pricelist(osv.osv): 'version_id': fields.one2many('product.pricelist.version', 'pricelist_id', 'Pricelist Versions'), 'currency_id': fields.many2one('res.currency', 'Currency', required=True), } + def name_get(self, cr, uid, ids, context={}): - result= {} + result= [] + for pl in self.browse(cr, uid, ids, context): - result[pl.id] = pl.name + ' ('+ pl.currency_id.name + ')' + name = str(pl.name) + ' ('+ str(pl.currency_id.name) + ')' + result.append((pl.id,name)) return result + def _get_currency(self, cr, uid, ctx): comp = self.pool.get('res.users').browse(cr,uid,uid).company_id From 77a450b627109f0e7f90060ca72a9b8a7a27bf64 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 26 Dec 2008 13:22:00 +0530 Subject: [PATCH 2/9] fixed bug : when all stock move lines are cancelled, picking should be cancel bzr revid: hmo@tinyerp.com-20081226075200-kjj1lrq2kk5znh7w --- addons/stock/stock.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index e74165e8c15..c98a15e39ab 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1062,20 +1062,22 @@ class stock_move(osv.osv): if move.state in ('confirmed','waiting','assigned','draft'): if move.picking_id: pickings[move.picking_id.id] = True - if move.move_dest_id and move.move_dest_id.state=='waiting': - self.write(cr, uid, [move.move_dest_id.id], {'state':'assigned'}) - if move.move_dest_id.picking_id: - wf_service = netsvc.LocalService("workflow") - wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) + if move.move_dest_id and move.move_dest_id.state=='waiting': + self.write(cr, uid, [move.move_dest_id.id], {'state':'assigned'}) + if move.move_dest_id.picking_id: + wf_service = netsvc.LocalService("workflow") + wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) self.write(cr, uid, ids, {'state':'cancel', 'move_dest_id': False}) - #for pick_id in pickings: - # wf_service = netsvc.LocalService("workflow") - # wf_service.trg_validate(uid, 'stock.picking', pick_id, 'button_cancel', cr) - #ids2 = [] - #for res in self.read(cr, uid, ids, ['move_dest_id']): - # if res['move_dest_id']: - # ids2.append(res['move_dest_id'][0]) + for pick in self.pool.get('stock.picking').browse(cr,uid,pickings.keys()): + cancel=False + for move in pick.move_lines: + if move.state=='cancel': + cancel=True + if move.state!='cancel': + cancel=False + if cancel: + self.pool.get('stock.picking').write(cr,uid,[pick.id],{'state':'cancel'}) wf_service = netsvc.LocalService("workflow") for id in ids: From 31b55eea5fec95017d22ada0de835cebd1430e03 Mon Sep 17 00:00:00 2001 From: "hda (Tiny)" Date: Fri, 26 Dec 2008 14:57:04 +0530 Subject: [PATCH 3/9] added descriptions bzr revid: hda@tinyerp.com-20081226092704-prg7uohqufv0i1ri --- addons/auction/__terp__.py | 6 ++++++ addons/l10n_chart_uk_minimal/__terp__.py | 1 + addons/profile_accounting/__terp__.py | 1 + addons/profile_association/__terp__.py | 1 + addons/profile_auction/__terp__.py | 1 + addons/profile_crm/__terp__.py | 1 + addons/profile_manufacturing/__terp__.py | 1 + addons/profile_service/__terp__.py | 1 + addons/purchase/__terp__.py | 1 + addons/report_purchase/__terp__.py | 4 +++- addons/report_timesheet/__terp__.py | 2 ++ addons/stock/__terp__.py | 4 ++++ addons/subscription/__terp__.py | 1 + 13 files changed, 24 insertions(+), 1 deletion(-) diff --git a/addons/auction/__terp__.py b/addons/auction/__terp__.py index 24516e3fea7..3f70590d346 100644 --- a/addons/auction/__terp__.py +++ b/addons/auction/__terp__.py @@ -22,8 +22,14 @@ { "name" : "Auction module", "version" : "1.0", + "author" : "Tiny", "category" : "Generic Modules/Auction", "depends" : ["base","account","hr_attendance"], + "description": '''This module provides functionality to + manage artists, articles, sellers, buyers and auction. + Manage bids, track of sold, paid and unpaid objects. + Delivery Management. + ''', "update_xml" : [ # FIXME: review security rules... "security/ir.model.access.csv", diff --git a/addons/l10n_chart_uk_minimal/__terp__.py b/addons/l10n_chart_uk_minimal/__terp__.py index 94da21b59ac..516061768bf 100644 --- a/addons/l10n_chart_uk_minimal/__terp__.py +++ b/addons/l10n_chart_uk_minimal/__terp__.py @@ -63,6 +63,7 @@ "author" : "Seath Solutions Ltd", "website": "http://www.seathsolutions.com", "category" : "Localisation/Account Charts", + "description": "This is the base module to manage the accounting chart for United Kingdom in Open ERP.", "depends" : ["base", "account", "base_iban", "base_vat", "account_chart"], "init_xml" : [], "demo_xml" : [], diff --git a/addons/profile_accounting/__terp__.py b/addons/profile_accounting/__terp__.py index bf4b8795721..c96abadf26d 100644 --- a/addons/profile_accounting/__terp__.py +++ b/addons/profile_accounting/__terp__.py @@ -24,6 +24,7 @@ "version":"1.0", "author":"Tiny", "category":"Profile", + "description": "Profile for Accounting", "depends":["account","report_analytic","board_account","account_followup"], "demo_xml":[], "update_xml":[ diff --git a/addons/profile_association/__terp__.py b/addons/profile_association/__terp__.py index 879bbb9e3f3..ca50e11f0ff 100644 --- a/addons/profile_association/__terp__.py +++ b/addons/profile_association/__terp__.py @@ -24,6 +24,7 @@ "version":"0.1", "author":"Tiny", "category":"Profile", + "description": "Profile for Associates", "depends":["membership", "board_association"], "demo_xml":[], "update_xml":[ diff --git a/addons/profile_auction/__terp__.py b/addons/profile_auction/__terp__.py index 3190930f14d..681a183ea9c 100644 --- a/addons/profile_auction/__terp__.py +++ b/addons/profile_auction/__terp__.py @@ -24,6 +24,7 @@ "version":"1.0", "author":"Tiny", "category":"Profile", + "description": "Profile for Auction house", "depends":["auction", "board_auction","account","hr_timesheet_sheet"], "demo_xml":[], "update_xml":[], diff --git a/addons/profile_crm/__terp__.py b/addons/profile_crm/__terp__.py index 6c1ddda28bd..e66a8dddd4e 100644 --- a/addons/profile_crm/__terp__.py +++ b/addons/profile_crm/__terp__.py @@ -24,6 +24,7 @@ "version":"1.0", "author":"Tiny", "category":"Profile", + "description": "Profile for CRM", "depends":[ "crm_vertical", "board_crm_configuration", ], diff --git a/addons/profile_manufacturing/__terp__.py b/addons/profile_manufacturing/__terp__.py index 6b90856f6d5..8527539cae5 100644 --- a/addons/profile_manufacturing/__terp__.py +++ b/addons/profile_manufacturing/__terp__.py @@ -24,6 +24,7 @@ "version":"1.0", "author":"Tiny", "category":"Profile", + "description": "Profile for manufacturing industries", "depends":["mrp", "sale", "delivery","board_manufacturing","product_margin"], "demo_xml":[], "update_xml":[ diff --git a/addons/profile_service/__terp__.py b/addons/profile_service/__terp__.py index 26ccbca8fdb..ce20d5b34cd 100644 --- a/addons/profile_service/__terp__.py +++ b/addons/profile_service/__terp__.py @@ -24,6 +24,7 @@ "version":"1.0", "author":"Tiny", "category":"Profile", + "description": "Profile for service companies", "depends":[ "hr", "project", diff --git a/addons/purchase/__terp__.py b/addons/purchase/__terp__.py index 7900d753dbd..780a37c3af0 100644 --- a/addons/purchase/__terp__.py +++ b/addons/purchase/__terp__.py @@ -26,6 +26,7 @@ "website" : "http://www.openerp.com", "depends" : ["base", "account", "stock", "process"], "category" : "Generic Modules/Sales & Purchases", + "description": "Module for purchase management", "init_xml" : [], "demo_xml" : ["purchase_demo.xml", #"purchase_unit_test.xml" diff --git a/addons/report_purchase/__terp__.py b/addons/report_purchase/__terp__.py index c74a09ca3e8..70902eed4bc 100644 --- a/addons/report_purchase/__terp__.py +++ b/addons/report_purchase/__terp__.py @@ -20,12 +20,14 @@ # ############################################################################## { - "name" : "Sales Management - Reporting", + "name" : "Purchase Management - Reporting", "version" : "1.0", "author" : "Tiny", "website" : "http://www.openerp.com", "depends" : ["purchase"], "category" : "Generic Modules/Sales & Purchases", + "description": '''Module to add views like + Purchase By Product, Purchase By Category of Product, All Months, Current Month.''', "init_xml" : [], "demo_xml" : [], "update_xml" : [ diff --git a/addons/report_timesheet/__terp__.py b/addons/report_timesheet/__terp__.py index 73792922a70..110ce5ca8c7 100644 --- a/addons/report_timesheet/__terp__.py +++ b/addons/report_timesheet/__terp__.py @@ -24,6 +24,8 @@ "version" : "1.0", "author" : "Tiny", "website" : "http://www.openerp.com", + "description": '''Module to add timesheet views like + All Month, Timesheet By User, Timesheet Of Month, Timesheet By Account''', "depends" : ["hr_timesheet",'hr_timesheet_invoice'], "category" : "Generic Modules/Human Resources", "init_xml" : [], diff --git a/addons/stock/__terp__.py b/addons/stock/__terp__.py index 1d012329503..439b32f6b66 100644 --- a/addons/stock/__terp__.py +++ b/addons/stock/__terp__.py @@ -26,6 +26,10 @@ "website" : "http://www.openerp.com", "depends" : ["product", "account"], "category" : "Generic Modules/Inventory Control", + "description": '''Module provides Inventory Management, define warehouse, stock location, Pickings, + Incoming products, Outgoing products, Internal movements of product, Traceability. + Reports for stock like lots by location, Stock Forecast, Item Labels, Picking List etc.. + ''', "init_xml" : [], "demo_xml" : ["stock_demo.xml"], "update_xml" : [ diff --git a/addons/subscription/__terp__.py b/addons/subscription/__terp__.py index da3ae32a7ea..8d4fb042cb7 100644 --- a/addons/subscription/__terp__.py +++ b/addons/subscription/__terp__.py @@ -24,6 +24,7 @@ "version" : "1.0", "author" : "Tiny", "category" : "Generic Modules/Others", + "description": '''Module allows to create new documents and add subscription on that document.''', "depends" : ["base"], "init_xml" : [], "demo_xml" : [], From ab5453cb91eb107715b58fa5527d5651f0568144 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 26 Dec 2008 15:33:30 +0530 Subject: [PATCH 4/9] improve account_invoice_layout module bzr revid: hmo@tinyerp.com-20081226100330-1h4k14j7lym3msu7 --- .../account_invoice_layout/account_invoice_layout_report.xml | 4 ++-- .../account_invoice_layout/report/special_message_invoice.py | 2 +- .../report/special_message_invoice.rml | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/account_invoice_layout/account_invoice_layout_report.xml b/addons/account_invoice_layout/account_invoice_layout_report.xml index 034e869d912..2579609bfbf 100644 --- a/addons/account_invoice_layout/account_invoice_layout_report.xml +++ b/addons/account_invoice_layout/account_invoice_layout_report.xml @@ -1,7 +1,7 @@ - [[ format((o.payment_term and o.payment_term.note) or '') ]] +
[[ repeatIn((spcl_msg(data['form']) and spcl_msg(data['form']).splitlines()) or [], 'note') ]] -[[ note or removeParentNode('table') ]] - +[[ note or removeParentNode('para') ]] +
From 0bc6a1dbaf93b961677e863cefb2fe7bdf89f9f3 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 26 Dec 2008 11:23:47 +0100 Subject: [PATCH 5/9] [FIX] stock picking must be canceled if all picking move lines are cancle bzr revid: christophe@taupe-20081226102347-sbabtnkbr6j3mvlf --- addons/stock/stock.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c98a15e39ab..55421013ca4 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1070,13 +1070,7 @@ class stock_move(osv.osv): self.write(cr, uid, ids, {'state':'cancel', 'move_dest_id': False}) for pick in self.pool.get('stock.picking').browse(cr,uid,pickings.keys()): - cancel=False - for move in pick.move_lines: - if move.state=='cancel': - cancel=True - if move.state!='cancel': - cancel=False - if cancel: + if all(move.state == 'cancle' for move in pick.move_lines): self.pool.get('stock.picking').write(cr,uid,[pick.id],{'state':'cancel'}) wf_service = netsvc.LocalService("workflow") From 5c0aaf07e04999a451faaf7e59bd8d950ab59398 Mon Sep 17 00:00:00 2001 From: "Sofia (Open ERP)" Date: Fri, 26 Dec 2008 17:21:41 +0530 Subject: [PATCH 6/9] security rules added for objects bzr revid: sso@tinyerp.com-20081226115141-a3ar7e7agyvboawc --- addons/account_voucher/__terp__.py | 1 + addons/account_voucher/security/ir.model.access.csv | 6 ++++++ addons/mrp_subproduct/__terp__.py | 1 + addons/mrp_subproduct/security/ir.model.access.csv | 3 +++ addons/wiki/security/ir.model.access.csv | 2 ++ 5 files changed, 13 insertions(+) create mode 100644 addons/account_voucher/security/ir.model.access.csv create mode 100644 addons/mrp_subproduct/security/ir.model.access.csv diff --git a/addons/account_voucher/__terp__.py b/addons/account_voucher/__terp__.py index 867711e5fe4..dacd296cb85 100755 --- a/addons/account_voucher/__terp__.py +++ b/addons/account_voucher/__terp__.py @@ -43,6 +43,7 @@ Basic Accounting, plus new things which available are: ], "update_xml" : [ + "security/ir.model.access.csv", "account_voucher_sequence.xml", "account_view.xml", "account_report.xml", diff --git a/addons/account_voucher/security/ir.model.access.csv b/addons/account_voucher/security/ir.model.access.csv new file mode 100644 index 00000000000..b4203be5416 --- /dev/null +++ b/addons/account_voucher/security/ir.model.access.csv @@ -0,0 +1,6 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_account_voucher_user","account.voucher","model_account_voucher","account.group_account_user",1,0,0,0 +"access_account_voucher_line_user","account.voucher.line","model_account_voucher_line","account.group_account_user",1,0,0,0 +"access_account_voucher_manager","account.voucher","model_account_voucher","account.group_account_manager",1,1,1,1 +"access_account_voucher_line_manager","account.voucher.line","model_account_voucher_line","account.group_account_manager",1,1,1,1 + diff --git a/addons/mrp_subproduct/__terp__.py b/addons/mrp_subproduct/__terp__.py index 14b0152d532..b24501839bd 100644 --- a/addons/mrp_subproduct/__terp__.py +++ b/addons/mrp_subproduct/__terp__.py @@ -37,6 +37,7 @@ With this module: """, "demo_xml" : [], "update_xml" : [ + "security/ir.model.access.csv", "mrp_subproduct_view.xml", ], "active": False, diff --git a/addons/mrp_subproduct/security/ir.model.access.csv b/addons/mrp_subproduct/security/ir.model.access.csv new file mode 100644 index 00000000000..3c6547410d4 --- /dev/null +++ b/addons/mrp_subproduct/security/ir.model.access.csv @@ -0,0 +1,3 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_mrp_subproduct_user","mrp.subproduct","model_mrp_subproduct","mrp.group_mrp_user",1,0,0,0 +"access_mrp_subproduct_manager","mrp.subproduct","model_mrp_subproduct","mrp.group_mrp_manager",1,1,1,1 diff --git a/addons/wiki/security/ir.model.access.csv b/addons/wiki/security/ir.model.access.csv index a54122e0231..acb871141ff 100644 --- a/addons/wiki/security/ir.model.access.csv +++ b/addons/wiki/security/ir.model.access.csv @@ -3,4 +3,6 @@ "wiki_groups_all","wiki.groups","model_wiki_groups",,1,0,0,0 "wiki_wiki","wiki.wiki","model_wiki_wiki","base.group_user",1,1,1,1 "wiki_groups","wiki.groups","model_wiki_groups","base.group_system",1,1,1,1 +"wiki_groups_link","wiki.groups.link","model_wiki_groups_link","base.group_system",1,1,1,1 "wiki_wiki_history","wiki.wiki.history","model_wiki_wiki_history","base.group_user",1,0,1,0 +"wiki_wizard_wiki_history_show_diff","wizard.wiki.history.show_diff","model_wizard_wiki_history_show_diff","base.group_user",1,1,1,1 From d67eab9c0738265a32d9a3a3c97bf483bec06581 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 26 Dec 2008 14:27:39 +0100 Subject: [PATCH 7/9] [FIX] encoding errors lp bug: https://launchpad.net/bugs/31159 fixed bzr revid: christophe@taupe-20081226132739-ty8u9qe32dcu4iyi --- addons/auction/report/huissier.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/addons/auction/report/huissier.py b/addons/auction/report/huissier.py index e01063ba9c0..9afe67834c1 100644 --- a/addons/auction/report/huissier.py +++ b/addons/auction/report/huissier.py @@ -25,9 +25,8 @@ from osv.osv import osv, orm from report.interface import report_rml #FIXME: use the one from tools and delete the one from report from report.int_to_text import int_to_text - -def toxml(val): - return val.replace('&', '&').replace('<','<').replace('>','>').decode('utf-8').encode('latin1', 'replace') +from tools import to_xml as toxml +from tools import ustr class report_custom(report_rml): def __init__(self, name, table, tmpl, xsl): @@ -38,7 +37,7 @@ class report_custom(report_rml): lots = pool.get('auction.lots').browse(cr, uid, ids) auction = lots[0].auction_id - xml = ''' + xml = ''' %s @@ -49,7 +48,7 @@ class report_custom(report_rml): for l in lots: # l['id_cont'] = str(i) if l['obj_price']==0: - price_french = 'retiré' + price_french = u'retiré' else: price_french = int_to_text(int(l['obj_price'] or 0.0))+' eur' i+=1 @@ -59,10 +58,9 @@ class report_custom(report_rml): %s %s %s - ''' % (i, l['obj_num'], toxml(l['name']), price_french, str(l['obj_price'] or '/')) + ''' % (i, l['obj_num'], ustr(toxml(l['name'])), ustr(price_french), ustr(l['obj_price'] or '/')) xml += '' -# file('/tmp/terp.xml','wb+').write(xml) return xml report_custom('report.flagey.huissier', 'auction.lots', '', 'addons/auction/report/huissier.xsl') From 6de8fb60593372dba23186207c2c7cc81fc3eb77 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 26 Dec 2008 17:34:58 +0100 Subject: [PATCH 8/9] [FIX] project_gtd: format exception correctly lp bug: https://launchpad.net/bugs/311548 fixed bzr revid: christophe@taupe-20081226163458-btibjzmn0wu9jx3o --- addons/project_gtd/wizard/project_gtd_daily.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_gtd/wizard/project_gtd_daily.py b/addons/project_gtd/wizard/project_gtd_daily.py index ad62ee39a4f..3a87f1bd3ed 100644 --- a/addons/project_gtd/wizard/project_gtd_daily.py +++ b/addons/project_gtd/wizard/project_gtd_daily.py @@ -33,7 +33,7 @@ class wiz_timebox_open(wizard.interface): pool = pooler.get_pool(cr.dbname) ids = pool.get('project.gtd.timebox').search(cr, uid, [('user_id','=',uid),('type','=',tbtype)]) if not len(ids): - raise wizard.except_wizard('Error !', 'No timebox of the type "%s" defined !') + raise wizard.except_wizard('Error !', 'No timebox of the type "%s" defined !' % (tbtype,)) view_type = 'form,tree' if len(ids) >= 1: domain = "[('id','in',["+','.join(map(str,ids))+"])]" From 16195435ed780fa945d17c8b3ecb65edbb34fec6 Mon Sep 17 00:00:00 2001 From: qdp Date: Fri, 26 Dec 2008 19:11:02 +0100 Subject: [PATCH 9/9] *added option on account_journal to group the account_move_line generated by an invoice if the columns tax_code_id, product_id, analityc_account_id and account_id are the same *bugfix: error when no analytic journal was defined on the account_journal and we tried to add an analytic account on an invoice line *improved translatability bzr revid: qdp@tinyerp.com-20081226181102-7daak46z0wyut9eu --- addons/account/account.py | 3 ++- addons/account/account_move_line.py | 2 ++ addons/account/account_view.xml | 2 ++ addons/account/invoice.py | 26 +++++++++++++++++++++++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 86d7ac16c68..f218e5b5bd7 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -451,8 +451,9 @@ class account_journal(osv.osv): 'view_id': fields.many2one('account.journal.view', 'View', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tell Open ERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."), 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account'), 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account'), - 'centralisation': fields.boolean('Centralised counterpart', help="Check this box if you want that each entry doesn't create a counterpart but share the same counterpart for each entry of this journal."), + 'centralisation': fields.boolean('Centralised counterpart', help="Check this box if you want that each entry doesn't create a counterpart but share the same counterpart for each entry of this journal. This is used in fiscal year closing."), 'update_posted': fields.boolean('Allow Cancelling Entries'), + 'group_invoice_lines': fields.boolean('Group invoice lines', help="If this box is cheked, the system will try to group the accouting lines when generating them from invoices."), 'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="The sequence gives the display order for a list of journals", required=True), 'user_id': fields.many2one('res.users', 'User', help="The responsible user of this journal"), 'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'), diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index f32d150906d..4dbc8819893 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -61,6 +61,8 @@ class account_move_line(osv.osv): def create_analytic_lines(self, cr, uid, ids, context={}): for obj_line in self.browse(cr, uid, ids, context): if obj_line.analytic_account_id: + if not obj_line.journal_id.analytic_journal_id: + raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name,)) amt = (obj_line.credit or 0.0) - (obj_line.debit or 0.0) vals_lines={ 'name': obj_line.name, diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 02ad8648b95..b471343863b 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -267,6 +267,8 @@ + + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 39e03c710ad..606b8b00f50 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -68,7 +68,7 @@ class account_invoice(osv.osv): tt = type2journal.get(type_inv, 'sale') result = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=',tt)], context=context) if not result: - raise osv.except_osv(_('No Analytic Journal !'),("You have to define an analytic journal of type '%s' !") % (tt,)) + raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal of type '%s' !") % (tt,)) return result[0] def _get_type(self, cr, uid, context={}): @@ -448,7 +448,7 @@ class account_invoice(osv.osv): ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') acc_obj = self.pool.get('account.account') - self.button_compute(cr, uid, ids, context={}, set_total=True) + self.button_compute(cr, uid, ids, context={}, set_total=False) for inv in self.browse(cr, uid, ids): if inv.move_id: continue @@ -598,14 +598,34 @@ class account_invoice(osv.osv): date = inv.date_invoice or time.strftime('%Y-%m-%d') part = inv.partner_id.id + line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})) ,iml) + if inv.journal_id.group_invoice_lines: + line2 = {} + for x, y, l in line: + tmp = str(l['account_id']) + tmp += '-'+str('tax_code_id' in l and l['tax_code_id'] or "False") + tmp += '-'+str('product_id' in l and l['product_id'] or "False") + tmp += '-'+str('analytic_account_id' in l and l['analytic_account_id'] or "False") + + if tmp in line2: + am = line2[tmp]['debit'] - line2[tmp]['credit'] + (l['debit'] - l['credit']) + line2[tmp]['debit'] = (am > 0) and am or 0.0 + line2[tmp]['credit'] = (am < 0) and -am or 0.0 + line2[tmp]['tax_amount'] += l['tax_amount'] + line2[tmp]['analytic_lines'] += l['analytic_lines'] + else: + line2[tmp] = l + line = [] + for key, val in line2.items(): + line.append((0,0,val)) + journal_id = inv.journal_id.id #self._get_journal(cr, uid, {'type': inv['type']}) journal = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal.centralisation: raise osv.except_osv(_('UserError'), _('Can not create invoice move on centralized journal')) - move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date} period_id=inv.period_id and inv.period_id.id or False if not period_id: