← Back to team overview

credativ team mailing list archive

[Bug 893474] Re: Translations not working after overwrite a report

 

@Equipo OPENTIA: I think the case you describe is different, here you
are removing module data and re-creating later. The problem is that the
link between a translation and the resource it translates is established
during the initial module import. When you re-create that resource, the
link is not reconnected. This is quite a low priority issue, but if you
can reproduce it, please feel free to report a separate bug for that. It
would be even better if you can make a patch (merge proposal) for
improving the translation system to support this uncommon use case.

-- 
You received this bug notification because you are a member of OpenERP
Framework Experts, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/893474

Title:
  Translations not working after overwrite a report

Status in OpenERP Server:
  Invalid

Bug description:
  After overwriting an existing report, the translation will not work.

  For example, I need to rewrite the template of payslip.pdf, the
  following definition works well:

  <report auto="False" id="hr_payroll.salary_payslip" model="hr.payslip"
  			name="payslip.pdf" rml="mymodule/report/payslip.rml" string="Employee PaySlip" />

  But there is also a method has to be override in payslip_report class,
  so I create a new class to extend it like this:

  from datetime import datetime
  from hr_payroll.report.report_payslip import payslip_report

  class payslip_report(payslip_report):

      def get_month(self, obj):
          return datetime.strptime(obj.date, '%Y-%m-%d').strftime('%Y-%m')

  As we know, to make it effect, we must register it with report_sxw:

  report_sxw.report_sxw('report.payslip.pdf', 'hr.payslip',
  'mymodule/report/payslip.rml', parser=payslip_report)

  This brings the error: The report "report.payslip.pdf" already exists!

  Then I change both report definition and register name to
  'report.my.payslip.pdf', but the translation never works.

  Look into report relative classes, I realize the name is used for
  searching translation table in report_sxw._translate method.

  Any solution?

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/893474/+subscriptions