Public bug reported:

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?

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP Project Group.
https://bugs.launchpad.net/bugs/893474

Title:
  Translations not working after overwrite a report

Status in OpenERP Addons (modules):
  New

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-addons/+bug/893474/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~c2c-oerpscenario
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~c2c-oerpscenario
More help   : https://help.launchpad.net/ListHelp

Reply via email to