Browse Source

Modif fichier retour Vracoop

12.0
Juliana 4 years ago
parent
commit
a1a4bc77d1
  1. 19
      models/pos_config.py
  2. 17
      static/src/css/style.css
  3. 9
      static/src/js/container.js
  4. 26
      static/src/js/custo_header.js
  5. 2
      static/src/js/devices.js
  6. 2
      static/src/js/models_and_db.js
  7. 46
      static/src/xml/pos.xml
  8. 10
      views/assets.xml

19
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

17
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;
}

9
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(){

26
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,
};

2
static/src/js/devices.js

@ -1,7 +1,7 @@
// © 2020 Le Filament (<http://www.le-filament.com>)
// 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');

2
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');

46
static/src/xml/pos.xml

@ -5,7 +5,7 @@
<t t-jquery='.pos-topheader' t-operation='replace'>
<div class="pos-topheader-title">
<span class="placeholder-ShopnameWidget"></span>
<img class="pos-logo" src="/vracoop_pos_free_balance_V2/static/src/img/logo-vracoop.png" />
<span class="placeholder-ShopimageWidget"></span>
</div>
</t>
</t>
@ -25,7 +25,6 @@
<li><span>2</span></li>
<li><span>3</span></li>
<li><span>4</span></li>
<li><span>5</span></li>
</ul>
</div>
</div>
@ -33,10 +32,10 @@
<div class='screen-content-flexbox'>
<div class='page-first' >
<div class='pos-text'>
1. Scanner l'étiquette<br/>
Scanner l’étiquette et poser sur la balance<br/>
</div>
<div>
<img class="logo-scan" src="/vracoop_pos_free_balance_V2/static/src/img/logo-scan.png" />
<img class="logo-scan" src="/vracoop_pos_free_balance_v2/static/src/img/logo-scan.png" />
</div>
</div>
</div>
@ -48,6 +47,9 @@
<t t-esc="widget.get_shopname()" />
</h1>
</t>
<t t-name="ShopimageWidget">
<img class="pos-logo" t-att-src='widget.pos.config.logo_path' alt="Logo"/>
</t>
<t t-name="BalanceContainerScaleScreenWidget">
<div class="pos-topheader oe_hidden" id="pos-topheader-scale-cont">
@ -63,8 +65,6 @@
<li><span>1</span></li>
<li class="li-active"><span>2. Peser le contenant et valider</span></li>
<li><span>3</span></li>
<li><span>4</span></li>
<li><span>5</span></li>
</ul>
</div>
</div>
@ -72,9 +72,9 @@
<div class="balancecontainerscale-screen screen">
<div class="pos-bottom">
<div class="pos-confirm" id="validation-bloc-cont">
<h1 class='product-name'>Ajouter un contenant</h1>
<h1 class='product-name'>Poser votre contenant sur la balance puis enregistrer</h1>
<div class='add-container'>
Sauvegarder
Enregistrer
<i class='fa fa-angle-double-right'></i>
</div>
</div>
@ -97,13 +97,13 @@
<div>
<div class="label-scale">Poids Brut total:</div>
<div class='weight-brut'>
1
0.00
</div>
</div>
<div>
<div class="label-scale-cont ">Tare contenant: </div>
<div class="label-scale-cont">
<div class="label-scale">Tare contenant: </div>
<div class="label-scale">
<!-- <t t-esc="widget.get_current_container_weight()"/> -->
</div>
</div>
@ -164,13 +164,13 @@
<div>
<div class="label-scale">Poids Brut total:</div>
<div class='weight-brut'>
1
0.00
</div>
</div>
<div>
<div class="label-scale-cont ">Tare contenant: </div>
<div class="label-scale-cont">
<div class="label-scale ">Tare contenant: </div>
<div class="label-scale">
<t t-esc="widget.get_current_container_weight()"/>
</div>
</div>
@ -195,20 +195,21 @@
<li><span>1</span></li>
<li><span>2</span></li>
<li><span>3</span></li>
<li><span>4</span></li>
<li class="li-active"><span>5. Pesée confirmée</span></li>
<li class="li-active"><span>4. Pesée confirmée</span></li>
</ul>
</div>
</div>
</div>
<div class="pos-bottom pos-bottom-confirm">
<div class="pos-confirm-screen">
<p class="text-center">Pesée confirmée.<br/>
Vous pouvez passer en caisse</p>
<div class='back-presentation'>
<img class="logo-scan mb-3" src="/vracoop_pos_free_balance_V2/static/src/img/picto-confirm.png" />
<img class="logo-scan mb-3" src="/vracoop_pos_free_balance_v2/static/src/img/picto-confirm.png" />
</div>
<h1 class='product-name'><t t-esc="widget.get_product_name()" /></h1>
<div class='product-price'>
à <t t-esc="widget.format_currency(widget.get_product_price()) + '/' + widget.get_product_uom()" />
<div class='back-presentation btn-back'>
Nouvelle pesée
<i class='fa fa-angle-double-right'></i>
</div>
</div>
</div>
@ -289,10 +290,9 @@
<div id="pos-header-text-prod" class=" pos-text oe_hidden">
<ul>
<li><span>1</span></li>
<li><span>2</span></li>
<li class="li-active"><span>3. Sélectionner un produit</span></li>
<li class="li-active"><span>2. Sélectionner un produit</span></li>
<li><span>3</span></li>
<li><span>4</span></li>
<li><span>5</span></li>
</ul>
</div>
</div>

10
views/assets.xml

@ -3,13 +3,13 @@
<template id="vracoop_assets_frontend" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/vracoop_pos_free_balance_V2/static/src/js/models_and_db.js"/>
<script type="text/javascript" src="/vracoop_pos_free_balance_V2/static/src/js/custo_header.js"></script>
<script type="text/javascript" src="/vracoop_pos_free_balance_V2/static/src/js/devices.js"/>
<script type="text/javascript" src="/vracoop_pos_free_balance_V2/static/src/js/container.js"></script>
<script type="text/javascript" src="/vracoop_pos_free_balance_v2/static/src/js/models_and_db.js"/>
<script type="text/javascript" src="/vracoop_pos_free_balance_v2/static/src/js/custo_header.js"></script>
<script type="text/javascript" src="/vracoop_pos_free_balance_v2/static/src/js/devices.js"/>
<script type="text/javascript" src="/vracoop_pos_free_balance_v2/static/src/js/container.js"></script>
</xpath>
<xpath expr="//link[@id='pos-stylesheet']" position="after">
<link rel="stylesheet" type="text/scss" href="/vracoop_pos_free_balance_V2/static/src/css/style.css" />
<link rel="stylesheet" type="text/scss" href="/vracoop_pos_free_balance_v2/static/src/css/style.css" />
</xpath>
</template>
Loading…
Cancel
Save