Hi Sean,

This is not a bug, everything is working as expected in the framework:
- Translations are based on the name of the report, so you can use different 
translations for the same term in different reports. If you define a new report 
with a different name, the translations are not shared.
- You also can't define several reports with the same name, due to the way the 
report service endpoint works. So that is forbidden, as expected.

Your problem is that you're registering the report twice when you
instantiate report_sxw.report_sxw() a second time. This is not correct
and not supported. Before registering the new report, you could try to
unregister the previous one in your python code, as you really mean to
replace it. Something like Service.remove('report.payslip.pdf') in
6.1/trunk should do the trick.

In the future we should look for a way to allow report objects to use
the same inheritance mechanism as normal ORM objects, or possibly merge
them... but that is a long-term idea.

Thanks,

** Changed in: openobject-server
       Status: Confirmed => Invalid

** Changed in: openobject-server
   Importance: Low => Undecided

** Changed in: openobject-server
     Assignee: OpenERP's Framework R&D (openerp-dev-framework) => (unassigned)

-- 
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 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

_______________________________________________
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