Search 1.9 billion lines of Odoo code on GitHub

base_patch_models_mixin

Author: Therp BV, Odoo Community Association (OCA)
License: AGPL-3
Branch: 9.0-add-base_patch_models_mixin
Repository: ForgeFlow/server-tools
Dependencies: base
Languages: Python (68, 58.1%), and reStructuredText (49, 41.9%)

<a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg"> </a> <a name="base-patch-models-mixin"></a> <h2>Base Patch Models Mixin</h2> <p>This module adds a mixin class which is meant to simplify working with patches on BaseModel or on abstract models like <code>mail .thread</code>. If you just change them, models created earlier will lack the attributes you add. Just inherit from this mixin, it will check which existing models need your changes and apply them.</p> <a name="configuration"></a> <h3>Configuration</h3> <p>In your module, do something like:</p> <pre> <code>class MailThread(models.AbstractModel): _name = 'mail.thread' _inherit = ['base.patch.models.mixin', 'mail.thread']</code> </pre> <p>in case you need to patch BaseModel, say:</p> <pre> <code>class BaseModel(models.BaseModel): _name = 'my.unique.model.name' _inherit = 'base.patch.models.mixin'</code> </pre> <p>Your code will behave as if it was an inherited class of the class you pass in the second parameter to <code>_base_patch_models</code>.</p> <a name="usage"></a> <h3>Usage</h3> <a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/149/9.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a> <a name="known-issues-roadmap"></a> <h3>Known issues / Roadmap</h3> <ul class="simple"> <li>This module must not be ported to v10.0 as the issue does not exist anymore in such version or greater.</li> </ul> <a name="bug-tracker"></a> <h3>Bug Tracker</h3> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback.</p> <a name="credits"></a> <h3>Credits</h3> <a name="images"></a> <h4>Images</h4> <ul class="simple"> <li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li> </ul> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li> <li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;eficent.com">lois.rilo&#64;eficent.com</a>&gt;</li> </ul> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="maintainer"></a> <h4>Maintainer</h4> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>This module is maintained by the OCA.</p> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>