# How to override a class method without \_\_name\_\_ attribute (model, wizard or report)?

**URL:** https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058
**Category:** Developer
**Created:** [December 9, 2019, 5:45pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058 "2019-12-09T17:45:54Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![frflores](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/f/ba8739/32.png) [@frflores](https://discuss.tryton.org/u/frflores)
#### Post date: [December 9, 2019, 5:45pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/1 "2019-12-09T17:45:54Z")

</div>

Hi guys!,  
I’m trying to make a customization to put an additional property in tryton configuration file… in order to do so I want to override the RecordTagHandler::characters method (in the convert.py file) in my custom module…  
I found a good guide on how to override models, wizards or reports …however I’ve not found so far any clue on how to override (or filter) a method in a class like this… I don’t even know if that is possible… any guidance?

BR,

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [December 9, 2019, 7:38pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/2 "2019-12-09T19:38:02Z")

</div>

There is no mean for such customization.  
You should maybe explain what you try to achieve, they may be other ways or it could be considered as a new feature that could be implemented in standard.

---

<div class="post-metadata">

### Author: ![frflores](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/f/ba8739/32.png) [@frflores](https://discuss.tryton.org/u/frflores)
#### Post date: [December 9, 2019, 7:55pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/3 "2019-12-09T19:55:02Z")

</div>

Thank you Cedric!..  
What I’m trying to do is to have several instances of tryton… each with its own database and sharing a common code base (every instance symlinked to that common code base in order to avoid files duplication)… however I want to allow every instance to have customized reports… therefore the “standard location” for the report is not an option since one instance would overwrite the other one…

what I’ve done is to include a new config file attribute that points to the reports-templates location (for each instance)… but so far I’ve modified a couple of official methods (RecordTagHandler::characters and ActionReport::get\_report\_content) what I know is not a good practice from updates management point of view… so the idea is to have a module that overrides those methods …

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [December 9, 2019, 11:02pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/4 "2019-12-09T23:02:02Z")

</div>

> [@frflores](#):
>
> each with its own database and sharing a common code base (every instance symlinked to that common code base in order to avoid files duplication)

You can start different processes from the same code base, there is no need for symlinks.

> [@frflores](#):
>
> however I want to allow every instance to have customized reports… therefore the “standard location” for the report is not an option since one instance would overwrite the other one

Customized report can be stored in the database directly by editing the `ir.action.report`. The template in the database has priority over the file.  
Also you can have custom module activated only for a specific database.

---

<div class="post-metadata">

### Author: ![SISalp](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sisalp/32/200_2.png) [@SISalp](https://discuss.tryton.org/u/SISalp)
#### Post date: [December 13, 2019, 9:06am UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/5 "2019-12-13T09:06:00Z")

</div>

> [@frflores](#):
>
> every instance symlinked

If you need start many instances and modify code directory for each one, you may prefer hard links instead. As explained, reports are not the stake.  
I’ve done so in a far past but today my multi-tenants (several hundreds per admin unit) have fully replicated code and it is not a problem, even on SSDs.

---

<div class="post-metadata">

### Author: ![frflores](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/f/ba8739/32.png) [@frflores](https://discuss.tryton.org/u/frflores)
#### Post date: [December 14, 2019, 3:03pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/6 "2019-12-14T15:03:34Z")

</div>

Thank you Dominique!.. I appreciate your advice, I will explore that option… I originally considered but I was afraid of the upgrade process (n times)… however in the other side that can be considered an advantage if I don’t want to upgrade all instances at the same time…

How had been your experience on that regard?

BR,  
Francisco

---

<div class="post-metadata">

### Author: ![SISalp](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sisalp/32/200_2.png) [@SISalp](https://discuss.tryton.org/u/SISalp)
#### Post date: [December 15, 2019, 11:28am UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/7 "2019-12-15T11:28:38Z")

</div>

All depends on the service you plan and the number of services you need. My solution initially targets 50\<n\<10000 segment and the main constraint is that end users decide on the versions and the customs.

It is fully automated, so updating the code is not a problem. Updating databases is more tricky because it may fail. It needs a detection and a backward path.

---

<div class="post-metadata">

### Author: ![frflores](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/f/ba8739/32.png) [@frflores](https://discuss.tryton.org/u/frflores)
#### Post date: [December 21, 2019, 4:07pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/8 "2019-12-21T16:07:59Z")

</div>

Thank you very much Dominique, I really appreciate your advice!..

BR,

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [January 20, 2020, 4:08pm UTC](https://discuss.tryton.org/t/how-to-override-a-class-method-without-name-attribute-model-wizard-or-report/2058/9 "2020-01-20T16:08:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
