← Back to team overview

openerp-dev-web team mailing list archive

Re: [Merge] lp:~openerp-dev/openobject-server/trunk-bug-640677-nco into lp:openobject-server

 

What happens if self.localcontext is False? newtext won't be defined...

*1*: yes, you are right here. it should be like this:
@@ -795,10 +795,10 @@
                         return False
                 else:
                     import base64
+                    newtext = node.text
                     if self.localcontext:
-                        newtext = utils._process_text(self, node.text or '')
-                        node.text = newtext
-                    image_data = base64.decodestring(node.text)
+                        newtext = utils._process_text(self, newtext or '')
+                    image_data = base64.decodestring(newtext)
                 if not image_data:
                     self._logger.debug("No inline image data")
                     return False



What's wrong with the line node.text = newtext? Is node.text reused later and we don't want to touch it?
*2*: The *node* here is an etree object used as a generator whose original * text * should not be modified the original text for the node here is the expressions like * [[ line.photo ]] * so this expression text should be kept as it is to be used for other records. The bug here was that the original text (the expression) was replaced by the first record's image value so for the rest of the lines the same image will be shown.

Can you tell me how to reproduce the bug?

To test this you need to  add a binary field in say for eg: sale order line. add that field in its form view too, to select some image. also add the same field in the sale_order.rml in * <image>* tag  now create a SO with 2 SO lines add different image in both the lines, now print the order.. you will notice that the image selected in the first line is being repeated on both the lines..

where as it should display the image that is selected in each line.
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-640677-nco/+merge/61564
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-server/trunk-bug-640677-nco.


References