Is it possible to use 'model_context' to switch between models

Hi PEOPLE there;

I want to verify things if it’s possible, I have Tryton version 5.2 and Tryton version 6 , In the menu Balance sheet and Income statement of the tryton 6 from the module account, there was a “type_statement.fodt” that i can print it easily, what i want is make this happen in version 5.2 , everything is good i have adapt the code related to this record;

1/I have create a class AccountTypeStatement in account.py then save this class in “init.py”
2/make the “company.py”
2/I have create a record on account.xml

→ everything is good when i have tried to print this “type_statement.fodt” and there is no error displayed , but there was something wrong but i do no where, because no date shown in the printout when i go to the menu -->Balance sheet, the same for the menu “Income statement” there was no “Fiscal Year” or start date or end date displayed on the printout;

it seems to me that this part of code in “type_statement.fodt” it’s not be readen

 <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;choose&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;when test=&quot;data.get(&apos;model_context&apos;) == &apos;account.income_statement.context&apos;&quot;&gt;</text:placeholder></text:p>
   <text:p text:style-name="P28">Income Statement</text:p>
   <text:p text:style-name="P24"><text:span text:style-name="T1">Fiscal Year: </text:span><text:placeholder text:placeholder-type="text">&lt;ctx.fiscalyear.rec_name&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;ctx.start_period or ctx.end_period&quot;&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:span text:style-name="T1">From Period</text:span>: <text:placeholder text:placeholder-type="text">&lt;ctx.start_period.name if ctx.start_period else &apos;&apos;&gt;</text:placeholder><text:s/><text:span text:style-name="T2">To</text:span> <text:placeholder text:placeholder-type="text">&lt;ctx.end_period.name if ctx.end_period else &apos;&apos;&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;ctx.from_date or ctx.to_date&quot;&gt;</text:placeholder></text:p>
   <text:p text:style-name="P25">From Date: <text:placeholder text:placeholder-type="text">&lt;format_date(ctx.from_date, user.language) if ctx.from_date else &apos;&apos;&gt;</text:placeholder><text:s/>To <text:placeholder text:placeholder-type="text">&lt;format_date(ctx.to_date, user.language) if ctx.to_date else &apos;&apos;&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;/when&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;when test=&quot;data.get(&apos;model_context&apos;) in [&apos;account.balance_sheet.context&apos;, &apos;account.balance_sheet.comparision.context&apos;]&quot;&gt;</text:placeholder></text:p>
   <text:p text:style-name="P28">Balance Sheet</text:p>
   <text:p text:style-name="P26">Date: <text:placeholder text:placeholder-type="text">&lt;format_date(ctx.date, user.language) if ctx.date else &apos;&apos;&gt;</text:placeholder></text:p>
   <text:p text:style-name="P24"><text:placeholder text:placeholder-type="text">&lt;/when&gt;</text:placeholder></text:p>

I want to verify is it normal to use the term 'model_context' in the version 5.2 like in version 6 or is there other thing i should do !

Thanks in advance

Please note that templates usee the features available on newer series and there is no such guarantee that such features exist on old versions. That may be the cause that your report is not working as expected on older series.

Please note that version 5.2 is no longer supported (for some days already). I will recomend you updating to 6.0 series (or newer one) so you will get the report as part of the standard setup.