Browse Source
[FIX] set has_image on 'product.product' model
[FIX] set has_image on 'product.product' model
[IMP] make has_image stored [REF] improve description and add screenshots [REF] OCA conventionpull/351/head
Sylvain LE GAL
8 years ago
10 changed files with 76 additions and 76 deletions
-
58pos_default_empty_image/README.rst
-
2pos_default_empty_image/models/__init__.py
-
16pos_default_empty_image/models/product.py
-
18pos_default_empty_image/models/product_product.py
-
BINpos_default_empty_image/static/description/pos_display_default.png
-
BINpos_default_empty_image/static/description/pos_display_improved.png
-
25pos_default_empty_image/static/src/css/pos_default_empty_image.css
-
17pos_default_empty_image/static/src/js/db.js
-
13pos_default_empty_image/static/src/js/widgets.js
-
3pos_default_empty_image/views/templates.xml
@ -1 +1 @@ |
|||
from . import product |
|||
from . import product_product |
@ -1,16 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © <2015> <Akretion, GRAP, OCA> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class ProductTemplate(models.Model): |
|||
_inherit = 'product.template' |
|||
|
|||
@api.multi |
|||
def _get_has_image(self): |
|||
self.ensure_one() |
|||
self.has_image = self.image is not False |
|||
|
|||
has_image = fields.Boolean(compute='_get_has_image', string='Has Image') |
@ -0,0 +1,18 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © <2015> <Akretion, GRAP, OCA> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class ProductProduct(models.Model): |
|||
_inherit = 'product.product' |
|||
|
|||
@api.multi |
|||
@api.depends('image') |
|||
def _compute_has_image(self): |
|||
for product in self: |
|||
product.has_image = product.image is not False |
|||
|
|||
has_image = fields.Boolean( |
|||
compute='_compute_has_image', string='Has Image', store=True) |
After Width: 845 | Height: 138 | Size: 51 KiB |
After Width: 844 | Height: 138 | Size: 54 KiB |
@ -0,0 +1,17 @@ |
|||
odoo.define('pos_default_empty_image.db', function (require) { |
|||
"use strict"; |
|||
|
|||
var models = require('point_of_sale.models'); |
|||
|
|||
var _super_posmodel = models.PosModel.prototype; |
|||
|
|||
// load new field 'has_image' for 'product.product' model
|
|||
models.PosModel = models.PosModel.extend({ |
|||
initialize: function (session, attributes) { |
|||
var product_model = _.find(this.models, function(model){ return model.model === 'product.product'; }); |
|||
product_model.fields.push('has_image'); |
|||
|
|||
return _super_posmodel.initialize.call(this, session, attributes); |
|||
}, |
|||
}); |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue