Created
November 23, 2016 09:06
-
-
Save ilyasProgrammer/5cf31d5da3e1c5059e0f30d6fbdcd926 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@api.model | |
def default_get(self, fields): | |
res = super(Report, self).default_get(fields) | |
if self._context.get('task_id', False): | |
res['task_id'] = self._context['task_id'] | |
task = self.env['project.task'].browse(res['task_id']) | |
brl = self.env['bm.report.lines'] | |
report_lines = [] | |
for l in task.pricing_ids: | |
report_line = brl.create({ | |
'pricing_id': l.pricing_id.id, | |
'amount': l.amount, | |
'labor_vol': l.labor_vol, | |
'mech_vol': l.mech_vol, | |
}) | |
report_lines.append(report_line.id) | |
res['lines_ids'] = report_lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment