Browse Source

[MIG] module onchange_helper to v10.0

pull/750/head
Alexis de Lattre 8 years ago
parent
commit
71e037395e
  1. 8
      onchange_helper/README.rst
  2. 3
      onchange_helper/__init__.py
  3. 14
      onchange_helper/__manifest__.py
  4. 15
      onchange_helper/__openerp__.py
  5. 3
      onchange_helper/models/__init__.py
  6. 10
      onchange_helper/models/ir_rule.py

8
onchange_helper/README.rst

@ -6,7 +6,7 @@
Onchange Helper Onchange Helper
=============== ===============
This is a technical module. Its goal is to ease the play of onchange method directly called from python file.
This is a technical module. Its goal is to ease the play of onchange method directly called from Python code.
Usage Usage
===== =====
@ -20,14 +20,10 @@ Example if you want to create a sale order and you want to get the values relati
`vals = {'partner_id: 1'}` `vals = {'partner_id: 1'}`
`vals = self.env['sale.order'].play_onchange(vals, ['partner_id'])`
`vals = self.env['sale.order'].play_onchanges(vals, ['partner_id'])`
Then, `vals` will be updated with partner_invoice_id, partner_shipping_id, pricelist_id, etc... Then, `vals` will be updated with partner_invoice_id, partner_shipping_id, pricelist_id, etc...
For further information, please visit:
* https://www.odoo.com/forum/help-1
Bug Tracker Bug Tracker
=========== ===========

3
onchange_helper/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models from . import models

14
onchange_helper/__manifest__.py

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# © 2016-2017 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{'name': 'Onchange Helper',
'version': '10.0.1.0.0',
'summary': 'Technical module that ease execution of onchange in Python code',
'author': 'Akretion,Camptocamp,Odoo Community Association (OCA)',
'website': 'http://www.akretion.com',
'license': 'AGPL-3',
'category': 'Generic Modules',
'depends': ['base'],
'installable': True,
}

15
onchange_helper/__openerp__.py

@ -1,15 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{'name': 'Onchange Helper',
'version': '9.0.1.0.0',
'author': 'Akretion,Camp2camp,Odoo Community Association (OCA)',
'website': 'www.akretion.com',
'license': 'AGPL-3',
'category': 'Generic Modules',
'depends': [
'base',
],
'installable': True,
}

3
onchange_helper/models/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import ir_rule from . import ir_rule

10
onchange_helper/models/ir_rule.py

@ -1,7 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# © 2016-2017 Akretion (http://www.akretion.com)
# © 2016-2017 Camptocamp (http://www.camptocamp.com/)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
from odoo import api, models
def get_new_values(model, record, on_change_result): def get_new_values(model, record, on_change_result):
@ -44,7 +46,7 @@ def play_onchanges(self, values, onchange_fields):
class IrRule(models.Model): class IrRule(models.Model):
_inherit = 'ir.rule' _inherit = 'ir.rule'
def _setup_complete(self, cr, uid):
def _setup_complete(self):
if not hasattr(models.BaseModel, 'play_onchanges'): if not hasattr(models.BaseModel, 'play_onchanges'):
setattr(models.BaseModel, 'play_onchanges', play_onchanges) setattr(models.BaseModel, 'play_onchanges', play_onchanges)
return super(IrRule, self)._setup_complete(cr, uid)
return super(IrRule, self)._setup_complete()
Loading…
Cancel
Save