From 101e933d28150aaf0940810d90e6dcde2d07d3a3 Mon Sep 17 00:00:00 2001 From: "Ysa (Open ERP)" Date: Fri, 2 Apr 2010 14:32:27 +0530 Subject: [PATCH 01/34] [IMP] workflow :- add domain in workflow field. bzr revid: ysa@tinyerp.co.in-20100402090227-6yqr461xps4jz97b --- bin/addons/base/ir/workflow/workflow.py | 1 + bin/addons/base/ir/workflow/workflow_view.xml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/ir/workflow/workflow.py b/bin/addons/base/ir/workflow/workflow.py index 2a551e9549f..f32f0d842f7 100644 --- a/bin/addons/base/ir/workflow/workflow.py +++ b/bin/addons/base/ir/workflow/workflow.py @@ -151,6 +151,7 @@ class wkf_transition(osv.osv): 'condition': fields.char('Condition', required=True, size=128), 'act_from': fields.many2one('workflow.activity', 'Source Activity', required=True, select=True, ondelete='cascade'), 'act_to': fields.many2one('workflow.activity', 'Destination Activity', required=True, select=True, ondelete='cascade'), + 'workflow_id': fields.related('act_from', 'wkf_id', type='many2one', relation='workflow', string='Workflow'), } _defaults = { 'condition': lambda *a: 'True', diff --git a/bin/addons/base/ir/workflow/workflow_view.xml b/bin/addons/base/ir/workflow/workflow_view.xml index 04457f21338..c72d2f55ea3 100644 --- a/bin/addons/base/ir/workflow/workflow_view.xml +++ b/bin/addons/base/ir/workflow/workflow_view.xml @@ -35,8 +35,8 @@ - - + + From 4e056d7540fb0f2aec47617304ca77bd20c534e5 Mon Sep 17 00:00:00 2001 From: "Ysa (Open ERP)" Date: Fri, 2 Apr 2010 17:58:57 +0530 Subject: [PATCH 02/34] [IMP] diagram :- improve code. bzr revid: ysa@tinyerp.co.in-20100402122857-dpbc2b8nhgrzvtyq --- bin/addons/base/ir/workflow/workflow.py | 1 - bin/addons/base/ir/workflow/workflow_view.xml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/addons/base/ir/workflow/workflow.py b/bin/addons/base/ir/workflow/workflow.py index f32f0d842f7..2a551e9549f 100644 --- a/bin/addons/base/ir/workflow/workflow.py +++ b/bin/addons/base/ir/workflow/workflow.py @@ -151,7 +151,6 @@ class wkf_transition(osv.osv): 'condition': fields.char('Condition', required=True, size=128), 'act_from': fields.many2one('workflow.activity', 'Source Activity', required=True, select=True, ondelete='cascade'), 'act_to': fields.many2one('workflow.activity', 'Destination Activity', required=True, select=True, ondelete='cascade'), - 'workflow_id': fields.related('act_from', 'wkf_id', type='many2one', relation='workflow', string='Workflow'), } _defaults = { 'condition': lambda *a: 'True', diff --git a/bin/addons/base/ir/workflow/workflow_view.xml b/bin/addons/base/ir/workflow/workflow_view.xml index c72d2f55ea3..04457f21338 100644 --- a/bin/addons/base/ir/workflow/workflow_view.xml +++ b/bin/addons/base/ir/workflow/workflow_view.xml @@ -35,8 +35,8 @@ - - + + From d984b6d8d0e4fa589c3d3f176e470b69a228bb13 Mon Sep 17 00:00:00 2001 From: "Rvo (Open ERP)" Date: Mon, 5 Apr 2010 11:31:06 +0530 Subject: [PATCH 03/34] Removed print statement bzr revid: rvo@tinyerp.co.in-20100405060106-pz1vz05wue71p0kc --- bin/osv/orm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index af3ca7ec6dc..ebc24530cd9 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1119,7 +1119,6 @@ class orm_template(object): for r in res.keys(): if r not in fields: del res[r] - print 'Result from fields get', res return res # @@ -2902,7 +2901,7 @@ class orm(orm_template): :raise UserError: if the record is default property for other records """ - + if not ids: return True if isinstance(ids, (int, long)): From 13a43dfdc36b751cb9ed6c55169e76b48094b829 Mon Sep 17 00:00:00 2001 From: "DSH(OpenERP)" <> Date: Tue, 6 Apr 2010 12:03:36 +0530 Subject: [PATCH 04/34] Support tiny report tag in add_header, prevent server crash on wrong report type selection lp bug: https://launchpad.net/bugs/510834 fixed bzr revid: hda@tinyerp.com-20100406063336-sh9u8tyfqdybtrp7 --- bin/report/report_sxw.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 98d960db1a4..a85bac84f5c 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -297,11 +297,7 @@ class rml_parse(object): rml_head = self.rml_header2 else: rml_head = self.rml_header - if self.logo and (rml_head.find('company.logo')<0 or rml_head.find('',''' [[company.logo]] ''') - if not self.logo and rml_head.find('company.logo')>=0: - rml_head = rml_head.replace('','') + head_dom = etree.XML(rml_head) for tag in head_dom: found = rml_dom.find('.//'+tag.tag) @@ -443,9 +439,10 @@ class report_sxw(report_rml, preprocess.report): rml_parser = self.parser(cr, uid, self.name2, context=context) objs = self.getObjects(cr, uid, ids, context) rml_parser.set_context(objs, data, ids, report_xml.report_type) - processed_rml = self.preprocess_rml(etree.XML(rml),report_xml.report_type) + processed_rml = etree.XML(rml) if report_xml.header: rml_parser._add_header(processed_rml) + processed_rml = self.preprocess_rml(processed_rml,report_xml.report_type) if rml_parser.logo: logo = base64.decodestring(rml_parser.logo) create_doc = self.generators[report_xml.report_type] @@ -462,13 +459,18 @@ class report_sxw(report_rml, preprocess.report): sxw_z = zipfile.ZipFile(sxw_io, mode='r') rml = sxw_z.read('content.xml') meta = sxw_z.read('meta.xml') + mime_type = sxw_z.read('mimetype') + if mime_type == 'application/vnd.sun.xml.writer': + mime_type = 'sxw' + else : + mime_type = 'odt' sxw_z.close() rml_parser = self.parser(cr, uid, self.name2, context=context) rml_parser.parents = sxw_parents rml_parser.tag = sxw_tag objs = self.getObjects(cr, uid, ids, context) - rml_parser.set_context(objs, data, ids,report_xml.report_type) + rml_parser.set_context(objs, data, ids, mime_type) rml_dom_meta = node = etree.XML(meta) elements = node.findall(rml_parser.localcontext['name_space']["meta"]+"user-defined") @@ -489,7 +491,7 @@ class report_sxw(report_rml, preprocess.report): for n in rml_dom.iterdescendants(): if n.tag == key1: elements.append(n) - if report_type == 'odt': + if mime_type == 'odt': for pe in elements: e = pe.findall(key2) for de in e: @@ -520,8 +522,8 @@ class report_sxw(report_rml, preprocess.report): if de.getparent(): pp.remove(de) - rml_dom = self.preprocess_rml(rml_dom,report_type) - create_doc = self.generators[report_type] + rml_dom = self.preprocess_rml(rml_dom, mime_type) + create_doc = self.generators[mime_type] odt = etree.tostring(create_doc(rml_dom, rml_parser.localcontext), encoding='utf-8', xml_declaration=True) sxw_z = zipfile.ZipFile(sxw_io, mode='a') @@ -547,7 +549,7 @@ class report_sxw(report_rml, preprocess.report): sxw_z.close() final_op = sxw_io.getvalue() sxw_io.close() - return (final_op, report_type) + return (final_op, mime_type) def create_single_html2html(self, cr, uid, ids, data, report_xml, context=None): if not context: From b7133378a2281aca219357c8da27a5455accb309 Mon Sep 17 00:00:00 2001 From: "DSH(OpenERP)" <> Date: Tue, 6 Apr 2010 15:03:56 +0530 Subject: [PATCH 05/34] Added removeParentNode in company header logo bzr revid: hda@tinyerp.com-20100406093356-lz9cdk9ldswks2m3 --- bin/addons/base/res/res_company.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/res/res_company.py b/bin/addons/base/res/res_company.py index dccf08ed2ed..ea64aa5eb16 100644 --- a/bin/addons/base/res/res_company.py +++ b/bin/addons/base/res/res_company.py @@ -209,7 +209,7 @@ class res_company(osv.osv): - [[company.logo]] + [[ company.logo or removeParentNode('image') ]] From 91a88a3f8dbd4d2438ddd273d3683fe7a16d03ba Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Tue, 6 Apr 2010 15:56:21 +0530 Subject: [PATCH 06/34] Improved docstring of orm bzr revid: hda@tinyerp.com-20100406102621-0n65uvesduhpv987 --- bin/osv/orm.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 589681ebfaf..29eab99a7d1 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -2493,12 +2493,12 @@ class orm(orm_template): def default_get(self, cr, uid, fields_list, context=None): """ - Get default field values of the given field list of the model + To Get default field values of given fields list of the model :param cr: database cursor :param uid: current user id :param fields_list: a list of fields to get the default value - :type fields_list: a list (example ['field_name_1', ...]) + :type fields_list: a list (example ['field1','field2',]) :param context: context arguments, like lang, time zone :return: a dictionary of the default values for fields (set on the object class, by the user preferences, or via the context) @@ -2872,9 +2872,9 @@ class orm(orm_template): def check_access_rule(self, cr, uid, ids, operation, context=None): """Verifies that the operation given by ``operation`` is allowed for the user according to ir.rules. - @param ``operation``: one of ``'read'``, ``'write'``, ``'unlink'`` - @raise ``except_orm``: if current ir.rules do not permit this operation. - @return: ``None`` if the operation is allowed + :param operation: one of ``'read'``, ``'write'``, ``'unlink'`` + :raise except_orm: * if current ir.rules do not permit this operation. + :return: None if the operation is allowed """ where_clause, where_params, tables = self.pool.get('ir.rule').domain_get(cr, uid, self._name, operation, context=context) if where_clause: @@ -2955,9 +2955,9 @@ class orm(orm_template): :param cr: database cursor :param user: current user id :type user: integer (example 1) - :param ids: id or a list of ids - :param vals: a dictionary of field values to update - :type vals: a dictionary (example {'field_name':'value', ...}) + :param ids: id or list of ids + :param vals: dictionary of field values to update + :type vals: dictionary (example {'field_name':'value', ...}) :param context(optional, highly recommended): context arguments, like lang, time zone :return: True :raise AccessError: * if user has no write rights on the requested object @@ -3165,10 +3165,10 @@ class orm(orm_template): :param cr: database cursor :param user: current user id :type user: integer (example 1) - :param vals: a dictionary for new record {'field_name':field_value, ...} - :type vals: a dictionary (example {'field_name':field_value, ...}) + :param vals: dictionary for new record {'field_name':field_value, ...} + :type vals: dictionary (example {'field_name':field_value, ...}) :param context(optional, highly recommended): context arguements, like lang, time zone - :type context: a dictionary (example {'lang':'en_us', ...}) + :type context: dictionary (example {'lang':'en_us', ...}) :return: id of new record created :raise AccessError: * if user has no create rights on the requested object * if user tries to bypass access rules for create on the requested object @@ -3532,10 +3532,10 @@ class orm(orm_template): :param cr: database cursor :param user: current user id - :param args: a list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...] - :param offset: optional number of records to skip + :param args: list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...] + :param offset: optional number from search starts :param limit: optional max number of records to return - :param order: optional columns to sort by (default: self._order ) + :param order: optional columns to sort by (default: self._order=id ) :param context(optional, highly recommended): context arguments, like lang, time zone :param count: if True, returns only the number of records matching the criteria, not their ids :return: id or a list of ids of records matching the criteria From 927227cef9f80780a265e9407d46487012892a86 Mon Sep 17 00:00:00 2001 From: "Rvo (Open ERP)" Date: Tue, 6 Apr 2010 18:00:28 +0530 Subject: [PATCH 07/34] [IMP]:improved orm's public methods docstrings bzr revid: rvo@tinyerp.co.in-20100406123028-1mroxby4v4ijbxtr --- bin/osv/orm.py | 97 +++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 29eab99a7d1..59f64d704d6 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -139,7 +139,7 @@ class browse_record(object): def __init__(self, cr, uid, id, table, cache, context=None, list_class = None, fields_process={}): ''' table : the object (inherited from orm) - context : a dictionary with an optional context + context : dictionary with an optional context ''' if not context: context = {} @@ -506,9 +506,9 @@ class orm_template(object): :param cr: database cursor :param user: current user id - :param select: id or a list of ids + :param select: id or list of ids :param context: context arguments, like lang, time zone - :rtype: object or a list of objects requested + :rtype: object or list of objects requested """ if not context: @@ -631,10 +631,10 @@ class orm_template(object): :param cr: database cursor :param uid: current user id - :param ids: a list of ids - :param fields_to_export: a list of fields + :param ids: list of ids + :param fields_to_export: list of fields :param context: context arguments, like lang, time zone, may contain import_comp(default: False) to make exported data compatible with import_data() - :rtype: a dictionary with a *datas* matrix + :rtype: dictionary with a *datas* matrix This method is used when exporting data via client menu @@ -673,15 +673,15 @@ class orm_template(object): :param cr: database cursor :param uid: current user id - :param ids: a list of ids - :param fields: a list of fields + :param ids: list of ids + :param fields: list of fields :param data: data to import :param mode: 'init' or 'update' for record creation :param current_module: module name :param noupdate: flag for record creation :param context: context arguments, like lang, time zone, :param filename: optional file to store partial import state for recovery - :rtype: a tuple + :rtype: tuple This method is used when importing data via client menu @@ -1362,9 +1362,9 @@ class orm_template(object): :param view_id: id of the view or None :param view_type: type of the view to return if view_id is None ('form', tree', ...) :param context: context arguments, like lang, time zone - :param toolbar: true to include concextual actions + :param toolbar: true to include contextual actions :param submenu: example (portal_project module) - :return: a dictionary describing the composition of the requested view (including inherited views and extensions) + :return: dictionary describing the composition of the requested view (including inherited views and extensions) :raise AttributeError: * if the inherited view has unknown position to work with other than 'before', 'after', 'inside', 'replace' * if some tag other than 'position' is found in parent view @@ -1934,22 +1934,22 @@ class orm(orm_template): def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): """ - Get the list of records in list view sorted by the given fields + Get the list of records in list view grouped by the given ``groupby`` fields :param cr: database cursor :param uid: current user id - :param domain: a list specifying search criteria [['field_name', 'operator', 'value'], ...] - :param fields: a list of fields present in the list view specified on the object - :param groupby: a list of fields on which to sort the records - :type fields_list: a list (example ['field_name_1', ...]) + :param domain: list specifying search criteria [['field_name', 'operator', 'value'], ...] + :param fields: list of fields present in the list view specified on the object + :param groupby: list of fields on which to groupby the records + :type fields_list: list (example ['field_name_1', ...]) :param offset: optional number of records to skip :param limit: optional max number of records to return :param context: context arguments, like lang, time zone - :return: a list of dictionaries(one dictionary for each record) containing: + :return: list of dictionaries(one dictionary for each record) containing: - * the values of fields sorted out by the fields in groupby arguement - * __domain: a list of tuples specifying the search criteria - * __context: a dictionary with argument like 'groupby' + * the values of fields grouped by the fields in ``groupby`` argument + * __domain: list of tuples specifying the search criteria + * __context: dictionary with argument like ``groupby`` :rtype: [{'field_name_1': value, ...] :raise AccessError: * if user has no read rights on the requested object * if user tries to bypass access rules for read on the requested object @@ -2035,7 +2035,7 @@ class orm(orm_template): Adds missing table select and join clause(s) for reaching the field coming from an '_inherits' parent table. - :param tables: a list of table._table names enclosed in double quotes as returned + :param tables: list of table._table names enclosed in double quotes as returned by _where_calc() """ @@ -2497,10 +2497,10 @@ class orm(orm_template): :param cr: database cursor :param uid: current user id - :param fields_list: a list of fields to get the default value - :type fields_list: a list (example ['field1','field2',]) + :param fields_list: list of fields to get the default value + :type fields_list: list (example ['field1', 'field2',]) :param context: context arguments, like lang, time zone - :return: a dictionary of the default values for fields (set on the object class, by the user preferences, or via the context) + :return: dictionary of the default values for fields (set on the object class, by the user preferences, or via the context) """ if not context: @@ -2599,9 +2599,9 @@ class orm(orm_template): :param cr: database cursor :param user: current user id - :param fields: a list of fields + :param fields: list of fields :param context: context arguments, like lang, time zone - :return: a dictionary of field dictionaries, each one describing a field of the business object + :return: dictionary of field dictionaries, each one describing a field of the business object :raise AccessError: * if user has no create/write rights on the requested object """ @@ -2616,11 +2616,11 @@ class orm(orm_template): :param cr: database cursor :param user: current user id - :param ids: id or a list of the ids of the records to read + :param ids: id or list of the ids of the records to read :param fields: optional list of field names to return (default: all fields would be returned) - :type fields: a list (example ['field_name_1', ...]) + :type fields: list (example ['field_name_1', ...]) :param context(optional, highly recommended): context arguments, like lang, time zone - :return: a list of dictionaries((a dictionary per record asked)) with requested field values + :return: list of dictionaries((dictionary per record asked)) with requested field values :rtype: [{‘name_of_the_field’: value, ...}, ...] :raise AccessError: * if user has no read rights on the requested object * if user tries to bypass access rules for read on the requested object @@ -2819,8 +2819,8 @@ class orm(orm_template): :param ids: id or list of ids :param context: context arguments, like lang, time zone :param details: if True, *_uid fields are replaced with the name of the user - :return: a list of ownership dictionaries for each requested record - :rtype: a list of dictionaries with the following keys: + :return: list of ownership dictionaries for each requested record + :rtype: list of dictionaries with the following keys: * id: object id * create_uid: user who created the record @@ -2872,7 +2872,8 @@ class orm(orm_template): def check_access_rule(self, cr, uid, ids, operation, context=None): """Verifies that the operation given by ``operation`` is allowed for the user according to ir.rules. - :param operation: one of ``'read'``, ``'write'``, ``'unlink'`` + + :param operation: one of ``write``, ``unlink`` :raise except_orm: * if current ir.rules do not permit this operation. :return: None if the operation is allowed """ @@ -2894,7 +2895,7 @@ class orm(orm_template): :param cr: database cursor :param uid: current user id - :param ids: id or a list of ids + :param ids: id or list of ids :param context(optional, highly recommended): context arguments, like lang, time zone :return: True :raise AccessError: * if user has no unlink rights on the requested object @@ -2957,7 +2958,7 @@ class orm(orm_template): :type user: integer (example 1) :param ids: id or list of ids :param vals: dictionary of field values to update - :type vals: dictionary (example {'field_name':'value', ...}) + :type vals: dictionary (example {'field_name': 'value', ...}) :param context(optional, highly recommended): context arguments, like lang, time zone :return: True :raise AccessError: * if user has no write rights on the requested object @@ -3165,10 +3166,10 @@ class orm(orm_template): :param cr: database cursor :param user: current user id :type user: integer (example 1) - :param vals: dictionary for new record {'field_name':field_value, ...} - :type vals: dictionary (example {'field_name':field_value, ...}) - :param context(optional, highly recommended): context arguements, like lang, time zone - :type context: dictionary (example {'lang':'en_us', ...}) + :param vals: dictionary for new record {'field_name': field_value, ...} + :type vals: dictionary (example {'field_name': field_value, ...}) + :param context(optional, highly recommended): context arguments, like lang, time zone + :type context: dictionary (example {'lang': 'en_us', ...}) :return: id of new record created :raise AccessError: * if user has no create rights on the requested object * if user tries to bypass access rules for create on the requested object @@ -3538,8 +3539,8 @@ class orm(orm_template): :param order: optional columns to sort by (default: self._order=id ) :param context(optional, highly recommended): context arguments, like lang, time zone :param count: if True, returns only the number of records matching the criteria, not their ids - :return: id or a list of ids of records matching the criteria - :rtype: integer or a list of integers + :return: id or list of ids of records matching the criteria + :rtype: integer or list of integers :raise AccessError: * if user tries to bypass access rules for read on the requested object. Operators: @@ -3602,7 +3603,7 @@ class orm(orm_template): :param cr: database cursor :param user: current user id :type user: integer (example 1) - :param ids: a list of ids + :param ids: list of ids :param context: context arguments, like lang, time zone :return: tuples with the text representation of requested objects for to-many relationships @@ -3622,11 +3623,11 @@ class orm(orm_template): :param cr: database cursor :param user: current user id :param name: object name to search - :param args: a list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...] + :param args: list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...] :param operator: operator for search criterion :param context: context arguments, like lang, time zone :param limit: optional max number of records to return - :return: a list of object names matching the search criteria, used to provide completition for to-many relationships + :return: list of object names matching the search criteria, used to provide completion for to-many relationships This method is equivalent of search() on name + name_get() @@ -3649,9 +3650,9 @@ class orm(orm_template): :param cr: database cursor :param user: current user id :param ids: id of the record to copy - :param default: a dictionary of field values to update before saving the duplicate object + :param default: dictionary of field values to update before saving the duplicate object :param context: context arguments, like lang, time zone - :return: a dictionary containing all the field values + :return: dictionary containing all the field values """ if not context: @@ -3731,8 +3732,8 @@ class orm(orm_template): :param cr: database cursor :param uid: current user id :param id: id of the record to copy - :param default: a dictionary of field values to update before saving the duplicate object - :type default: a dictionary (example {'field_name':field_value, ...}) + :param default: dictionary of field values to update before saving the duplicate object + :type default: dictionary (example {'field_name': field_value, ...}) :param context: context arguments, like lang, time zone :return: True @@ -3756,7 +3757,7 @@ class orm(orm_template): :param cr: database cursor :param uid: current user id - :param ids: a list of ids of records + :param ids: list of ids of records :param parent: parent field name :return: True or False based on recursion detection """ From 848bb74da6e23c865d644904034d8b98dc1a6e11 Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Thu, 8 Apr 2010 16:12:05 +0530 Subject: [PATCH 08/34] Improved rng grammer for default attribute in filters bzr revid: hda@tinyerp.com-20100408104205-zr8psx28wvw1e3eb --- bin/addons/base/res/partner/partner_view.xml | 4 ++-- bin/addons/base/rng/view.rng | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/addons/base/res/partner/partner_view.xml b/bin/addons/base/res/partner/partner_view.xml index 8c374acb80b..7f0c599db87 100644 --- a/bin/addons/base/res/partner/partner_view.xml +++ b/bin/addons/base/res/partner/partner_view.xml @@ -347,8 +347,7 @@ - + @@ -365,6 +364,7 @@ ir.actions.act_window res.partner form + {"search_default_supplier":supplier} diff --git a/bin/addons/base/rng/view.rng b/bin/addons/base/rng/view.rng index 09b1080e7cf..9ee1f1b213d 100644 --- a/bin/addons/base/rng/view.rng +++ b/bin/addons/base/rng/view.rng @@ -552,7 +552,6 @@ - From 48fbb228f15c73bcb1f497e95df68abe50fcd9f3 Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Thu, 8 Apr 2010 16:58:02 +0530 Subject: [PATCH 09/34] Improved search view to remove default values bzr revid: hda@tinyerp.com-20100408112802-zvihm7znl1mv3cqc --- addons/account/report/account_invoice_report_view.xml | 3 +-- addons/crm/crm_meeting_view.xml | 3 --- addons/hr_holidays/hr_holidays_view.xml | 8 +++----- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 2 +- addons/sale/sale_view.xml | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 2f2c7239454..5976a4fb5fc 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -76,8 +76,7 @@ + domain="[('type','=','out_invoice')]"/> diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index 9d4888329fb..b01beb55342 100755 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -259,9 +259,6 @@ - diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 25e1d9e8f40..69b53af4bf2 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -10,10 +10,9 @@ - + - + @@ -30,8 +29,7 @@ - + diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 580fc64638f..d04571fcfe2 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -181,7 +181,7 @@ - + diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index aaf23f21ebc..22d8a52b74d 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -428,7 +428,7 @@ - + From b3a31c8c05ba82b8412995330512ecdd08175af3 Mon Sep 17 00:00:00 2001 From: Julien Thewys Date: Thu, 8 Apr 2010 15:22:07 +0200 Subject: [PATCH 10/34] [FIX] Fixed test definition according to new convention. bzr revid: jth@openerp.com-20100408132207-3umbxhxa1l2zho0l --- addons/account/__terp__.py | 4 +++- addons/account/{demo => test}/price_accuracy00.yml | 0 2 files changed, 3 insertions(+), 1 deletion(-) rename addons/account/{demo => test}/price_accuracy00.yml (100%) diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index 1fe6bd355bd..bfa5f8fb47b 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -79,13 +79,15 @@ module named account_voucherss 'report/account_report_view.xml', ], 'demo_xml': [ - #'demo/price_accuracy00.yml', 'account_demo.xml', 'project/project_demo.xml', 'project/analytic_account_demo.xml', 'demo/account_minimal.xml', 'account_unit_test.xml', ], + 'test': [ + 'test/price_accuracy00.yml', + ], 'installable': True, 'active': False, 'certificate': '0080331923549', diff --git a/addons/account/demo/price_accuracy00.yml b/addons/account/test/price_accuracy00.yml similarity index 100% rename from addons/account/demo/price_accuracy00.yml rename to addons/account/test/price_accuracy00.yml From 269acb4ad6091640126b1c707066a97b330c08b4 Mon Sep 17 00:00:00 2001 From: Julien Thewys Date: Thu, 8 Apr 2010 15:44:04 +0200 Subject: [PATCH 11/34] [FIX] Fixed NameError. bzr revid: jth@openerp.com-20100408134404-aopxy9z033d6kcrx --- bin/tools/yaml_import.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/tools/yaml_import.py b/bin/tools/yaml_import.py index e77999a49f1..961630afed4 100644 --- a/bin/tools/yaml_import.py +++ b/bin/tools/yaml_import.py @@ -399,10 +399,10 @@ class YamlInterpreter(object): param_model = self.get_model(param.get('model', model)) if 'search' in param: q = eval(param['search'], self.eval_context) - ids = param_model.search(cr, uid, q) + ids = param_model.search(self.cr, self.uid, q) value = self._get_first_result(ids) elif 'eval' in param: - local_context = {'obj': lambda x: param_model.browse(self.cr, self.uid, x, context)} + local_context = {'obj': lambda x: param_model.browse(self.cr, self.uid, x, self.context)} local_context.update(self.id_map) value = eval(param['eval'], self.eval_context, local_context) else: From 64ffd5e8b7a701876fdea722d0ecd033d9d6e87e Mon Sep 17 00:00:00 2001 From: Julien Thewys Date: Thu, 8 Apr 2010 15:52:00 +0200 Subject: [PATCH 12/34] [REF] Fixed Eval test. bzr revid: jth@openerp.com-20100408135200-kd65p1u42ixyyn4d --- bin/tools/yaml_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tools/yaml_import.py b/bin/tools/yaml_import.py index 961630afed4..67cc58b67c1 100644 --- a/bin/tools/yaml_import.py +++ b/bin/tools/yaml_import.py @@ -590,7 +590,7 @@ class YamlInterpreter(object): _, fields = node.items()[0] res = {} for fieldname, expression in fields.items(): - if isinstance(expression, Eval): + if is_eval(expression): value = eval(expression.expression, self.eval_context) else: value = expression From fc9bf8716a91e01a40dbcd93e2177672d4aeefc7 Mon Sep 17 00:00:00 2001 From: Julien Thewys Date: Thu, 8 Apr 2010 19:23:33 +0200 Subject: [PATCH 13/34] [FIX] Ensure a failing test do not stop the server unless it has ERROR severity/level. [FIX] Load tests only if demo data are present. bzr revid: jth@openerp.com-20100408172333-1g3g4nfy6m81m4zw --- bin/addons/__init__.py | 3 +-- bin/tools/config.py | 2 +- bin/tools/yaml_tag.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 4dd62f11694..60850c16ff8 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -724,8 +724,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): load_demo_xml(cr, m, idref, mode) load_demo(cr, m, idref, mode) cr.execute('update ir_module_module set demo=%s where id=%s', (True, mid)) - - load_test(cr, m, idref, mode) + load_test(cr, m, idref, mode) package_todo.append(package.name) diff --git a/bin/tools/config.py b/bin/tools/config.py index 670c20af1af..18e9f61373e 100644 --- a/bin/tools/config.py +++ b/bin/tools/config.py @@ -77,7 +77,7 @@ class configmanager(object): 'secure' : False, 'syslog' : False, 'log_level': logging.INFO, - 'assert_exit_level': logging.WARNING, # level above which a failed assert will be raised + 'assert_exit_level': logging.ERROR, # level above which a failed assert will be raised 'cache_timeout': 100000, 'login_message': False, 'list_db' : True, diff --git a/bin/tools/yaml_tag.py b/bin/tools/yaml_tag.py index 97b29db1ac0..cdc892d9b80 100644 --- a/bin/tools/yaml_tag.py +++ b/bin/tools/yaml_tag.py @@ -15,7 +15,7 @@ class YamlTag(object): return "<%s %s>" % (self.__class__.__name__, sorted(self.__dict__.items())) class Assert(YamlTag): - def __init__(self, model, id, severity=logging.ERROR, string="NONAME", **kwargs): + def __init__(self, model, id, severity=logging.WARNING, string="NONAME", **kwargs): self.model = model self.id = id self.severity = severity @@ -29,7 +29,7 @@ class Record(YamlTag): super(Record, self).__init__(**kwargs) class Python(YamlTag): - def __init__(self, model, severity=logging.ERROR, name="", **kwargs): + def __init__(self, model, severity=logging.WARNING, name="", **kwargs): self.model= model self.severity = severity self.name = name From 51298798ef9c58252a113938f2159de3d2b454f8 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 8 Apr 2010 22:12:54 +0200 Subject: [PATCH 14/34] [IMP] removed unused file bzr revid: fp@tinyerp.com-20100408201254-6k0d6wtgw2ztq81g --- addons/account/test/test_parent_structure.py | 54 ------------------- addons/account/test/test_parent_structure.yml | 11 +++- 2 files changed, 9 insertions(+), 56 deletions(-) delete mode 100644 addons/account/test/test_parent_structure.py diff --git a/addons/account/test/test_parent_structure.py b/addons/account/test/test_parent_structure.py deleted file mode 100644 index ba27d91c87c..00000000000 --- a/addons/account/test/test_parent_structure.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- 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 . -# -############################################################################## - -# -# TODO: move this in a YAML test with !python tag -# - -import xmlrpclib - -DB = 'training3' -USERID = 1 -USERPASS = 'admin' - - -sock = xmlrpclib.ServerProxy('http://%s:%s/xmlrpc/object' % ('localhost',8069)) - -ids = sock.execute(DB, USERID, USERPASS, 'account.account', 'search', [], {}) -account_lists = sock.execute(DB, USERID, USERPASS, 'account.account', 'read', ids, ['parent_id','parent_left','parent_right']) - -accounts = dict(map(lambda x: (x['id'],x), account_lists)) -for a in account_lists: - if a['parent_id']: - assert a['parent_left'] > accounts[a['parent_id'][0]]['parent_left'] - assert a['parent_right'] < accounts[a['parent_id'][0]]['parent_right'] - assert a['parent_left'] < a['parent_right'] - for a2 in account_lists: - assert not ((a2['parent_right']>a['parent_left']) and - (a2['parent_left']a['parent_left']) and (a2['parent_right'] parent_right of all childs + . if an account is a child it is included in parent_left-parent_right + . if an account is not a child it is not included in parent_left-parent_right - !python {model: account.account}: | ids = self.search(cr, uid, []) From f6c1339c773e6614b1763ace9b05657b8e22bca1 Mon Sep 17 00:00:00 2001 From: Julien Thewys Date: Thu, 8 Apr 2010 22:18:54 +0200 Subject: [PATCH 15/34] [REF] !python block test should not impose 'self': just use 'model' to reference model. bzr revid: jth@openerp.com-20100408201854-curxhua4ms2bgmfv --- bin/tools/yaml_import.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/tools/yaml_import.py b/bin/tools/yaml_import.py index 67cc58b67c1..76fc2e442ca 100644 --- a/bin/tools/yaml_import.py +++ b/bin/tools/yaml_import.py @@ -348,7 +348,8 @@ class YamlInterpreter(object): python, statements = node.items()[0] model = self.get_model(python.model) statements = statements.replace("\r\n", "\n") - code_context = {'self': model, 'cr': self.cr, 'uid': self.uid, 'log': log, 'context': self.context} + code_context = {'model': model, 'cr': self.cr, 'uid': self.uid, 'log': log, 'context': self.context} + code_context.update({'self': model}) # remove me when no !python block test uses 'self' anymore try: code = compile(statements, self.filename, 'exec') eval(code, {'ref': self.get_id}, code_context) From f4cdf72ea3605cb08dcdc389dee404fdbff3efb7 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 8 Apr 2010 22:36:37 +0200 Subject: [PATCH 16/34] [IMP] mrp workflows bzr revid: fp@tinyerp.com-20100408203637-jatmtejrcg55eb7g --- addons/mrp/mrp_workflow.xml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml index 8be8f97b5d9..377fa790b70 100644 --- a/addons/mrp/mrp_workflow.xml +++ b/addons/mrp/mrp_workflow.xml @@ -163,8 +163,7 @@ produce - subflow - + function action_produce_assign_product() @@ -180,8 +179,7 @@ buy - subflow - + function action_po_assign() @@ -308,26 +306,16 @@ - - - - subflow.cancel - subflow.cancel - - - - subflow.cancel - - subflow.done + @@ -337,12 +325,14 @@ - subflow.delivery_done + - action_check_finnished() + action_check_finnished() or (not move_id) + stock.move + [move_id.id] From 7b8ec4c46d01a49b68e0ee9e2f4e0847ff8a5795 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 9 Apr 2010 01:10:41 +0200 Subject: [PATCH 17/34] [IMP] improving stock operations bzr revid: fp@tinyerp.com-20100408231041-9r7eg9k48reka8zx --- addons/mrp/mrp_view.xml | 4 +- addons/stock/security/ir.model.access.csv | 4 +- addons/stock/stock.py | 44 --------- addons/stock/stock_view.xml | 60 +----------- addons/stock/wizard/stock_partial_move.py | 108 ++++++++++------------ 5 files changed, 55 insertions(+), 165 deletions(-) diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index c215ff13fb0..83ae9ea4e55 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -808,7 +808,7 @@ - + @@ -896,7 +896,7 @@ + sequence="5" /> Procurement Exceptions diff --git a/addons/stock/security/ir.model.access.csv b/addons/stock/security/ir.model.access.csv index e7269d542f2..5622557e834 100644 --- a/addons/stock/security/ir.model.access.csv +++ b/addons/stock/security/ir.model.access.csv @@ -36,8 +36,6 @@ "access_stock_invoice_onshipping","stock.invoice.onshipping","model_stock_invoice_onshipping","stock.group_stock_user",1,0,0,0 "access_stock_location_product","stock.location.product","model_stock_location_product","stock.group_stock_user",1,0,0,0 "access_report_stock_picking","report.stock.picking","model_report_stock_picking","stock.group_stock_user",1,0,0,0 -"access_stock_delivery","stock.delivery","model_stock_delivery","stock.group_stock_user",1,0,0,0 - "access_stock_traceability_upstream","stock.traceability.upstream","model_stock_traceability_upstream","stock.group_stock_user",1,0,0,0 "access_stock_traceability_downstream","stock.traceability.downstream","model_stock_traceability_downstream","stock.group_stock_user",1,0,0,0 "access_stock_traceability_lot_upstream","stock.traceability.lot.upstream","model_stock_traceability_lot_upstream","stock.group_stock_user",1,0,0,0 @@ -46,4 +44,4 @@ "access_stock_partial_move","stock.partial.move","model_stock_partial_move","stock.group_stock_user",1,0,0,0 "access_stock_picking_make","stock.picking.make","model_stock_picking_make","stock.group_stock_user",1,0,0,0 "access_stock_inventory_merge","stock.inventory.merge","model_stock_inventory_merge","stock.group_stock_user",1,0,0,0 -"access_stock_change_standard_price","stock.change.standard.price","model_stock_change_standard_price","stock.group_stock_user",1,0,0,0 \ No newline at end of file +"access_stock_change_standard_price","stock.change.standard.price","model_stock_change_standard_price","stock.group_stock_user",1,0,0,0 diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 94fab1dacec..7d8fd5b97c1 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -492,7 +492,6 @@ class stock_picking(osv.osv): 'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date", method=True, store=True, type='datetime', string='Max. Expected Date', select=2), 'move_lines': fields.one2many('stock.move', 'picking_id', 'Entry lines', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}), - 'delivery_line':fields.one2many('stock.delivery', 'picking_id', 'Delivery lines', readonly=True), 'auto_picking': fields.boolean('Auto-Picking'), 'address_id': fields.many2one('res.partner.address', 'Partner', help="Address of partner"), 'invoice_state': fields.selection([ @@ -877,7 +876,6 @@ class stock_picking(osv.osv): """ res = {} move_obj = self.pool.get('stock.move') - delivery_obj = self.pool.get('stock.delivery') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') users_obj = self.pool.get('res.users') @@ -1003,14 +1001,6 @@ class stock_picking(osv.osv): delivered_pack_id = pick.id delivered_pack = self.browse(cr, uid, delivered_pack_id, context=context) - delivery_id = delivery_obj.create(cr, uid, { - 'name': delivered_pack.name, - 'partner_id': partner_id, - 'address_id': address_id, - 'date': delivery_date, - 'picking_id' : pick.id, - 'move_delivered' : [(6,0, map(lambda x:x.id, delivered_pack.move_lines))] - }, context=context) res[pick.id] = {'delivered_picking': delivered_pack.id or False} return res @@ -1112,26 +1102,6 @@ class stock_production_lot_revision(osv.osv): stock_production_lot_revision() -class stock_delivery(osv.osv): - - """ Tracability of partialdeliveries """ - - _name = "stock.delivery" - _description = "Delivery" - _columns = { - 'name': fields.char('Name', size=60, required=True), - 'date': fields.datetime('Date', required=True), - 'partner_id': fields.many2one('res.partner', 'Partner', required=True), - 'address_id': fields.many2one('res.partner.address', 'Address', required=True), - 'move_delivered':fields.one2many('stock.move', 'delivered_id', 'Move Delivered'), - 'picking_id': fields.many2one('stock.picking', 'Picking list'), - - } -stock_delivery() -# ---------------------------------------------------- -# Move -# ---------------------------------------------------- - # # Fields: # location_dest_id is only used for predicting futur stocks @@ -1211,7 +1181,6 @@ class stock_move(osv.osv): 'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Orders"), 'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"), 'move_stock_return_history': fields.many2many('stock.move', 'stock_move_return_history', 'move_id', 'return_move_id', 'Move Return History',readonly=True), - 'delivered_id': fields.many2one('stock.delivery', 'Product delivered'), 'scraped': fields.boolean('Scraped'), } _constraints = [ @@ -1803,7 +1772,6 @@ class stock_move(osv.osv): """ res = {} picking_obj = self.pool.get('stock.picking') - delivery_obj = self.pool.get('stock.delivery') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') users_obj = self.pool.get('res.users') @@ -1909,18 +1877,6 @@ class stock_move(osv.osv): done_move_ids = [] for move in complete: done_move_ids.append(move.id) - if move.picking_id.id not in ref: - delivery_id = delivery_obj.create(cr, uid, { - 'partner_id': partner_id, - 'address_id': address_id, - 'date': delivery_date, - 'name' : move.picking_id.name, - 'picking_id': move.picking_id.id - }, context=context) - ref[move.picking_id.id] = delivery_id - delivery_obj.write(cr, uid, ref[move.picking_id.id], { - 'move_delivered' : [(4,move.id)] - }) return done_move_ids stock_move() diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 1ac6d340334..230819b355e 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1034,9 +1034,6 @@