Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3227 Переглядів

I am using following function to fetch records in my report.

def get_records(self):

    recsss = self.pool.get('overtime_oms_bcube.overtime_oms_bcube').search(self.cr,self.uid, [], context=self.context) resss = self.pool.get('overtime_oms_bcube.overtime_oms_bcube').browse(self.cr, self.uid, recsss) return resss

and calling the records by following way:

<t t-set="i" t-value="1"/>

<tr t-foreach="get_records()" t-as="data">

<td style="display:none"> <t t-esc="i"/> <t t-set="i" t-value="i+1"/> </td>

<td t-esc="data['employee_code']"></td>

<td t-esc="data['employee'].name"></td>

<td t-esc="data['employee'].job_id.name"></td>

<td t-esc="data['no_of_days']"></td>

<td t-esc="data['employee'].contract_id.wage"></td>

<td t-esc="data['employee'].contract_id.wage*0.64516129"></td>

</tr>

The problem is that the resulting report is showing all the records saved in the data base. I want it to show only those records which are selected in the tree view.

enter image description hereAnd even in if we are in the single record view and generate a report, it still shows all the record but according to the flow it need to generate a report of that record from where we are generating that report.

please suggest something that helps in such requirement. Thanks in advance.

Аватар
Відмінити
Найкраща відповідь

You can use context because it always contains active record ids in it.


def get_records(self):
    recsss = self.pool.get('overtime_oms_bcube.overtime_oms_bcube').search(self.cr,self.uid,context.get('active_ids'), context=self.context)

    resss = self.pool.get('overtime_oms_bcube.overtime_oms_bcube').browse(self.cr, self.uid, recsss) return resss

 

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
лют. 17
9157
2
лют. 24
5381
2
вер. 24
1909
2
лип. 23
6283
1
черв. 23
4316