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. 31
      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", "name": "VRACOOP - POS Free Balance V2",
"summary": "VRACOOP - POS Free Balance V2", "summary": "VRACOOP - POS Free Balance V2",
"version": "12.2.0.1",
"version": "12.2.1.0",
"development_status": "Beta", "development_status": "Beta",
"author": "Le Filament", "author": "Le Filament",
"maintainers": ["remi-filament"], "maintainers": ["remi-filament"],

1
models/pos_config.py

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

7
static/src/css/style.css

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

31
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.set_tare_mode('AUTO');
orderline.trigger('change', orderline); orderline.trigger('change', orderline);
} else { } 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 qrcode = '';
var ean13 = ''; var ean13 = '';
var ean13_verif = ''; var ean13_verif = '';
if (container){
fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode); fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode);
fields['container_ean13'] = container.barcode; fields['container_ean13'] = container.barcode;
}
fields['product_id'] = product.id; fields['product_id'] = product.id;
// var product_id = (this.get_product().id).toString(); // 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['write_date'] = date_time;
fields['weight_net'] = scale_screen.weight; fields['weight_net'] = scale_screen.weight;
if(container){
fields['weight_tare'] = container.weight; fields['weight_tare'] = container.weight;
}
else{
fields['weight_tare'] = 0.0;
}
var pricelist = scale_screen._get_active_pricelist(); var pricelist = scale_screen._get_active_pricelist();
fields['price_product'] = (product ? product.get_price(pricelist, scale_screen.weight) : 0) || 0; 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'); screen.$el.removeClass('oe_hidden');
$("#pos-header-text-selec").removeClass('oe_hidden'); $("#pos-header-text-selec").removeClass('oe_hidden');
$("#pos-header-text-confirm").addClass('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 // this methods hides the screen. It's not a good place to put your cleanup stuff as it is called on the
@ -903,9 +922,15 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
var container = this.gui.get_current_screen_param('container'); 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 = 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.$('.weight').text(scale_screen.get_product_weight_string());
scale_screen.$('.computed-price').text(scale_screen.get_computed_price_string()); scale_screen.$('.computed-price').text(scale_screen.get_computed_price_string());
scale_screen.$('.weight-brut').text(scale_screen.get_product_weight_string_brut()); scale_screen.$('.weight-brut').text(scale_screen.get_product_weight_string_brut());

4
static/src/xml/pos.xml

@ -36,6 +36,10 @@
<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 class='button bypass-container oe_hidden'>
Transaction sans contenant
</div>
</div> </div>
</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"/> <label for="weight_default" class="col-lg-3 o_light_label"/>
<field name="weight_default" /> <field name="weight_default" />
</div> </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> </div>
</div> </div>

Loading…
Cancel
Save