From 1ea07696714e43ae7b578df8c10252614581f9d9 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 1 Jun 2010 15:42:46 +0530 Subject: [PATCH 01/40] [IMP]: base_module_quality: Apply minor changes bzr revid: ksa@tinyerp.co.in-20100601101246-pnwln0zovpw6q887 --- addons/base_module_quality/pep8_test/pep8_test.py | 6 +++--- .../base_module_quality/pylint_test/pylint_test.py | 6 +++--- .../structure_test/structure_test.py | 6 +++--- addons/base_module_quality/terp_test/terp_test.py | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/base_module_quality/pep8_test/pep8_test.py b/addons/base_module_quality/pep8_test/pep8_test.py index 52c04756382..4aaaaa7bddc 100644 --- a/addons/base_module_quality/pep8_test/pep8_test.py +++ b/addons/base_module_quality/pep8_test/pep8_test.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 . # ############################################################################## @@ -48,7 +48,7 @@ PEP-8 Test , copyright of py files check, method can not call from loops list_files.append(os.path.join(i, j)) py_list = [] for file_py in list_files: - if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__terp__.py'): + if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__openerp__.py'): file_path = os.path.join(module_path, file_py) py_list.append(file_path) diff --git a/addons/base_module_quality/pylint_test/pylint_test.py b/addons/base_module_quality/pylint_test/pylint_test.py index 8dbbce0e2ce..12400dbb196 100644 --- a/addons/base_module_quality/pylint_test/pylint_test.py +++ b/addons/base_module_quality/pylint_test/pylint_test.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 . # ############################################################################## @@ -50,7 +50,7 @@ class quality_test(base_module_quality.abstract_quality_check): flag = False self.result_details += '''%s'''%(self.get_style()) for file_py in list_files: - if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__terp__.py'): + if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__openerp__.py'): if not flag: flag = True file_path = os.path.join(module_path, file_py) diff --git a/addons/base_module_quality/structure_test/structure_test.py b/addons/base_module_quality/structure_test/structure_test.py index 466976f5d17..10b80aaacdd 100644 --- a/addons/base_module_quality/structure_test/structure_test.py +++ b/addons/base_module_quality/structure_test/structure_test.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 . # ############################################################################## @@ -82,7 +82,7 @@ This test checks if the module satisfy tiny structure # module files calculation (module.py,module_view.xml,etc..) com_list = ['_unit_test.xml', '.py', '_view.xml', '_workflow.xml' , '_wizard.xml', '_report.xml', '_data.xml', '_demo.xml', '_security.xml', '_sequence.xml', '_graph.xml'] com_list = map(lambda x: module_name + x, com_list) - main_file = ['__init__.py', '__terp__.py'] + main_file = ['__init__.py', '__openerp__.py'] com_list.extend(main_file) module_dict['module'] = filter(lambda x: len(x.split(".")) > 1, module_dict['module']) score = self.get_score(module_dict['module'], com_list) diff --git a/addons/base_module_quality/terp_test/terp_test.py b/addons/base_module_quality/terp_test/terp_test.py index 993a80fe32b..a9747496dc1 100644 --- a/addons/base_module_quality/terp_test/terp_test.py +++ b/addons/base_module_quality/terp_test/terp_test.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 . # ############################################################################## @@ -49,13 +49,13 @@ class quality_test(base_module_quality.abstract_quality_check): score = 1.0 feel_good_factor = 0 feel_bad_factor = 0 - if '__terp__.py' not in list_files: + if '__openerp__.py' not in list_files: self.no_terp = True - self.result += _("The module does not contain the __terp__.py file") + self.result += _("The module does not contain the __openerp__.py file") return None result_dict = {} result_dict1 = {} - terp_file = os.path.join(module_path,'__terp__.py') + terp_file = os.path.join(module_path,'__openerp__.py') res = eval(tools.file_open(terp_file).read()) terp_keys = ['category', 'name', 'description', 'author', 'website', 'update_xml', 'init_xml', 'depends', 'version', 'active', 'installable', 'demo_xml'] for key in terp_keys: @@ -117,7 +117,7 @@ class quality_test(base_module_quality.abstract_quality_check): self.result_details += self.get_result_details(result_dict) self.result_details += self.get_result_details(result_dict1) - return [_('__terp__.py file'), score] + return [_('__openerp__.pyfile'), score] def run_test(self, cr, uid, module_path): terp_score = self.run_test_terp(cr, uid, module_path) @@ -125,7 +125,7 @@ class quality_test(base_module_quality.abstract_quality_check): if self.score*100 < self.min_score: self.message = 'Score is below than minimal score(%s%%)' % self.min_score if terp_score: - self.result = self.get_result({'__terp__.py': terp_score}) + self.result = self.get_result({'__openerp__.py': terp_score}) return None def get_result(self, dict_terp): From a4d86b14fe06532324e3bb1556480d8703083e3c Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Thu, 3 Jun 2010 11:14:59 +0530 Subject: [PATCH 02/40] [IMP] Improvements in View Icons bzr revid: vir@tinyerp.com-20100603054459-749x0w0whwqsdb4k --- addons/mrp/report/mrp_production_order_view.xml | 8 ++++---- addons/project/report/project_report_view.xml | 4 ++-- addons/project_issue/project_issue_view.xml | 2 +- addons/project_planning/project_planning_view.xml | 2 +- addons/purchase/purchase_view.xml | 2 +- addons/purchase/report/purchase_report_view.xml | 2 +- addons/resource/resource_view.xml | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/mrp/report/mrp_production_order_view.xml b/addons/mrp/report/mrp_production_order_view.xml index 99fd967b91d..55957619e31 100644 --- a/addons/mrp/report/mrp_production_order_view.xml +++ b/addons/mrp/report/mrp_production_order_view.xml @@ -47,14 +47,14 @@ - - - - + diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml index a94ffac39d9..26488eae254 100644 --- a/addons/project/report/project_report_view.xml +++ b/addons/project/report/project_report_view.xml @@ -58,7 +58,7 @@ - - + diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 9631e3151f6..dd3ed036691 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -213,7 +213,7 @@ - + - + diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 72d4feb0ae9..10c5ccd9749 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -169,7 +169,7 @@ - + diff --git a/addons/purchase/report/purchase_report_view.xml b/addons/purchase/report/purchase_report_view.xml index 5dd8dd31900..00c1c62f0ff 100644 --- a/addons/purchase/report/purchase_report_view.xml +++ b/addons/purchase/report/purchase_report_view.xml @@ -88,7 +88,7 @@ - + diff --git a/addons/resource/resource_view.xml b/addons/resource/resource_view.xml index 275c111225f..df0974fd9ed 100644 --- a/addons/resource/resource_view.xml +++ b/addons/resource/resource_view.xml @@ -55,7 +55,7 @@ - + From ada7a18cefe285500fde3a0a9cda9d7f1ca123e5 Mon Sep 17 00:00:00 2001 From: "RGA(Open ERP)" <> Date: Thu, 3 Jun 2010 14:21:24 +0530 Subject: [PATCH 03/40] [IMP,FIX] Sales Configuration menu Improved bzr revid: vir@tinyerp.com-20100603085124-4az0nn4t3pq12ayd --- addons/crm/crm_lead_view.xml | 17 ++++++----- addons/crm/crm_meeting_view.xml | 4 +-- addons/crm/crm_opportunity_view.xml | 14 ++++----- addons/crm/crm_phonecall_view.xml | 11 ++++--- addons/crm/crm_view.xml | 35 ++++++++++++++--------- addons/mail_gateway/mail_gateway_view.xml | 8 ++---- 6 files changed, 48 insertions(+), 41 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 31872e27ef4..dbfbeedf0a8 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -12,9 +12,11 @@ [('object_id.model', '=', 'crm.lead')] {'object_id':'crm.lead'} - + + + @@ -26,10 +28,11 @@ [('object_id.model', '=', 'crm.lead')] {'object_id':'crm.lead'} - + + diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index e84bbb673ee..e2decc30340 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -13,8 +13,8 @@ {'object_id':'crm.meeting'} - + diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml index 8b5cc42c502..407c3c53cf4 100644 --- a/addons/crm/crm_opportunity_view.xml +++ b/addons/crm/crm_opportunity_view.xml @@ -14,8 +14,8 @@ + id="menu_crm_case_opportunity-act" name="Categories" + parent="menu_crm_config_opportunity" /> @@ -29,8 +29,8 @@ + id="menu_crm_opportunity_stage_act" name="Stages" + parent="menu_crm_config_opportunity" /> @@ -44,8 +44,8 @@ + id="menu_crm_opportunity_resource_act" name="Resource" + parent="menu_crm_config_opportunity" /> @@ -329,7 +329,7 @@ - + diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index 65b77ed5abe..c5813a38b09 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -13,8 +13,8 @@ {'object_id':'crm.phonecall'} - + @@ -27,10 +27,9 @@ {'object_id':'crm.phonecall'} - - + diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 52450419fd2..f854981858c 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -1,8 +1,20 @@ - + + + + + + + + + @@ -117,9 +129,7 @@ - - - + crm.case.categ.form @@ -156,11 +166,11 @@ form - + id="menu_crm_case_section_act" sequence="4" + parent="base.menu_crm_config_sales" /> + @@ -201,8 +211,6 @@ form - Cases by section @@ -342,10 +350,11 @@ form tree,form - + groups="base.group_extended" sequence="5" + parent="base.menu_crm_config_sales" /> view.users.form.crm.modif.inherited1 diff --git a/addons/mail_gateway/mail_gateway_view.xml b/addons/mail_gateway/mail_gateway_view.xml index 611416055f7..e5b7b426fe9 100644 --- a/addons/mail_gateway/mail_gateway_view.xml +++ b/addons/mail_gateway/mail_gateway_view.xml @@ -165,13 +165,9 @@ + - Date: Thu, 3 Jun 2010 14:57:55 +0530 Subject: [PATCH 04/40] [IMP] stock_*, survey : New icons are added for views bzr revid: vir@tinyerp.com-20100603092755-f9lah87tbak53yq0 --- .../stock/report/report_stock_move_view.xml | 34 ++--- .../report/report_stock_picking_view.xml | 30 ++-- addons/stock/report/report_stock_view.xml | 16 +-- addons/stock/stock_view.xml | 128 +++++++++--------- addons/stock_planning/stock_planning_view.xml | 2 +- addons/survey/survey_view.xml | 10 +- 6 files changed, 110 insertions(+), 110 deletions(-) diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml index 673fd14e76e..a3771b4a480 100755 --- a/addons/stock/report/report_stock_move_view.xml +++ b/addons/stock/report/report_stock_move_view.xml @@ -44,16 +44,16 @@ - - - - - + + - - - + + + - - - + + + - - - + + + diff --git a/addons/stock/report/report_stock_picking_view.xml b/addons/stock/report/report_stock_picking_view.xml index e570e2b55ea..a14298ff771 100644 --- a/addons/stock/report/report_stock_picking_view.xml +++ b/addons/stock/report/report_stock_picking_view.xml @@ -54,38 +54,38 @@ - - - - - + + - - - - + + + + - - - + + + - - - + + + diff --git a/addons/stock/report/report_stock_view.xml b/addons/stock/report/report_stock_view.xml index 27f18d4ff43..34121d0c9ed 100644 --- a/addons/stock/report/report_stock_view.xml +++ b/addons/stock/report/report_stock_view.xml @@ -9,17 +9,17 @@ - - - + + + - - + + @@ -155,12 +155,12 @@ search - - - diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 92653501ed3..e9e5fa8b5e3 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -55,9 +55,9 @@ - - - + + + @@ -271,7 +271,7 @@ - + @@ -280,8 +280,8 @@ - - + + @@ -438,11 +438,11 @@ search - - - @@ -712,10 +712,10 @@ - - + + - + @@ -723,10 +723,10 @@ - - - - + + + + @@ -859,20 +859,20 @@ - - + + - + - - - - + + + + @@ -1041,8 +1041,8 @@ - - + + @@ -1051,11 +1051,11 @@ - - - - - + + + + + @@ -1216,9 +1216,9 @@ - + - + @@ -1226,13 +1226,13 @@ - - + + - + - - + + @@ -1275,20 +1275,20 @@ - - + + - - - - - - + + + + + + @@ -1397,9 +1397,9 @@ - + - + @@ -1407,18 +1407,18 @@ - - - - + + + + - - + + - + - - + + @@ -1526,9 +1526,9 @@ - - - + + + @@ -1539,12 +1539,12 @@ - - - + + + - - + + diff --git a/addons/stock_planning/stock_planning_view.xml b/addons/stock_planning/stock_planning_view.xml index dfca96b0163..1bfb1d0f1aa 100644 --- a/addons/stock_planning/stock_planning_view.xml +++ b/addons/stock_planning/stock_planning_view.xml @@ -239,7 +239,7 @@ - + diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index f838739d0da..a604b7c7c37 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -255,8 +255,8 @@ - - + + @@ -1065,13 +1065,13 @@ - - + + - + From d497f5c6e979971f6221480b3578714f0b07ee72 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 2 Jun 2010 15:06:25 +0200 Subject: [PATCH 05/40] [FIX] Define the local variable 'res' bzr revid: stephane@openerp.com-20100602130625-0xl1sqo57h6f0kue --- addons/account/account.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 04a0bb5da68..61319f7f973 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1965,13 +1965,12 @@ class account_add_tmpl_wizard(osv.osv_memory): if not tids or not tids[0]['parent_id']: return False ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]],['code']) + res = None if not ptids or not ptids[0]['code']: raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!')) res = acc_obj.search(cr,uid,[('code','=',ptids[0]['code'])]) - if res: - return res[0] - else: - return False + + return res and res[0] or False _columns = { 'cparent_id':fields.many2one('account.account', 'Parent target', help="Creates an account with the selected template under this existing parent.", required=True), From 22f439416273eba39653e4e1cae38c0f10ca9887 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Wed, 2 Jun 2010 19:24:27 +0530 Subject: [PATCH 06/40] [IMP] Improvement in sale and mrp bzr revid: ksa@tinyerp.co.in-20100602135427-p8w2q3n3venurpbn --- .../account/wizard/account_invoice_state.py | 6 +- addons/mrp/mrp.py | 20 ++++--- addons/project/project.py | 7 +-- addons/purchase/purchase.py | 57 +++++++++---------- addons/sale/sale.py | 4 +- 5 files changed, 48 insertions(+), 46 deletions(-) diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py index c3934e38db0..3b63ed843d1 100644 --- a/addons/account/wizard/account_invoice_state.py +++ b/addons/account/wizard/account_invoice_state.py @@ -37,11 +37,11 @@ class account_invoice_confirm(osv.osv_memory): context = {} pool_obj = pooler.get_pool(cr.dbname) data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context) - + for record in data_inv: if record['state'] not in ('draft','proforma','proforma2'): raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!")) - wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr) + wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_open', cr) return {} account_invoice_confirm() @@ -61,7 +61,7 @@ class account_invoice_cancel(osv.osv_memory): wf_service = netsvc.LocalService('workflow') pool_obj = pooler.get_pool(cr.dbname) data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context) - + for record in data_inv: if record['state'] in ('cancel','paid'): raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!")) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 685d289a194..701438f4c5b 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -20,6 +20,7 @@ ############################################################################## from mx import DateTime +from datetime import datetime, timedelta from osv import fields from osv import osv from tools.translate import _ @@ -117,9 +118,9 @@ class mrp_bom(osv.osv): """ Defines bills of material for a product. """ - _name = 'mrp.bom' + _name = 'mrp.bom' _description = 'Bill of Material' - + def _child_compute(self, cr, uid, ids, name, arg, context={}): """ Gets child bom. @param self: The object pointer @@ -419,7 +420,6 @@ class mrp_production(osv.osv): _name = 'mrp.production' _description = 'Manufacturing Order' _date_name = 'date_planned' - _log_create = True def _production_calc(self, cr, uid, ids, prop, unknow_none, context={}): """ Calculates total hours and total no. of cycles for a production order. @@ -647,15 +647,19 @@ class mrp_production(osv.osv): """ Changes the production state to Ready and location id of stock move. @return: True """ + for production in self.browse(cr, uid, ids): + production = self.browse(cr, uid, [production.id])[0] + s_date = datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S') + for (id,name) in self.name_get(cr, uid, ids): - message = _('Manufacturing Order ') + " '" + name + "' "+ _("is ready to produce.") + message = _('Manufacturing Order ') + " '" + name + "' "+ _("scheduled the") + " " + message += s_date.strftime('%Y-%m-%d') + " " + _("for") + " " + production.product_id.default_code self.log(cr, uid, id, message) move_obj = self.pool.get('stock.move') self.write(cr, uid, ids, {'state': 'ready'}) - for production in self.browse(cr, uid, ids): - if production.move_prod_id: - move_obj.write(cr, uid, [production.move_prod_id.id], - {'location_id': production.location_dest_id.id}) + if production.move_prod_id: + move_obj.write(cr, uid, [production.move_prod_id.id], + {'location_id': production.location_dest_id.id}) return True def action_production_end(self, cr, uid, ids): diff --git a/addons/project/project.py b/addons/project/project.py index 61720675f49..43430f134ee 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -150,14 +150,14 @@ class project(osv.osv): if leave['date_start'] > leave['date']: return False return True - + def _check_escalation(self, cr, uid, ids): project_obj = self.browse(cr, uid, ids[0]) if project_obj.project_escalation_id: if project_obj.project_escalation_id.id == project_obj.id: return False - return True - + return True + _constraints = [ (_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date']), (_check_escalation, 'Error! You cannot assign escalation to the same project!', ['project_escalation_id']) @@ -261,7 +261,6 @@ project() class task(osv.osv): _name = "project.task" _description = "Task" - _log_create = True _date_name = "date_start" def _str_get(self, task, level=0, border='***', context={}): diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index b886dc60a0e..3c09d748360 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -211,7 +211,6 @@ class purchase_order(osv.osv): } _name = "purchase.order" _description = "Purchase Order" - _log_create = True _order = "name desc" def unlink(self, cr, uid, ids, context=None): @@ -223,7 +222,7 @@ class purchase_order(osv.osv): else: raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!' % s['state'])) - # TODO: temporary fix in 5.0, to remove in 5.2 when subflows support + # TODO: temporary fix in 5.0, to remove in 5.2 when subflows support # automatically sending subflow.delete upon deletion wf_service = netsvc.LocalService("workflow") for id in unlink_ids: @@ -248,7 +247,7 @@ class purchase_order(osv.osv): return {'value':{'location_id': res, 'dest_address_id': False}} def onchange_partner_id(self, cr, uid, ids, part): - + if not part: return {'value':{'partner_address_id': False, 'fiscal_position': False}} addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default']) @@ -264,12 +263,12 @@ class purchase_order(osv.osv): #TODO: implement messages system def wkf_confirm_order(self, cr, uid, ids, context={}): todo = [] - for po in self.browse(cr, uid, ids): + for po in self.browse(cr, uid, ids): if not po.order_line: raise osv.except_osv(_('Error !'),_('You can not confirm purchase order without Purchase Order Lines.')) - for line in po.order_line: + for line in po.order_line: if line.state=='draft': - todo.append(line.id) + todo.append(line.id) current_name = self.name_get(cr, uid, ids)[0][1] self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context) for id in ids: @@ -313,13 +312,13 @@ class purchase_order(osv.osv): wf_service = netsvc.LocalService("workflow") for p_id in ids: # Deleting the existing instance of workflow for PO - wf_service.trg_delete(uid, 'purchase.order', p_id, cr) + wf_service.trg_delete(uid, 'purchase.order', p_id, cr) wf_service.trg_create(uid, 'purchase.order', p_id, cr) return True def action_invoice_create(self, cr, uid, ids, *args): res = False - + journal_obj = self.pool.get('account.journal') for o in self.browse(cr, uid, ids): il = [] @@ -437,7 +436,7 @@ class purchase_order(osv.osv): }) if order_line.move_dest_id: self.pool.get('stock.move').write(cr, uid, [order_line.move_dest_id.id], {'location_id':order.location_id.id}) - todo_moves.append(move) + todo_moves.append(move) self.pool.get('stock.move').action_confirm(cr, uid, todo_moves) self.pool.get('stock.move').force_assign(cr, uid, todo_moves) wf_service = netsvc.LocalService("workflow") @@ -459,26 +458,26 @@ class purchase_order(osv.osv): def do_merge(self, cr, uid, ids, context): - """ - To merge similar type of purchase orders. - Orders will only be merged if: - * Purchase Orders are in draft - * Purchase Orders belong to the same partner + """ + To merge similar type of purchase orders. + Orders will only be merged if: + * Purchase Orders are in draft + * Purchase Orders belong to the same partner * Purchase Orders are have same stock location, same pricelist - Lines will only be merged if: - * Order lines are exactly the same except for the quantity and unit + Lines will only be merged if: + * Order lines are exactly the same except for the quantity and unit @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: new purchase order id - - """ - wf_service = netsvc.LocalService("workflow") - def make_key(br, fields): + + """ + wf_service = netsvc.LocalService("workflow") + def make_key(br, fields): list_key = [] for field in fields: field_val = getattr(br, field) @@ -496,9 +495,9 @@ class purchase_order(osv.osv): return tuple(list_key) # compute what the new orders should contain - + new_orders = {} - + for porder in [order for order in self.browse(cr, uid, ids) if order.state == 'draft']: order_key = make_key(porder, ('partner_id', 'location_id', 'pricelist_id')) new_order = new_orders.setdefault(order_key, ({}, [])) @@ -541,7 +540,7 @@ class purchase_order(osv.osv): o_line[field] = field_val o_line['uom_factor'] = order_line.product_uom and order_line.product_uom.factor or 1.0 - + allorders = [] for order_key, (order_data, old_ids) in new_orders.iteritems(): @@ -601,7 +600,7 @@ class purchase_order_line(osv.osv): 'invoiced': fields.boolean('Invoiced', readonly=True), 'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner"), 'date_order': fields.related('order_id','date_order',string='Order Date',readonly=True,type="date") - + } _defaults = { 'product_qty': lambda *a: 1.0, @@ -692,7 +691,7 @@ class purchase_order_line(osv.osv): return res def action_confirm(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state': 'confirmed'}, context) - return True + return True purchase_order_line() class mrp_procurement(osv.osv): @@ -700,7 +699,7 @@ class mrp_procurement(osv.osv): _columns = { 'purchase_id': fields.many2one('purchase.order', 'Latest Requisition'), } - + def action_po_assign(self, cr, uid, ids, context={}): """ This is action which call from workflow to assign purchase order to procurements @return: True diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 356bd69f679..a19f51c2f3c 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -510,12 +510,12 @@ class sale_order(osv.osv): def action_invoice_end(self, cr, uid, ids, context=None): if context is None: context = {} - + for order in self.browse(cr, uid, ids, context=context): for line in order.order_line: if line.state == 'exception': self.pool.get('sale.order.line').write(cr, uid, [line.id], {'state': 'confirmed'}, context=context) - + if order.state == 'invoice_except': self.write(cr, uid, [order.id], {'state' : 'progress'}, context=context) From 3eb13e257fa730c6edcd07594e9c30256a30aaf6 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 3 Jun 2010 13:13:49 +0530 Subject: [PATCH 07/40] [IMP] Task-869 Improvement Log Message for account bzr revid: ksa@tinyerp.co.in-20100603074349-dntnjmu7u98d3opy --- addons/account/invoice.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 313ea48433e..105810f4cbb 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -952,6 +952,11 @@ class account_invoice(osv.osv): def _log_event(self, cr, uid, ids, factor=1.0, name='Open Invoice'): #TODO: implement messages system + for invoice in self.browse(cr, uid, ids): + for (id,number) in self.name_get(cr, uid, ids): + inv_number = number.split('/')[-1] + message = _('Invoice ') + " '" + _('INV/')+ inv_number + "' "+ _("Opened,")+_('journal entries')+ "' " + invoice.move_id.name + "' "+_("Created") + self.log(cr, uid, id, message) return True def name_get(self, cr, uid, ids, context=None): From feb6c1ed59ada372c46aff35c60b0a829028abc5 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 3 Jun 2010 11:49:51 +0200 Subject: [PATCH 08/40] [FIX] Typo bzr revid: stephane@openerp.com-20100603094951-vx4fxk1qsldkep4l --- addons/stock/stock_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index e9e5fa8b5e3..d821ab39d51 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1451,7 +1451,7 @@ - + From 235193bc757e12f891b1bb63130f29c14381d91a Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 3 Jun 2010 11:50:41 +0200 Subject: [PATCH 09/40] [FIX] Remove the duplicated xml_id bzr revid: stephane@openerp.com-20100603095041-i1588xri2lefsi75 --- addons/purchase/report/purchase_report_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/report/purchase_report_view.xml b/addons/purchase/report/purchase_report_view.xml index 00c1c62f0ff..8fb7836468d 100644 --- a/addons/purchase/report/purchase_report_view.xml +++ b/addons/purchase/report/purchase_report_view.xml @@ -1,7 +1,7 @@ - + product.month.graph purchase.report graph From 859b9b84c56f5d197c8f01046ae844758cd5ff6a Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 3 Jun 2010 11:51:06 +0200 Subject: [PATCH 10/40] [REF] Refactor the code of the wizard 'Sign In / Sign Out' [FIX] Remove the unless exception handling bzr revid: stephane@openerp.com-20100603095106-4v2uvxg3g6eakp82 --- .../wizard/hr_timesheet_sign_in_out.py | 43 ++++++------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py index fa57cfdd1a5..dc1a6723786 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py @@ -115,31 +115,19 @@ class hr_si_project(osv.osv_memory): # get the latest action (sign_in or out) for this employee cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,)) res = (cr.fetchone() or ('sign_out',))[0] + in_out = res == 'sign_out' and 'out' or 'in' #TODO: invert sign_in et sign_out - if res == 'sign_out': - model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_in')]) - resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id'] - return { - 'name': 'Sign in / Sign out', - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'hr.sign.in.project', - 'views': [(False,'tree'), (resource_id,'form')], - 'type': 'ir.actions.act_window', - 'target': 'new' - } - else: - model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_out')]) - resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id'] - return { - 'name': 'Sign in / Sign out', - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'hr.sign.out.project', - 'views': [(False,'tree'), (resource_id,'form')], - 'type': 'ir.actions.act_window', - 'target': 'new' - } + model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_%s' % in_out)]) + resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id'] + return { + 'name': 'Sign in / Sign out', + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_model': 'hr.sign.%s.project' % in_out, + 'views': [(False,'tree'), (resource_id,'form')], + 'type': 'ir.actions.act_window', + 'target': 'new' + } def _get_empid(self, cr, uid, context=None): emp_obj = self.pool.get('hr.employee') @@ -153,10 +141,7 @@ class hr_si_project(osv.osv_memory): emp_obj = self.pool.get('hr.employee') data = self.read(cr, uid, ids, [], context)[0] emp_id = data['emp_id'] - try: - success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['date'] or False) - except except_osv, e: - raise osv.except_osv(e.name, e.value) + success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['date'] or False) return {} def default_get(self, cr, uid, fields_list, context=None): @@ -166,4 +151,4 @@ class hr_si_project(osv.osv_memory): hr_si_project() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 8ce1789a575992f1cc7eab99ee1f1d6a9839d4c3 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 3 Jun 2010 17:10:23 +0530 Subject: [PATCH 11/40] [FIX]: crm: context problem of onchange in forward to partner wizard bzr revid: rpa@tinyerp.com-20100603114023-2uwwm7sopkw6ccle --- addons/crm/wizard/crm_forward_to_partner.py | 4 ++-- addons/crm/wizard/crm_forward_to_partner_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/crm/wizard/crm_forward_to_partner.py b/addons/crm/wizard/crm_forward_to_partner.py index 156ab3311f4..945066506d7 100644 --- a/addons/crm/wizard/crm_forward_to_partner.py +++ b/addons/crm/wizard/crm_forward_to_partner.py @@ -107,8 +107,8 @@ class crm_lead_forward_to_partner(osv.osv_memory): #TODO: ids and context are not comming res = False msg_val = '' - res_id = False # Comes from context - model = None # Comes from context + res_id = context.get('active_id') + model = context.get('active_model') model_pool = self.pool.get(model) if not res_id or not model: return res diff --git a/addons/crm/wizard/crm_forward_to_partner_view.xml b/addons/crm/wizard/crm_forward_to_partner_view.xml index 1e8c6fc8583..b6295cfa3a9 100644 --- a/addons/crm/wizard/crm_forward_to_partner_view.xml +++ b/addons/crm/wizard/crm_forward_to_partner_view.xml @@ -9,7 +9,7 @@
- + From 51dbc8c418dbc5e6c149f4300840fb0e66d8d1c8 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 3 Jun 2010 17:26:42 +0530 Subject: [PATCH 12/40] [IMP] Task-849 Improvement log Message for account and mrp bzr revid: ksa@tinyerp.co.in-20100603115642-p6dqe7d57a1adekm --- addons/account/invoice.py | 21 +++++++++++++-------- addons/mrp/mrp.py | 26 +++++++++++++++----------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 105810f4cbb..2ff9759a434 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -862,7 +862,6 @@ class account_invoice(osv.osv): # make the invoice point to that move self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}) self.pool.get('account.move').post(cr, uid, [move_id]) - self._log_event(cr, uid, ids) return True def line_get_convert(self, cr, uid, x, part, date, context=None): @@ -916,6 +915,7 @@ class account_invoice(osv.osv): 'WHERE account_move_line.move_id = %s ' \ 'AND account_analytic_line.move_id = account_move_line.id', (ref, move_id)) + self._log_event(cr, uid, ids) return True def action_cancel(self, cr, uid, ids, *args): @@ -951,13 +951,18 @@ class account_invoice(osv.osv): return taxes.values() def _log_event(self, cr, uid, ids, factor=1.0, name='Open Invoice'): - #TODO: implement messages system - for invoice in self.browse(cr, uid, ids): - for (id,number) in self.name_get(cr, uid, ids): - inv_number = number.split('/')[-1] - message = _('Invoice ') + " '" + _('INV/')+ inv_number + "' "+ _("Opened,")+_('journal entries')+ "' " + invoice.move_id.name + "' "+_("Created") - self.log(cr, uid, id, message) - return True + for (invoice_id,number) in self.name_get(cr, uid, ids): + invoice = self.browse(cr,uid,invoice_id) + message = ("%s %s %s %s %s %s %s") % ( + _('Invoice'), + _("INV/"), + number.split('/')[-1], + _("Opened,"), + _('journal entries'), + invoice.move_id.name, + _("Created")) + self.log(cr, uid, invoice_id, message) + return True def name_get(self, cr, uid, ids, context=None): if not len(ids): diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 701438f4c5b..488132a8b78 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -647,19 +647,23 @@ class mrp_production(osv.osv): """ Changes the production state to Ready and location id of stock move. @return: True """ - for production in self.browse(cr, uid, ids): - production = self.browse(cr, uid, [production.id])[0] - s_date = datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S') - - for (id,name) in self.name_get(cr, uid, ids): - message = _('Manufacturing Order ') + " '" + name + "' "+ _("scheduled the") + " " - message += s_date.strftime('%Y-%m-%d') + " " + _("for") + " " + production.product_id.default_code - self.log(cr, uid, id, message) move_obj = self.pool.get('stock.move') self.write(cr, uid, ids, {'state': 'ready'}) - if production.move_prod_id: - move_obj.write(cr, uid, [production.move_prod_id.id], - {'location_id': production.location_dest_id.id}) + + for (production_id,name) in self.name_get(cr, uid, ids): + production = self.browse(cr, uid, production_id) + if production.move_prod_id: + move_obj.write(cr, uid, [production.move_prod_id.id], + {'location_id': production.location_dest_id.id}) + + message = ("%s %s %s %s %s %s") % ( + _('Manufacturing Order '), + name, + _("scheduled the"), + datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'), + _("for"), + production.product_id.default_code) + self.log(cr, uid, production_id, message) return True def action_production_end(self, cr, uid, ids): From 4ab90ab79f47656eb7bffeb1a4482da96e6706a2 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Thu, 3 Jun 2010 19:14:00 +0530 Subject: [PATCH 13/40] [IMP] hr,hr_attendance,hr_contract,hr_evaluation,idea,marketing_campaign,membership icon are modified to new icons, membership search view improved bzr revid: vir@tinyerp.com-20100603134400-1zua9zqi6y6ty8ys --- addons/hr/hr_view.xml | 20 ++-- addons/hr_attendance/hr_attendance_view.xml | 10 +- addons/hr_contract/hr_contract_view.xml | 4 +- addons/hr_evaluation/hr_evaluation_view.xml | 28 +++--- .../report/hr_evaluation_report_view.xml | 30 +++--- addons/idea/idea_view.xml | 40 ++++---- .../marketing_campaign_view.xml | 92 +++++++++---------- .../report/campaign_analysis_view.xml | 26 +++--- addons/membership/membership_view.xml | 13 +-- 9 files changed, 130 insertions(+), 133 deletions(-) diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index 36524395355..75da20cef20 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -106,7 +106,7 @@ search - @@ -114,12 +114,12 @@ - - - + + + - - + + @@ -358,15 +358,15 @@ search - - - @@ -374,7 +374,7 @@ - diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml index 8b9a68575b0..e3db974ebb5 100644 --- a/addons/hr_attendance/hr_attendance_view.xml +++ b/addons/hr_attendance/hr_attendance_view.xml @@ -48,16 +48,16 @@ search - - + + - - - + + + diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index e4e8259bda4..84cc82ebe8b 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -146,8 +146,8 @@ - - + + diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index d02c76bc44c..a3e4cac2a5f 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -13,8 +13,8 @@ - - + + @@ -243,15 +243,15 @@ - - - + + + - - @@ -261,12 +261,12 @@ - - - - + + + + - + @@ -344,10 +344,10 @@ - + - + diff --git a/addons/hr_evaluation/report/hr_evaluation_report_view.xml b/addons/hr_evaluation/report/hr_evaluation_report_view.xml index 6ccd1e80ab9..5406a7a3fbd 100644 --- a/addons/hr_evaluation/report/hr_evaluation_report_view.xml +++ b/addons/hr_evaluation/report/hr_evaluation_report_view.xml @@ -42,32 +42,32 @@ - - - - @@ -75,16 +75,16 @@ - - - + + + - - + + - - - + + + diff --git a/addons/idea/idea_view.xml b/addons/idea/idea_view.xml index 8aa0802fcda..90ee35d21e2 100644 --- a/addons/idea/idea_view.xml +++ b/addons/idea/idea_view.xml @@ -61,15 +61,15 @@ - + - - + action="action_idea_select"/> @@ -139,7 +139,7 @@
- + @@ -153,10 +153,10 @@
- - - - + + + +
@@ -218,20 +218,20 @@ - - + +