From a1a4bc77d10053d4527908c53601e4f55b5b309a Mon Sep 17 00:00:00 2001 From: Juliana Date: Wed, 29 Jul 2020 15:37:22 +0200 Subject: [PATCH] Modif fichier retour Vracoop --- models/pos_config.py | 19 ++++++++++++-- static/src/css/style.css | 17 ++++++++++--- static/src/js/container.js | 9 ++++--- static/src/js/custo_header.js | 26 +++++++++++++++++++ static/src/js/devices.js | 2 +- static/src/js/models_and_db.js | 2 +- static/src/xml/pos.xml | 46 +++++++++++++++++----------------- views/assets.xml | 10 ++++---- 8 files changed, 93 insertions(+), 38 deletions(-) diff --git a/models/pos_config.py b/models/pos_config.py index f9afc8f..ececd92 100644 --- a/models/pos_config.py +++ b/models/pos_config.py @@ -7,8 +7,23 @@ from odoo import api, fields, models class PosConfig(models.Model): _inherit = 'pos.config' - is_balance_free = fields.Boolean(string='Balance libre service') - logo_balance = fields.Binary(string='Logo Balance') + is_balance_free = fields.Boolean( + string='Balance libre service') + logo_balance = fields.Binary( + string='Logo Balance', + attachment=True) explication_header = fields.Char(string='Explication') weight_default = fields.Char(string='Poids par défault (kg)') balance_id = fields.Char("Identifiant de la balance") + logo_path = fields.Char( + "URL Logo", compute="_compute_image_path") + + def _compute_image_path(self): + for pos in self: + if pos.logo_balance: + attachment_id = self.env['ir.attachment'].search([ + ('res_field', '=', 'logo_balance'), + ('res_model', '=', 'pos.config'), + ('res_id', '=', self.id)]) + attachment_id.generate_access_token() + pos.logo_path = '/web/content/' + str(attachment_id.id) + '?access_token=' + attachment_id.access_token diff --git a/static/src/css/style.css b/static/src/css/style.css index 443b97e..c7da931 100644 --- a/static/src/css/style.css +++ b/static/src/css/style.css @@ -59,10 +59,9 @@ .pos .pos-logo { position: absolute; float: right; - right: 0; + right: 10px; top: 0; - height: 35px; - margin: 7px; + height: 100%; } .logo-scan{ @@ -110,6 +109,7 @@ margin: 0px 16px 0px 16px; } +.pos .confirmation-screen .btn-back, .pos .balancecontainerscale-screen .add-container, .pos .scale-screen .add-transaction{ margin: 0 auto; @@ -124,6 +124,10 @@ cursor: pointer; } +.pos .confirmation-screen .btn-back{ + width: 300px; +} + .pos .balancecontainerscale-screen .add-container{ width: 250px; margin: 40px auto; @@ -306,6 +310,8 @@ h1.product-name { } .pos .centered-content-flex .weight { + max-width: 255px; + min-width: 255px; text-align: right; margin: 16px; background: white; @@ -335,6 +341,7 @@ h1.product-name { } .flex-poids{ + /*min-width: 300px;*/ display: flex; flex-direction: column; } @@ -365,4 +372,8 @@ h1.product-name { .pos-bottom.pos-bottom-confirm{ height: 100%; +} + +.searchbox{ + display: none; } \ No newline at end of file diff --git a/static/src/js/container.js b/static/src/js/container.js index 28d78bd..94c1ea1 100644 --- a/static/src/js/container.js +++ b/static/src/js/container.js @@ -5,7 +5,7 @@ */ -odoo.define('vracoop_pos_free_balance_V2.container_balance', function (require) { +odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) { "use strict"; var chrome = require('point_of_sale.chrome'); @@ -554,8 +554,11 @@ odoo.define('vracoop_pos_free_balance_V2.container_balance', function (require) pushed_transaction: function(barcode){ var self = this; + // Remise à zero du poids à l'écran + this.set_weight(0); + this.renderElement(); var product = this.get_product(); - console.log(product); + this.gui.show_screen('confirmation',{product: product}); }, @@ -608,8 +611,8 @@ odoo.define('vracoop_pos_free_balance_V2.container_balance', function (require) } }); }, {duration: 500, repeat: true}); - this._super(); + var self = this; this.$('.next,.add-container').click(function(){ diff --git a/static/src/js/custo_header.js b/static/src/js/custo_header.js index 323ffe1..f5474a0 100644 --- a/static/src/js/custo_header.js +++ b/static/src/js/custo_header.js @@ -13,6 +13,11 @@ chrome.Chrome.include({ 'name': 'shopname', 'widget': ShopnameWidget, 'replace': '.placeholder-ShopnameWidget'}); + + this.widgets.push({ + 'name': 'shopimage', + 'widget': ShopimageWidget, + 'replace': '.placeholder-ShopimageWidget'}); this._super(); }, @@ -37,6 +42,27 @@ var ShopnameWidget = PosBaseWidget.extend({ } }, }); + + +var ShopimageWidget = PosBaseWidget.extend({ + template: 'ShopimageWidget', + init: function(parent, options){ + options = options || {}; + this._super(parent,options); + }, + renderElement: function(){ + var self = this; + this._super(); + }, + get_shopimage: function(){ + var header_text = this.pos.get_name_header(); + if(header_text){ + return header_text; + }else{ + return ""; + } + }, +}); return { 'ShopnameWidget': ShopnameWidget, }; diff --git a/static/src/js/devices.js b/static/src/js/devices.js index 58fdfc0..e57b364 100644 --- a/static/src/js/devices.js +++ b/static/src/js/devices.js @@ -1,7 +1,7 @@ // © 2020 Le Filament () // License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -odoo.define('vracoop_pos_free_balance_V2.devices', function (require) { +odoo.define('vracoop_pos_free_balance_v2.devices', function (require) { "use strict"; var devices = require('point_of_sale.devices'); diff --git a/static/src/js/models_and_db.js b/static/src/js/models_and_db.js index 85c4ac5..77d07c0 100644 --- a/static/src/js/models_and_db.js +++ b/static/src/js/models_and_db.js @@ -3,7 +3,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -odoo.define('vracoop_pos_free_balance_V2.models_and_db_balance', function (require) { +odoo.define('vracoop_pos_free_balance_v2.models_and_db_balance', function (require) { "use strict"; var PosDB = require('point_of_sale.DB'); diff --git a/static/src/xml/pos.xml b/static/src/xml/pos.xml index 1acbf4f..e1dd5e4 100644 --- a/static/src/xml/pos.xml +++ b/static/src/xml/pos.xml @@ -5,7 +5,7 @@
- +
@@ -25,7 +25,6 @@
  • 2
  • 3
  • 4
  • -
  • 5
  • @@ -33,10 +32,10 @@
    - 1. Scanner l'étiquette
    + Scanner l’étiquette et poser sur la balance
    - +
    @@ -48,6 +47,9 @@ + + +
    @@ -63,8 +65,6 @@
  • 1
  • 2. Peser le contenant et valider
  • 3
  • -
  • 4
  • -
  • 5
  • @@ -72,9 +72,9 @@
    -

    Ajouter un contenant

    +

    Poser votre contenant sur la balance puis enregistrer

    - Sauvegarder + Enregistrer
    @@ -97,13 +97,13 @@
    Poids Brut total:
    - 1 + 0.00
    -
    Tare contenant:
    -
    +
    Tare contenant:
    +
    @@ -164,13 +164,13 @@
    Poids Brut total:
    - 1 + 0.00
    -
    Tare contenant:
    -
    +
    Tare contenant:
    +
    @@ -195,20 +195,21 @@
  • 1
  • 2
  • 3
  • -
  • 4
  • -
  • 5. Pesée confirmée
  • +
  • 4. Pesée confirmée
  • +

    Pesée confirmée.
    + Vous pouvez passer en caisse

    - +
    -

    -
    - à +
    + Nouvelle pesée +
    @@ -289,10 +290,9 @@
    • 1
    • -
    • 2
    • -
    • 3. Sélectionner un produit
    • +
    • 2. Sélectionner un produit
    • +
    • 3
    • 4
    • -
    • 5
    diff --git a/views/assets.xml b/views/assets.xml index 89bd64a..a158145 100644 --- a/views/assets.xml +++ b/views/assets.xml @@ -3,13 +3,13 @@