From 26bb219a74ca586de0f935e544991a9202da311f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Wed, 24 Mar 2010 17:12:16 +0100 Subject: [PATCH 001/148] [IMP] wording: "customize" intead of "customise" lp bug: https://launchpad.net/bugs/546138 fixed bzr revid: ls@numerigraphe.fr-20100324161216-uvzz3vrr3s3vth5e --- bin/osv/orm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 165b9a21137..bcd05438a7b 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1222,7 +1222,7 @@ class orm_template(object): for field in fields_def: if field == 'id': - # sometime, the view may containt the (invisible) field 'id' needed for a domain (when 2 objects have cross references) + # sometime, the view may contain the (invisible) field 'id' needed for a domain (when 2 objects have cross references) fields['id'] = {'readonly': True, 'type': 'integer', 'string': 'ID'} elif field in fields: fields[field].update(fields_def[field]) @@ -1232,7 +1232,7 @@ class orm_template(object): model = res[0][1] res.insert(0, ("Can't find field '%s' in the following view parts composing the view of object model '%s':" % (field, model), None)) msg = "\n * ".join([r[0] for r in res]) - msg += "\n\nEither you wrongly customised this view, or some modules bringing those views are not compatible with your current data model" + msg += "\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model" netsvc.Logger().notifyChannel('orm', netsvc.LOG_ERROR, msg) raise except_orm('View error', msg) return arch, fields From 25a424a89d32e4485ae1e120c1d8b2ada216800e Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Wed, 24 Mar 2010 17:32:22 +0100 Subject: [PATCH 002/148] [REF] 'children' instead of 'childs' lp bug: https://launchpad.net/bugs/327259 fixed bzr revid: ls@numerigraphe.fr-20100324163222-dj03gxme8sawtdmz --- bin/addons/base/module/module.py | 4 ++-- bin/osv/orm.py | 10 +++++----- bin/report/print_xml.py | 2 +- bin/report/render/rml2pdf/trml2pdf.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 01ea8cc0745..223a9ac1e42 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -46,8 +46,8 @@ class module_category(osv.osv): result = dict(cr.fetchall()) for id in ids: cr.execute('select id from ir_module_category where parent_id=%s', (id,)) - childs = [c for c, in cr.fetchall()] - result[id] = reduce(lambda x,y:x+y, [result.get(c, 0) for c in childs], result.get(id, 0)) + children = [c for c, in cr.fetchall()] + result[id] = reduce(lambda x,y:x+y, [result.get(c, 0) for c in children], result.get(id, 0)) return result _columns = { diff --git a/bin/osv/orm.py b/bin/osv/orm.py index bcd05438a7b..3d2e3d7a748 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1085,7 +1085,7 @@ class orm_template(object): context = {} result = False fields = {} - childs = True + children = True if node.tag == 'field': if node.get('name'): @@ -1100,7 +1100,7 @@ class orm_template(object): if column: relation = column._obj - childs = False + children = False views = {} for f in node: if f.tag in ('form', 'tree', 'graph'): @@ -1159,7 +1159,7 @@ class orm_template(object): if trans: node.set('sum', trans) - if childs: + if children: for f in node: fields.update(self.__view_look_dom(cr, user, f, view_id, context)) @@ -1966,8 +1966,8 @@ class orm(orm_template): where += ' order by '+self._parent_order cr.execute('SELECT id FROM '+self._table+' WHERE '+where) pos2 = pos + 1 - childs = cr.fetchall() - for id in childs: + children = cr.fetchall() + for id in children: pos2 = browse_rec(id[0], pos2) cr.execute('update '+self._table+' set parent_left=%s, parent_right=%s where id=%s', (pos,pos2,root)) return pos2+1 diff --git a/bin/report/print_xml.py b/bin/report/print_xml.py index 2c24d3766f3..a45270447e1 100644 --- a/bin/report/print_xml.py +++ b/bin/report/print_xml.py @@ -253,7 +253,7 @@ class document(object): for el_cld in node: self.parse_node(el_cld, el, v) else: - # if there is no "type" attribute in the node, copy it to the xml data and parse its childs + # if there is no "type" attribute in the node, copy it to the xml data and parse its children if not node.tag == etree.Comment: if node.tag == parent.tag: el = parent diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py index 0574f563c90..02352b44cc7 100644 --- a/bin/report/render/rml2pdf/trml2pdf.py +++ b/bin/report/render/rml2pdf/trml2pdf.py @@ -489,8 +489,8 @@ class _rml_flowable(object): return rc1 def _table(self, node): - childs = utils._child_get(node,self,'tr') - if not childs: + children = utils._child_get(node,self,'tr') + if not children: return None length = 0 colwidths = None @@ -498,7 +498,7 @@ class _rml_flowable(object): data = [] styles = [] posy = 0 - for tr in childs: + for tr in children: paraStyle = None if tr.get('style'): st = copy.deepcopy(self.styles.table_styles[tr.get('style')]) From f9b199fa5fea39ae09cb52a593f4ddb4bb80d449 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Thu, 22 Jul 2010 15:28:35 +0200 Subject: [PATCH 003/148] [FIX] mutable default in ir lp bug: https://launchpad.net/bugs/525808 fixed bzr revid: ls@numerigraphe.fr-20100722132835-ffr0k22jcl1rfoqd --- bin/ir/ir.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ir/ir.py b/bin/ir/ir.py index 109faf95872..c4cc435765d 100644 --- a/bin/ir/ir.py +++ b/bin/ir/ir.py @@ -31,7 +31,7 @@ def ir_del(cr, uid, id): obj = pooler.get_pool(cr.dbname).get('ir.values') return obj.unlink(cr, uid, [id]) -def ir_get(cr, uid, key, key2, models, meta=False, context={}, res_id_req=False): +def ir_get(cr, uid, key, key2, models, meta=False, context=None, res_id_req=False): obj = pooler.get_pool(cr.dbname).get('ir.values') res = obj.get(cr, uid, key, key2, models, meta=meta, context=context, res_id_req=res_id_req) return res From 70fd90d33b2ebb25519d89b3505f616d2b6f7fa1 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Thu, 22 Jul 2010 15:49:48 +0200 Subject: [PATCH 004/148] [FIX] mutable default in osv lp bug: https://launchpad.net/bugs/525808 fixed bzr revid: ls@numerigraphe.fr-20100722134948-5axugpkr0nwbda2a --- bin/osv/fields.py | 16 ++++++++-------- bin/osv/orm.py | 34 +++++++++++++++++----------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 3ef167600eb..851f5d4d432 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -63,7 +63,7 @@ class _column(object): _symbol_set = (_symbol_c, _symbol_f) _symbol_get = None - def __init__(self, string='unknown', required=False, readonly=False, domain=None, context={}, states=None, priority=0, change_default=False, size=None, ondelete="set null", translate=False, select=False, **args): + def __init__(self, string='unknown', required=False, readonly=False, domain=None, context=None, states=None, priority=0, change_default=False, size=None, ondelete="set null", translate=False, select=False, **args): self.states = states or {} self.string = string self.readonly = readonly @@ -75,7 +75,7 @@ class _column(object): self.ondelete = ondelete self.translate = translate self._domain = domain or [] - self._context = context + self._context = context or {} self.write = False self.read = False self.view_load = 0 @@ -375,7 +375,7 @@ class one2many(_column): assert(self.change_default != True) def get_memory(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): - if not context: + if context is None: context = {} if self._context: context = context.copy() @@ -734,7 +734,7 @@ class function(_column): class related(function): - def _fnct_search(self, tobj, cr, uid, obj=None, name=None, domain=None, context={}): + def _fnct_search(self, tobj, cr, uid, obj=None, name=None, domain=None, context=None): self._field_get2(cr, uid, obj, context) i = len(self._arg)-1 sarg = name @@ -750,7 +750,7 @@ class related(function): i -= 1 return [(self._arg[0], 'in', sarg)] - def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None): + def _fnct_write(self, obj, cr, uid, ids, field_name, values, args, context=None): if values and field_name: self._field_get2(cr, uid, obj, context) relation = obj._name @@ -835,7 +835,7 @@ class related(function): # TODO: improve here to change self.store = {...} according to related objects pass - def _field_get2(self, cr, uid, obj, context={}): + def _field_get2(self, cr, uid, obj, context=None): if self._relations: return obj_name = obj._name @@ -855,10 +855,10 @@ class related(function): # --------------------------------------------------------- class dummy(function): - def _fnct_search(self, tobj, cr, uid, obj=None, name=None, domain=None, context={}): + def _fnct_search(self, tobj, cr, uid, obj=None, name=None, domain=None, context=None): return [] - def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None): + def _fnct_write(self, obj, cr, uid, ids, field_name, values, args, context=None): return False def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None): diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 2ecca2aa3c6..4d63bdd805a 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -126,13 +126,11 @@ class browse_record_list(list): class browse_record(object): logger = netsvc.Logger() - def __init__(self, cr, uid, id, table, cache, context=None, list_class = None, fields_process={}): + def __init__(self, cr, uid, id, table, cache, context=None, list_class=None, fields_process=None): ''' table : the object (inherited from orm) context : dictionary with an optional context ''' - if not context: - context = {} self._list_class = list_class or browse_record_list self._cr = cr self._uid = uid @@ -141,8 +139,8 @@ class browse_record(object): self._table_name = self._table._name self.__logger = logging.getLogger( 'osv.browse_record.' + self._table_name) - self._context = context - self._fields_process = fields_process + self._context = context or {} + self._fields_process = fields_process or {} cache.setdefault(table._name, {}) self._data = cache[table._name] @@ -400,14 +398,16 @@ class orm_template(object): context=context ) - def view_init(self, cr , uid , fields_list, context=None): + def view_init(self, cr, uid, fields_list, context=None): """Override this method to do specific things when a view on the object is opened.""" pass def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): raise NotImplementedError(_('The read_group method is not implemented on this object !')) - def _field_create(self, cr, context={}): + def _field_create(self, cr, context=None): + if context is None: + context = {} cr.execute("SELECT id FROM ir_model WHERE model=%s", (self._name,)) if not cr.rowcount: cr.execute('SELECT nextval(%s)', ('ir_model_id_seq',)) @@ -492,8 +492,8 @@ class orm_template(object): continue cr.commit() - def _auto_init(self, cr, context={}): - self._field_create(cr, context) + def _auto_init(self, cr, context=None): + self._field_create(cr, context=context) def __init__(self, cr): if not self._name and not hasattr(self, '_inherit'): @@ -509,7 +509,7 @@ class orm_template(object): if not self._table: self._table = self._name.replace('.', '_') - def browse(self, cr, uid, select, context=None, list_class=None, fields_process={}): + def browse(self, cr, uid, select, context=None, list_class=None, fields_process=None): """ Fetch records as objects allowing to use dot notation to browse fields and relations @@ -520,8 +520,6 @@ class orm_template(object): :rtype: object or list of objects requested """ - if not context: - context = {} self._list_class = list_class or browse_record_list cache = {} # need to accepts ints and longs because ids coming from a method @@ -529,7 +527,7 @@ class orm_template(object): if isinstance(select, (int, long)): return browse_record(cr, uid, select, self, cache, context=context, list_class=self._list_class, fields_process=fields_process) elif isinstance(select, list): - return self._list_class([browse_record(cr, uid, id, self, cache, context=context, list_class=self._list_class, fields_process=fields_process) for id in select], context) + return self._list_class([browse_record(cr, uid, id, self, cache, context=context, list_class=self._list_class, fields_process=fields_process) for id in select], context=context) else: return browse_null() @@ -1018,7 +1016,7 @@ class orm_template(object): def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): raise NotImplementedError(_('The read method is not implemented on this object !')) - def get_invalid_fields(self,cr,uid): + def get_invalid_fields(self, cr, uid): return list(self._invalids) def _validate(self, cr, uid, ids, context=None): @@ -1409,14 +1407,14 @@ class orm_template(object): return arch - def __get_default_search_view(self, cr, uid, context={}): + def __get_default_search_view(self, cr, uid, context=None): def encode(s): if isinstance(s, unicode): return s.encode('utf8') return s - view = self.fields_view_get(cr, uid, False, 'form', context) + view = self.fields_view_get(cr, uid, False, 'form', context=context) root = etree.fromstring(encode(view['arch'])) res = etree.XML("" % root.get("string", "")) @@ -2228,7 +2226,9 @@ class orm(orm_template): if column['attnotnull']: cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" DROP NOT NULL' % (self._table, column['attname'])) - def _auto_init(self, cr, context={}): + def _auto_init(self, cr, context=None): + if context is None: + context = {} store_compute = False logger = netsvc.Logger() create = False From 666c4ec067ca4ecb1bf7dbb6c4cdd5ff3a58032a Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Thu, 22 Jul 2010 15:54:36 +0200 Subject: [PATCH 005/148] [FIX] mutable default in tools lp bug: https://launchpad.net/bugs/525808 fixed bzr revid: ls@numerigraphe.fr-20100722135436-grgj7vow495q65vf --- bin/tools/convert.py | 2 +- bin/tools/copy.py | 4 +++- bin/tools/pdf_utils.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 973e762cd2e..20f54e15f11 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -598,7 +598,7 @@ form: module.record_id""" % (xml_id,) self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', 'tree_but_open', 'Menuitem', [('ir.ui.menu', int(pid))], action, True, True, xml_id=rec_id) return ('ir.ui.menu', pid) - def _assert_equals(self, f1, f2, prec = 4): + def _assert_equals(self, f1, f2, prec=4): return not round(f1 - f2, prec) def _tag_assert(self, cr, rec, data_node=None): diff --git a/bin/tools/copy.py b/bin/tools/copy.py index e6583dcfadf..badd4d51fc5 100644 --- a/bin/tools/copy.py +++ b/bin/tools/copy.py @@ -164,7 +164,7 @@ d[types.InstanceType] = _copy_inst del d -def deepcopy(x, memo=None, _nil=[]): +def deepcopy(x, memo=None, _nil=None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. @@ -172,6 +172,8 @@ def deepcopy(x, memo=None, _nil=[]): if memo is None: memo = {} + if _nil is None: + _nil = {} d = id(x) y = memo.get(d, _nil) diff --git a/bin/tools/pdf_utils.py b/bin/tools/pdf_utils.py index 4782e544429..0286b9cf46d 100644 --- a/bin/tools/pdf_utils.py +++ b/bin/tools/pdf_utils.py @@ -58,7 +58,7 @@ trailer %%EOF """ -def output_field( f ): +def output_field(f): return "\xfe\xff" + "".join( [ "\x00"+c for c in f ] ) def extract_keys(lines): From ded63ab87a17f5de2c098092147345ae80b4b16b Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Mon, 18 Oct 2010 13:03:00 +0530 Subject: [PATCH 006/148] [IMP]:lunch:improved lunch order bzr revid: apa@tinyerp.com-20101018073300-z9dy97lvf37501jk --- addons/lunch/report/order.py | 7 +++- addons/lunch/report/order.rml | 76 +++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/addons/lunch/report/order.py b/addons/lunch/report/order.py index 29c9d381745..11ca7f79dbc 100644 --- a/addons/lunch/report/order.py +++ b/addons/lunch/report/order.py @@ -41,8 +41,12 @@ class order(report_sxw.rml_parse): total=0.0 for line in lines: total+=line.price + self.net_total+=total return total + def get_nettotal(self): + return self.net_total + def get_users(self, objects): users=[] for obj in objects: @@ -52,12 +56,13 @@ class order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(order, self).__init__(cr, uid, name, context) - + self.net_total=0.0 self.localcontext.update({ 'time': time, 'get_lines': self.get_lines, 'get_users': self.get_users, 'get_total': self.get_total, + 'get_nettotal': self.get_nettotal, }) report_sxw.report_sxw('report.lunch.order', 'lunch.order', diff --git a/addons/lunch/report/order.rml b/addons/lunch/report/order.rml index d47816abd9c..ba66dcddb03 100644 --- a/addons/lunch/report/order.rml +++ b/addons/lunch/report/order.rml @@ -14,25 +14,28 @@ - + - - + + + + + + - - + @@ -63,9 +66,14 @@ + + + + + @@ -84,16 +92,10 @@ Lunch Order - -
- [[repeatIn(get_users(objects),'o')]] - + - Name - - - Date + Name/Date Order @@ -107,28 +109,43 @@
- [[ repeatIn(get_lines(o,objects),'lines') ]] - + [[repeatIn(get_users(objects),'o')]] + - [[ (lines.user_id and lines.user_id.name) or '']] + [[ o.name ]] - [[ formatLang(lines.date,date='True') ]] + + + - [[ (lines.product and lines.product.name) or '' ]] - - - [[ lines.descript]] - - - [[ lines.price ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]] + [[ formatLang(get_total(o,objects)) ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]] +
+ [[ repeatIn(get_lines(o,objects),'lines') ]] + + + + [[ formatLang(lines.date,date='True') ]] + + + [[ (lines.product and lines.product.name) or '' ]] + + + [[ lines.descript]] + + + [[ lines.price ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]] + + + +
- + @@ -136,16 +153,15 @@ - Total: + Total : - [[ formatLang(get_total(o,objects)) ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]] + [[ formatLang(get_nettotal()) ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]] - + -
- + \ No newline at end of file From bcb28bba174d93a47485c4a40c194399a14b4351 Mon Sep 17 00:00:00 2001 From: saz-OpenERP Date: Mon, 18 Oct 2010 13:07:48 +0530 Subject: [PATCH 007/148] [IMP]:mrp:Improves the graph view of futureload on workcenter in Production dashboard bzr revid: azaz.201186@gmail.com-20101018073748-ozojp5g0e6t4iq3l --- addons/mrp/report/mrp_report.py | 4 ++-- addons/mrp/report/mrp_report_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mrp/report/mrp_report.py b/addons/mrp/report/mrp_report.py index d677184586e..68487527966 100644 --- a/addons/mrp/report/mrp_report.py +++ b/addons/mrp/report/mrp_report.py @@ -39,7 +39,7 @@ class report_workcenter_load(osv.osv): create or replace view report_workcenter_load as ( SELECT min(wl.id) as id, - to_char(p.date_planned,'YYYY:IW') as name, + to_char(p.date_planned,'YYYY:mm:dd') as name, SUM(wl.hour) AS hour, SUM(wl.cycle) AS cycle, wl.workcenter_id as workcenter_id @@ -49,7 +49,7 @@ class report_workcenter_load(osv.osv): ON p.id = wl.production_id GROUP BY wl.workcenter_id, - to_char(p.date_planned,'YYYY:IW') + to_char(p.date_planned,'YYYY:mm:dd') )""") report_workcenter_load() diff --git a/addons/mrp/report/mrp_report_view.xml b/addons/mrp/report/mrp_report_view.xml index db628eb5431..aee3578a632 100644 --- a/addons/mrp/report/mrp_report_view.xml +++ b/addons/mrp/report/mrp_report_view.xml @@ -22,7 +22,7 @@ graph - + From 7fcb24882557563a7122eb60364d8dbfe0f0754c Mon Sep 17 00:00:00 2001 From: vro Date: Mon, 18 Oct 2010 16:21:15 +0530 Subject: [PATCH 008/148] [Added graph views in Admin Dashboard] bzr revid: vro@tinyerp.com-20101018105115-rl9v3iaixl2yn01l --- addons/board/board.py | 8 ++ addons/board/board_administration_view.xml | 105 ++++++++++++++++++++- 2 files changed, 112 insertions(+), 1 deletion(-) diff --git a/addons/board/board.py b/addons/board/board.py index 230954d942b..9cc660181ab 100644 --- a/addons/board/board.py +++ b/addons/board/board.py @@ -223,4 +223,12 @@ class board_note(osv.osv): board_note() +class temp_log(osv.osv_memory): + _inherit = 'res.log' + _description = 'Temporary Log' + _columns = {'count': fields.integer("Count")} + _defaults = {'count': lambda *a: True} + +temp_log() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/board/board_administration_view.xml b/addons/board/board_administration_view.xml index 86222cbad43..cf031f8641b 100644 --- a/addons/board/board_administration_view.xml +++ b/addons/board/board_administration_view.xml @@ -50,8 +50,111 @@ form - + + + + + + board.res.log.graph + res.log + graph + + + + + + + + + board.res.log.tree + res.log + tree + + + + + + + + + Monthly Activity per Document + res.log + form + graph,tree + + + + + tree + + + + + + graph + + + + + + + board.weekly.res.log.graph + res.log + graph + + + + + + + + + board.weekly.res.log.tree + res.log + tree + + + + + + + + + Weekly Global Activity + res.log + form + graph,tree + + + + + tree + + + + + + graph + + + + + + board.admin.graphs.form + board.board + form + + + + + + + + + + From 9724d2f09f379961b484b85a595cd951f2f56ea2 Mon Sep 17 00:00:00 2001 From: rch Date: Mon, 18 Oct 2010 17:12:15 +0530 Subject: [PATCH 009/148] [IMP]: Fix Menu problem. bzr revid: rch@rch-desktop-20101018114215-rsem6t2hx3es7uzs --- addons/board/board_administration_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/board/board_administration_view.xml b/addons/board/board_administration_view.xml index cf031f8641b..9c30e02ca9c 100644 --- a/addons/board/board_administration_view.xml +++ b/addons/board/board_administration_view.xml @@ -50,9 +50,9 @@ form - - + From e14dc253faa27be1ac39c6524cb9f895b61a35b5 Mon Sep 17 00:00:00 2001 From: saz-OpenERP Date: Tue, 19 Oct 2010 11:17:54 +0530 Subject: [PATCH 010/148] [IMP]:account:Improves the account vat declaration report bzr revid: azaz.201186@gmail.com-20101019054754-ihta11qh64sxbtk7 --- addons/account/report/account_tax_report.py | 13 +- addons/account/report/account_tax_report.rml | 257 ++++++++++++------- addons/account/wizard/account_vat.py | 3 +- addons/account/wizard/account_vat_view.xml | 9 +- 4 files changed, 179 insertions(+), 103 deletions(-) diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/account_tax_report.py index d968ee9029e..c245e735d65 100644 --- a/addons/account/report/account_tax_report.py +++ b/addons/account/report/account_tax_report.py @@ -24,13 +24,15 @@ import copy import rml_parse from report import report_sxw +from common_report_header import common_report_header -class tax_report(rml_parse.rml_parse): +class tax_report(rml_parse.rml_parse, common_report_header): _name = 'report.account.vat.declaration' def __init__(self, cr, uid, name, context={}): super(tax_report, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, + 'get_account': self._get_account, 'get_period': self._get_period, 'get_codes': self._get_codes, 'get_general': self._get_general, @@ -41,9 +43,16 @@ class tax_report(rml_parse.rml_parse): }) + +# def _get_account(self, form): +# if data['model']=='account.account': +# return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name +# return super(tax_report ,self)._get_account(form) + + def get_years(self,form): res={} - fiscal_year_name = self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear']) + fiscal_year_name = self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear_id']) if fiscal_year_name: res['fname'] = fiscal_year_name[0][1] diff --git a/addons/account/report/account_tax_report.rml b/addons/account/report/account_tax_report.rml index 47df92cc3bc..52f19147ef2 100644 --- a/addons/account/report/account_tax_report.rml +++ b/addons/account/report/account_tax_report.rml @@ -2,34 +2,7 @@ @@ -37,97 +10,191 @@
+ + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + - Tax Statement - - + + + + - Year : [[ get_years(data['form'])['fname'] ]] - - - Periods : [[ get_years(data['form'])['periods'] or removeParentNode('tr')]] + + Tax Report + - - - - Tax Name - Debit - Credit - Tax Amount - - - [[ repeatIn(get_lines(data['form']['based_on'],data['form']['periods'],data['form']['company_id']), 'o') ]][[ (o['level']) ]] [[ (len(o['level'])<5 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ o['code'] ]] [[ o['name'] ]] - [[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]] - [[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['credit']) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['credit'])]] - [[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] [[ company.currency_id.symbol ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] [[ company.currency_id.symbol ]] - - + + + + + + + Chart of Account + + + Compute Method + + + Periods + + + Printing Date + + + + + + + [[ get_account(data) or removeParentNode('para') ]] + + + [[data['form']['based_on'] ]] + + + [[ get_years(data['form'])['periods'] or removeParentNode('para')]] + + + [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]] at [[ time.strftime('%H:%M:%S')]] + + + + + + + + + + + + + Tax Name + + + Debit + + + Credit + + + Tax Amount + + + + + + +
+ [[ repeatIn(get_lines(data['form']['based_on'],data['form']['periods'],data['form']['company_id']), 'o') ]] + + + + [[ '...'*len(o['level']) ]] [[o['type']==1 and ( setTag('para','para',{'fontName':'Helvetica-Bold'}))]] [[ o['code'] ]] [[ o['name'] ]] + + + [[ len(o['level'])==2 and setTag('para','para',{'fontName':"Helvetica-Bold"}) ]] [[ formatLang(o['debit']) ]] + + + [[ len(o['level'])==2 and setTag('para','para',{'fontName':"Helvetica-Bold"}) ]] [[ formatLang(o['credit'])]] + + + [[ len(o['level'])==2 and setTag('para','para',{'fontName':"Helvetica-Bold"}) ]] [[ formatLang(o['tax_amount']) ]] + + + + + + +
+ + +
diff --git a/addons/account/wizard/account_vat.py b/addons/account/wizard/account_vat.py index 0c33517d428..10868c9dfb6 100644 --- a/addons/account/wizard/account_vat.py +++ b/addons/account/wizard/account_vat.py @@ -26,12 +26,13 @@ class account_vat_declaration(osv.osv_memory): _description = 'Account Vat Declaration' _inherit = "account.common.account.report" _columns = { + 'chart_account_id': fields.many2one('account.account', 'Chart of account', help='Select Charts of Accounts', required=True, domain = [('parent_id','=',False)]), 'based_on': fields.selection([('invoices','Invoices'), ('payments','Payments'),], 'Based On', required=True), 'company_id': fields.many2one('res.company', 'Company', required=True), 'periods': fields.many2many('account.period', 'vat_period_rel', 'vat_id', 'period_id', 'Periods', help="All periods if empty"), - 'fiscalyear': fields.many2many('account.fiscalyear','vat_fiscal_rel','fiscal_id','Fiscal Year',required=True), + 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'), } def _get_company(self, cr, uid, context={}): diff --git a/addons/account/wizard/account_vat_view.xml b/addons/account/wizard/account_vat_view.xml index 41c0faa2c79..704a2ac7529 100644 --- a/addons/account/wizard/account_vat_view.xml +++ b/addons/account/wizard/account_vat_view.xml @@ -8,14 +8,13 @@ form
- - - + + + + - -