Merge lp:~igudym/openobject-server/table-styles-server into lp:openobject-server/5.0

Proposed by Ivan Gudym
Status: Rejected
Rejected by: Olivier Dony (Odoo)
Proposed branch: lp:~igudym/openobject-server/table-styles-server
Merge into: lp:openobject-server/5.0
Diff against target: 40 lines (+23/-0)
1 file modified
bin/report/preprocess.py (+23/-0)
To merge this branch: bzr merge lp:~igudym/openobject-server/table-styles-server
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+23618@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello,

This is interesting, but please resubmit your changes for trunk, as we cannot merge any improvement on 5.0.

Thanks!

Unmerged revisions

2038. By Ivan Gudym

Fix table styles, Fixed colspan attrib, Blocktable background fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/report/preprocess.py'
2--- bin/report/preprocess.py 2009-06-30 13:36:26 +0000
3+++ bin/report/preprocess.py 2010-04-17 19:32:22 +0000
4@@ -50,6 +50,8 @@
5 while n.tag not in match:
6 n = n.getparent()
7 n.set('rml_loop', txt.group(2))
8+ if n.tag == 'tr':
9+ self.fix_table_style(n)
10 return '[['+txt.group(1)+"''"+txt.group(4)+']]'
11 t = _regex1.sub(_sub1, node.text)
12 if t == " ":
13@@ -59,6 +61,27 @@
14 self.preprocess_rml(node,type)
15 return root_node
16
17+ def fix_table_style(self, row):
18+ table = row.getparent()
19+ loop = table.index(row)
20+ num_rows = len(table)
21+ root = table.getroottree()
22+ tableStyle = root.find(".//blockTableStyle[@id='%s']" % table.get("style"))
23+ for s in tableStyle:
24+ if s.tag in ["lineStyle", "blockSpan", "blockBackground"]:
25+ b_col, b_row = self.parse_startstop(s.get('start'))
26+ e_col, e_row = self.parse_startstop(s.get('stop'))
27+ if b_row > loop:
28+ b_row = b_row - num_rows
29+ if e_row >= loop:
30+ e_row = e_row - num_rows
31+ s.set("start", "%d,%d" % (b_col, b_row))
32+ s.set("stop", "%d,%d" % (e_col, e_row))
33+
34+ def parse_startstop(self, line):
35+ p = line.split(",")
36+ return int(p[0]), int(p[1])
37+
38 if __name__=='__main__':
39 node = etree.XML('''<story>
40 <para>This is a test[[ setTag('para','xpre') ]]</para>