Browse Source

[8.0][FIX] Make sure module pos_default_empty_image correctly and completely loaded. (#167)

* [FIX] Make sure inherit on product.template really loaded.

* [FIX] Changes according to remark by Sylvain Le Gal.
pull/183/head
Ronald Portier 7 years ago
committed by Rafael Blasco
parent
commit
1652963d79
  1. 1
      pos_default_empty_image/README.rst
  2. 3
      pos_default_empty_image/__init__.py
  3. 2
      pos_default_empty_image/__openerp__.py
  4. 3
      pos_default_empty_image/models/__init__.py
  5. 16
      pos_default_empty_image/models/product_product.py

1
pos_default_empty_image/README.rst

@ -64,6 +64,7 @@ Contributors
* Hparfr <https://github.com/hparfr> `Akretion <https://akretion.com>`_
* Sylvain LE GAL <https://twitter.com/legalsylvain>
* Ronald Portier <ronald@therp.nl>
See also this module `pos_improve_images from GRAP
<https://github.com/grap/odoo-addons-grap/tree/7.0/pos_improve_images>`_ for OpenERP 7.

3
pos_default_empty_image/__init__.py

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

2
pos_default_empty_image/__openerp__.py

@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'POS Default empty image',
'version': '8.0.0.1.0',
'version': '8.0.0.1.1',
'category': 'Point Of Sale',
'summary': 'Optimise load time for products with no image',
'author': "Akretion, GRAP, Odoo Community Association (OCA)",

3
pos_default_empty_image/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import product_product

16
pos_default_empty_image/product.py → pos_default_empty_image/models/product_product.py

@ -1,20 +1,20 @@
# -*- coding: utf-8 -*-
# © <2015> <Akretion, GRAP, OCA>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
from openerp import models, fields, api
class ProductTemplate(models.Model):
_inherit = ['product.template']
class ProductProduct(models.Model):
_inherit = ['product.product']
@api.multi
@api.depends('field.image')
def _has_image(self):
@api.depends('image')
def _compute_has_image(self):
for record in self:
record.has_image = bool(record.image)
has_image = fields.Boolean(
compute='_has_image',
compute='_compute_has_image',
store=True,
readonly=True)
readonly=True,
)
Loading…
Cancel
Save