Browse Source

Ajout de la fonctionnalité Pesée sans contenant

12-V2.0
Juliana 3 years ago
parent
commit
5b18d3252e
  1. 2
      __manifest__.py
  2. 1
      models/pos_config.py
  3. 7
      static/src/css/style.css
  4. 39
      static/src/js/container.js
  5. 4
      static/src/xml/pos.xml
  6. 4
      views/pos_config_views.xml

2
__manifest__.py

@ -1,7 +1,7 @@
{
"name": "VRACOOP - POS Free Balance V2",
"summary": "VRACOOP - POS Free Balance V2",
"version": "12.2.0.1",
"version": "12.2.1.0",
"development_status": "Beta",
"author": "Le Filament",
"maintainers": ["remi-filament"],

1
models/pos_config.py

@ -19,6 +19,7 @@ class PosConfig(models.Model):
logo_path = fields.Char(
"URL Logo", compute="_compute_image_path")
is_comptoir = fields.Boolean("Est une balance comptoir")
allow_without_container = fields.Boolean("Autoriser les pesées sans contenant")
def _compute_image_path(self):
for pos in self:

7
static/src/css/style.css

@ -115,6 +115,7 @@
margin: 0px 16px 0px 16px;
}
.pos .presentation-screen .bypass-container,
.pos .confirmation-screen .btn-back,
.pos .balancecontainerscale-screen .add-container,
.pos .scale-screen-custo .add-transaction{
@ -130,6 +131,12 @@
cursor: pointer;
}
.pos .presentation-screen .bypass-container{
width: 400px;
font-size: 25px;
margin: 20px auto;
}
.pos .confirmation-screen .btn-back{
margin: 20px;
width: 300px;

39
static/src/js/container.js

@ -582,7 +582,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
orderline.set_tare_mode('AUTO');
orderline.trigger('change', orderline);
} else {
this._super();
this.pos.get_order().add_product(product,{ quantity: this.weight });
}
},
@ -607,8 +607,11 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
var qrcode = '';
var ean13 = '';
var ean13_verif = '';
fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode);
fields['container_ean13'] = container.barcode;
if (container){
fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode);
fields['container_ean13'] = container.barcode;
}
fields['product_id'] = product.id;
// var product_id = (this.get_product().id).toString();
@ -637,7 +640,12 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
fields['write_date'] = date_time;
fields['weight_net'] = scale_screen.weight;
fields['weight_tare'] = container.weight;
if(container){
fields['weight_tare'] = container.weight;
}
else{
fields['weight_tare'] = 0.0;
}
var pricelist = scale_screen._get_active_pricelist();
fields['price_product'] = (product ? product.get_price(pricelist, scale_screen.weight) : 0) || 0;
@ -837,6 +845,17 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
screen.$el.removeClass('oe_hidden');
$("#pos-header-text-selec").removeClass('oe_hidden');
$("#pos-header-text-confirm").addClass('oe_hidden');
// Ajout de la fonctionnalité Pesée sans contenant
if (this.pos.config.allow_without_container){
this.$('.bypass-container').removeClass('oe_hidden');
}
else {
this.$('.bypass-container').addClass('oe_hidden');
}
this.$('.bypass-container').click(function(){
self.gui.show_screen('products-balance');
});
},
// this methods hides the screen. It's not a good place to put your cleanup stuff as it is called on the
@ -902,10 +921,16 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
var scale_screen = this.gui.screen_instances['balancescale'];
var container = this.gui.get_current_screen_param('container');
scale_screen.weight_container = container.weight;
if (container){
var container_weight = container.weight;
}
else{
var container_weight = 0.0
}
scale_screen.weight_container = container_weight;
scale_screen.weight = weight;
scale_screen.weight_brut = container.weight + scale_screen.weight;
scale_screen.weight_brut = container_weight + scale_screen.weight;
scale_screen.$('.weight').text(scale_screen.get_product_weight_string());
scale_screen.$('.computed-price').text(scale_screen.get_computed_price_string());
scale_screen.$('.weight-brut').text(scale_screen.get_product_weight_string_brut());

4
static/src/xml/pos.xml

@ -36,6 +36,10 @@
<div>
<img class="logo-scan" src="/vracoop_pos_free_balance_v2/static/src/img/logo-scan.png" />
</div>
<div class='button bypass-container oe_hidden'>
Transaction sans contenant
</div>
</div>
</div>
</div>

4
views/pos_config_views.xml

@ -54,6 +54,10 @@
<label for="weight_default" class="col-lg-3 o_light_label"/>
<field name="weight_default" />
</div>
<div class="row mt16">
<label for="allow_without_container" class="col-lg-3 o_light_label"/>
<field name="allow_without_container" />
</div>
</div>
</div>
</div>

Loading…
Cancel
Save