From 769d59d062886a835308c214f28064b4c62f02c3 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 11 Jun 2010 16:44:32 +0200 Subject: [PATCH 001/175] common wizard bzr revid: al@openerp.com-20100611144432-cqatixmei0anl1tl --- addons/account/__openerp__.py | 3 +- addons/account/wizard/__init__.py | 2 + .../account/wizard/account_common_report.py | 163 ++++++++++++++++++ .../account/wizard/account_common_report.xml | 117 +++++++++++++ 4 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 addons/account/wizard/account_common_report.py create mode 100644 addons/account/wizard/account_common_report.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 51724f47d33..70c55bc804f 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -52,6 +52,7 @@ module named account_voucherss 'wizard/account_use_model_view.xml', 'account_view.xml', 'account_report.xml', + 'wizard/account_common_report.xml', 'wizard/account_invoice_refund_view.xml', 'wizard/account_period_close_view.xml', 'wizard/account_fiscalyear_close_state.xml', @@ -129,4 +130,4 @@ module named account_voucherss 'active': False, 'certificate': '0080331923549', } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py index 39971f5c11a..cf0f39f18d7 100644 --- a/addons/account/wizard/__init__.py +++ b/addons/account/wizard/__init__.py @@ -19,6 +19,8 @@ # ############################################################################## +import account_common_report + import account_automatic_reconcile import account_move_line_reconcile_select import account_move_line_unreconcile_select diff --git a/addons/account/wizard/account_common_report.py b/addons/account/wizard/account_common_report.py new file mode 100644 index 00000000000..34d74999119 --- /dev/null +++ b/addons/account/wizard/account_common_report.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +import time + +from osv import fields, osv +from tools.translate import _ +import tools + +class account_common_report(osv.osv_memory): + _name = "account.common.report" + _description = "Common Report" + + _columns = { + 'account_id': fields.many2one('account.account', 'Chart of account', required=True, domain = [('parent_id','=',False)]), + 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'), + + 'filter': fields.selection([('filter_no','No filters'), ('filter_date','Date'), ('filter_period','Periods')],"Filter by:", required=True), + + 'period_from': fields.many2one('account.period' 'Start period'), + 'period_to': fields.many2one('account.period', 'End period'), + 'period_ids': fields.many2many('account.period', 'ledger_period_rel', 'ledger_id', 'period_id', 'Periods'), + + 'journal_ids': fields.many2many('account.journal', 'account_common_journal_rel', 'account_id', 'journal_id', 'Journals', required=True), + + 'date_from': fields.date("Start date"), + 'date_to': fields.date("End date"), + + #'display_account': fields.selection([('bal_mouvement','With movements'), ('bal_all','All'), ('bal_solde','With balance is not equal to 0')],"Display accounts"), + #'landscape': fields.boolean("Landscape Mode"), + #'soldeinit': fields.boolean("Include initial balances"), + #'amount_currency': fields.boolean("With Currency"), + + #'filter': fields.boolean("Landscape Mode"), + #'state': fields.selection([('bydate','By Date'), ('byperiod','By Period'), ('all','By Date and Period'), ('none','No Filter')],"Date/Period Filter"), + #'company_id': fields.many2one('res.company', 'Company', required=True), + } + + def _get_company(self, cr, uid, context=None): + user_obj = self.pool.get('res.users') + company_obj = self.pool.get('res.company') + if context is None: + context = {} + user = user_obj.browse(cr, uid, uid, context=context) + if user.company_id: + return user.company_id.id + else: + return company_obj.search(cr, uid, [('parent_id', '=', False)])[0] + + def _get_fiscalyear(self, cr, uid, context=None): + return 1 + + _defaults = { + 'state' : 'none', + 'date_from' : time.strftime('%Y-01-01'), + 'date_to' : time.strftime('%Y-%m-%d'), + 'company_id' : _get_company, + 'display_account' : 'bal_all', + 'sortbydate' : 'sort_date', + 'fiscalyear' : _get_fiscalyear, + 'landscape': True, + 'amount_currency' : True, + } + + def next_view(self, cr, uid, ids, context=None): + obj_model = self.pool.get('ir.model.data') + if context is None: + context = {} + data = self.read(cr, uid, ids, [])[0] + context.update({'Account_list': data['Account_list']}) + model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_general_ledger_report_view')]) + resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'account.general.ledger.report', + 'views': [(resource_id,'form')], + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context': context + } + + def _check_date(self, cr, uid, data, context=None): + if context is None: + context = {} + sql = """ + SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """ + cr.execute(sql,(data['form']['date_from'],)) + res = cr.dictfetchall() + if res: + if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']): + raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop']))) + else: + if data['form']['landscape'] == True: + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'account.general.ledger_landscape', + 'datas': data, + 'nodestroy':True, + } + else: + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'account.general.ledger', + 'datas': data, + 'nodestroy':True, + } + else: + raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year')) + + def check_report(self, cr, uid, ids, context=None): + if context is None: + context = {} + data={} + data['ids'] = context.get('active_ids',[]) + data['form'] = self.read(cr, uid, ids, ['date_from', 'sortbydate', 'company_id', 'soldeinit', 'state', 'periods', 'date_to', 'amount_currency', 'display_account', 'landscape', 'fiscalyear'])[0] + data['form']['Account_list'] = context.get('Account_list',[]) + if data['form']['Account_list']: + data['model'] = 'ir.ui.menu' + else: + data['model'] = 'account.account' + data['form']['context'] = context + if data['form']['state'] == 'bydate': + return self._check_date(cr, uid, data, context) + elif data['form']['state'] == 'byperiod': + if not data['form']['periods']: + raise osv.except_osv(_('Data Insufficient !'),_('Please select periods.')) + if data['form']['landscape'] == True: + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'account.general.ledger_landscape', + 'datas': data, + 'nodestroy':True, + } + else: + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'account.general.ledger', + 'datas': data, + 'nodestroy':True, + } + +account_common_report() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/account/wizard/account_common_report.xml b/addons/account/wizard/account_common_report.xml new file mode 100644 index 00000000000..3927ca93401 --- /dev/null +++ b/addons/account/wizard/account_common_report.xml @@ -0,0 +1,117 @@ + + + + + Common Report + account.common.report + form + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/addons/account_voucher_payment/account_voucher_payment_wizard.xml b/addons/account_voucher_payment/account_voucher_payment_wizard.xml index 0551b1bbcb5..2f961994fbd 100644 --- a/addons/account_voucher_payment/account_voucher_payment_wizard.xml +++ b/addons/account_voucher_payment/account_voucher_payment_wizard.xml @@ -4,7 +4,7 @@ From e69b3596d0caf4e5333ed37f0c60768409e87612 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 23 Jun 2010 16:27:04 +0530 Subject: [PATCH 101/175] [REF] purchase bzr revid: mra@mra-laptop-20100623105704-y2ad6iuqllbxuiu5 --- .../purchase/wizard/purchase_order_group.py | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/addons/purchase/wizard/purchase_order_group.py b/addons/purchase/wizard/purchase_order_group.py index 8c4e0784a7b..d9778dceb47 100644 --- a/addons/purchase/wizard/purchase_order_group.py +++ b/addons/purchase/wizard/purchase_order_group.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,46 +15,39 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## +import time from osv import fields, osv -from service import web_services import netsvc import pooler -import time -import wizard from osv.orm import browse_record, browse_null class purchase_order_group(osv.osv_memory): _name = "purchase.order.group" - _description = "Purchase Wizard" - _columns = { - - } + _description = "Purchase Order Merge" def merge_orders(self, cr, uid, ids, context): - """ + """ To merge similar type of purchase orders. - + @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in - @param ids: the ID or list of IDs - @param context: A standard dictionary - + @param ids: the ID or list of IDs + @param context: A standard dictionary + @return: purchase order view - - """ + + """ order_obj = self.pool.get('purchase.order') mod_obj =self.pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'purchase', 'view_purchase_order_filter') id = mod_obj.read(cr, uid, result, ['res_id']) - allorders = order_obj.do_merge(cr, uid, context.get('active_ids',[]), context) - return { 'domain': "[('id','in', [" + ','.join(map(str, allorders)) + "])]", @@ -66,5 +59,7 @@ class purchase_order_group(osv.osv_memory): 'type': 'ir.actions.act_window', 'search_view_id': id['res_id'] } + purchase_order_group() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From 1b8b85c9d51135cb8a1145227126076574db9bfb Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 23 Jun 2010 16:54:15 +0530 Subject: [PATCH 102/175] [REM] purchase wizard view and misc changes bzr revid: mra@mra-laptop-20100623112415-1y11p2k0j3ylm7o9 --- addons/purchase/company.py | 6 +++--- addons/purchase/partner.py | 15 ++++++--------- addons/purchase/purchase_wizard.xml | 13 ------------- addons/purchase/stock.py | 6 +++--- 4 files changed, 12 insertions(+), 28 deletions(-) delete mode 100644 addons/purchase/purchase_wizard.xml diff --git a/addons/purchase/company.py b/addons/purchase/company.py index 2a01605782c..012bb2142c0 100644 --- a/addons/purchase/company.py +++ b/addons/purchase/company.py @@ -28,9 +28,9 @@ class company(osv.osv): help="This is the leads/security time for each purchase order."), } _defaults = { - 'po_lead': lambda *a: 1.0, + 'po_lead': 1.0, } + company() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/purchase/partner.py b/addons/purchase/partner.py index 48d006f2c15..afd13f6829e 100644 --- a/addons/purchase/partner.py +++ b/addons/purchase/partner.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -27,17 +27,14 @@ class res_partner(osv.osv): _columns = { 'property_product_pricelist_purchase': fields.property( 'product.pricelist', - type='many2one', - relation='product.pricelist', + type='many2one', + relation='product.pricelist', domain=[('type','=','purchase')], - string="Purchase Pricelist", + string="Purchase Pricelist", method=True, view_load=True, help="This pricelist will be used, instead of the default one, for purchases from the current partner"), } res_partner() - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/purchase/purchase_wizard.xml b/addons/purchase/purchase_wizard.xml deleted file mode 100644 index d76ce1e3819..00000000000 --- a/addons/purchase/purchase_wizard.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index 087c9d6ddc8..245da72cad8 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -29,7 +29,7 @@ class stock_move(osv.osv): readonly=True), } _defaults = { - 'purchase_line_id': lambda *a:False + 'purchase_line_id': False } stock_move() From 69525bf30269fb9e54198ffb2257740a0c33022e Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 23 Jun 2010 16:56:10 +0530 Subject: [PATCH 103/175] [REM] purchase analytic bzr revid: mra@mra-laptop-20100623112610-rhvatf7okayj0uwo --- .../purchase_analytic_plans.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/addons/purchase_analytic_plans/purchase_analytic_plans.py b/addons/purchase_analytic_plans/purchase_analytic_plans.py index 757868f13ed..0af2f90ba47 100644 --- a/addons/purchase_analytic_plans/purchase_analytic_plans.py +++ b/addons/purchase_analytic_plans/purchase_analytic_plans.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,17 +15,15 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## - -from osv import fields -from osv import osv import time -import netsvc - -import ir from mx import DateTime + +from osv import fields, osv +import netsvc +import ir import pooler from tools import config @@ -34,7 +32,7 @@ class purchase_order_line(osv.osv): _inherit='purchase.order.line' _columns = { 'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'), - } + } purchase_order_line() @@ -48,5 +46,5 @@ class purchase_order(osv.osv): return res purchase_order() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From dfcaa64718e093f7775f19e5657caead745b3e44 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Wed, 23 Jun 2010 17:20:24 +0530 Subject: [PATCH 104/175] [FIX]: override the correct view of voucher bzr revid: mga@tinyerp.com-20100623115024-vzl1bs20g0g2ic3c --- .../account_voucher_payment/account_voucher_payment_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher_payment/account_voucher_payment_view.xml b/addons/account_voucher_payment/account_voucher_payment_view.xml index adb4aebf44b..7969e9dbfca 100755 --- a/addons/account_voucher_payment/account_voucher_payment_view.xml +++ b/addons/account_voucher_payment/account_voucher_payment_view.xml @@ -63,11 +63,11 @@ - + account.voucher.form account.voucher form - +