Community mailing list archives
community@mail.odoo.com
Browse archives
Re: Dynamic / conditional module dependencies
byPerhaps slightly better explained asreturn resdef your_special_method_inherited_from_sales(self):ctx = dict(self._context)flag = ctx.get({'your_explicit_flag': True})if flag:do_something before calling super if neededres = super(YourClass, self).your_special_method_inherited_from_sales()
if flag:
do_something after super like appending to res if neededOn Thu, Jun 30, 2016 at 10:21 AM, Nhomar Hernandez <nhomar@vauxoo.com> wrote:On Wed, Jun 29, 2016 at 2:42 PM, Mohamed M. Hagag <mohamedhagag1981@gmail.com> wrote:Dears,
In many cases we want to build a module that affects for ex. sale, product and POS.
but we don't want the functions that affect POS to be executed in case that POS is not installed.
the way we can build a general module that doesn't depend on POS but affects it if only installed.
How can we achieve this behaviour in odoo 8 or 9 without building module for sale and another for POS ?
Regards,
You can use an installed validator it is technically feasible, but, bad things happen, What I recommend is work with some kind of hooks or contextual validations.def your_especial_method_inherited_from_sales(self):ctx = dict(self._context)flag = ctx.get({'your_explicit_flag': True})if flag:do_something and append to resreturn super(YourClass, self).your_especial_method_inherited_from_sales()In that way your methods will be more object oriented.In the 99% of cases when you need to do what you describe (do an If Module Installed) you are making a design crime functionally speaking.regards.--Nhomar HernandezCEO Vauxoo.Site: http://vauxoo.comTwitter: @nhomarBlog: http://nhomar.comGithub User: https://github.com/nhomarOdoo Gold PartnerSkype: nhomar00 (Envia mail previo no lo superviso siempre).HangOut: nhomar@vauxoo.com_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
Reference
-
Dynamic / conditional module dependencies
byMohamed Hagag-
-
-
Re: Dynamic / conditional module dependencies
byOpen For Small Business Ltd, Graeme Gellatly -
Re: Dynamic / conditional module dependencies
byVauxoo S.A. de C.V., Nhomar Hernandez -
-
-