0

I have two type of sale 1)Direct sale and 2) Indirect sale, while printing in delivery slip I need to get Direct and indirect sale separately, I achieve this by using two section in RML report, one for direct sale and another for indirect sale, the problem is when I select two record i.e indirect and direct, it print last selected record in single pdf, So how to restrict this and print both the selected record in separate pdf,

Here is my RML code,

<story>
<pto>
<section>
<para style="terp_default_8">[[(sale_name() == 'INDIRECT SALE' and removeParentNode('para')) or removeParentNode('section')]] </para>
 ...............
 ...............
 </section>
<para style="terp_default_8">[[(sale_name() == 'DIRECT SALE' and removeParentNode('para')) or removeParentNode('section')]] </para>
 ...............
 ...............
 </section> 
 </pto>
 <story>

1 Answers1

0

sale_name() is a method so you need to code in report.py file. And use global variable like self.name_type1 For example

self.name_type1 = so1_type1.order_type

Now method code like

def _sale_name(self):
    #here is can put your code like whatever condition
    if self.name_type1 == 'indirectsale':
        return 'INDIRECT SALE'
    else:
        return 'DIRECT SALE'

You can also pass argument in sale_name() method.

Hope this will help you.

Bhavesh Odedra
  • 10,990
  • 12
  • 33
  • 58
  • [link](http://stackoverflow.com/questions/26374303/browse-another-model-in-openerp-depending-upon-the-active-ids?noredirect=1#comment41405909_26374303) here is my full code along with function – Vigneshwaran Thenraj Oct 15 '14 at 07:55
  • just change variable name_type1 to `self.name_type1` after than code will work. – Bhavesh Odedra Oct 15 '14 at 07:59
  • sorry sir, no dice. The problem is list of record should return, but it take the last record and print number of time for all the selected record @odedra – Vigneshwaran Thenraj Oct 15 '14 at 08:13
  • that question to the answer is in link i think, In this question you ask about How to check condition RML report? I'm given that answer. – Bhavesh Odedra Oct 15 '14 at 09:11