Browse Source

Ajout 3 digit + Tare dans transaction + kg en minus

12.0
Juliana 4 years ago
parent
commit
1a98edf8fd
  1. 4
      models/pos_transaction.py
  2. 31
      static/src/js/container.js
  3. 2
      static/src/js/models_and_db.js
  4. 38
      static/src/xml/pos.xml
  5. 1
      views/pos_transaction.xml

4
models/pos_transaction.py

@ -20,7 +20,8 @@ class PosTransaction(models.Model):
ean13_verif = fields.Char('EAN13 Vérification Poids', size=13)
date_iso = fields.Char('Date ISO', compute="_compute_date_iso")
container_ean13 = fields.Char('EAN13 Container', size=13)
weight_net = fields.Float('Poids Net')
weight_net = fields.Float('Poids Net (en kg)', digits=(12,3))
weight_tare = fields.Float('Poids Tare (en kg)', digits=(12,3))
price_net = fields.Float('Prix total')
price_product = fields.Float('Prix au kilo')
product_id = fields.Many2one('product.product', string='Produit ID')
@ -31,7 +32,6 @@ class PosTransaction(models.Model):
transaction_ids = []
for transaction in transactions:
transaction_id = transaction.pop('id', False)
if transaction_id:
self.browse(transaction_id).write(transaction)

31
static/src/js/container.js

@ -165,9 +165,26 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
}
},
get_product_weight_string: function(){
var product = this.get_product();
var defaultstr = (this.weight || 0).toFixed(3) + ' kg';
if(!product || !this.pos){
return defaultstr;
}
var unit_id = product.uom_id;
if(!unit_id){
return defaultstr;
}
var unit = this.pos.units_by_id[unit_id[0]];
var weight = round_pr(this.weight || 0, unit.rounding);
var weightstr = weight.toFixed(Math.ceil(Math.log(1.0/unit.rounding) / Math.log(10) ));
weightstr += ' ' + unit.name;
return weightstr;
},
get_product_weight_string_brut: function(){
var product = this.get_product();
var defaultstr = (this.weight + this.weight_container || 0).toFixed(3) + ' Kg';
var defaultstr = (this.weight + this.weight_container || 0).toFixed(3) + ' kg';
if(!product || !this.pos){
return defaultstr;
}
@ -381,13 +398,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
var container = this.gui.get_current_screen_param('container');
// queue.schedule(function () {
// return self.pos.proxy.reset_weight().then(function () {
// self.set_weight(0);
// self.set_price(0);
// });
// }, {duration: 500});
// format price
var scale_screen = this.gui.screen_instances['balancescale'];
var price = scale_screen.format_price(scale_screen.get_product_price());
@ -433,9 +443,9 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
scale_screen.weight = weight;
scale_screen.$('.weight').text(scale_screen.get_product_weight_string());
scale_screen.$('.computed-price').text(scale_screen.format_currency(scale_screen.get_product_price() * 0));
scale_screen.$('.weight-brut').text('');
scale_screen.$('.weight-brut').text('0.000 kg');
var container_text = ''
var container_text = '0.000 kg'
scale_screen.$('.tare-container').text(container_text);
},
@ -810,6 +820,7 @@ 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;
var pricelist = scale_screen._get_active_pricelist();
fields['price_product'] = (product ? product.get_price(pricelist, scale_screen.weight) : 0) || 0;

2
static/src/js/models_and_db.js

@ -283,7 +283,7 @@ odoo.define('vracoop_pos_free_balance_v2.models_and_db_balance', function (requi
models.load_models({
model: 'pos.transaction',
fields: ['product_id', 'name', 'balance_id', 'ean13', 'write_date', 'container_ean13', 'weight_net', 'price_product', 'price_net'],
fields: ['product_id', 'name', 'balance_id', 'ean13', 'write_date', 'container_ean13', 'weight_net', 'price_product', 'price_net', 'weight_tare'],
domain: function(self){ return [['write_date','>',self.db.get_today_date()]]; },
loaded: function(self, transactions){
self.db.add_transactions(transactions);

38
static/src/xml/pos.xml

@ -96,14 +96,14 @@
<div>
<div class="label-scale">Poids Brut total:</div>
<div class='weight-brut'>
0.00
0.000 kg
</div>
</div>
<div>
<div class="label-scale">Tare contenant: </div>
<div class="label-scale">
<!-- <t t-esc="widget.get_current_container_weight()"/> -->
0.000 kg
</div>
</div>
</div>
@ -113,37 +113,8 @@
</t>
<t t-name="BalanceScaleScreenWidget">
<!-- <div class="pos-topheader oe_hidden" id="pos-topheader-scale">
<div class="pos-header-custo">
<div class="top-content">
<span class='button back'>
<i class='fa fa-angle-double-left'></i>
Retour
</span>
</div>
<div id="pos-header-text-peser" class="pos-text oe_hidden">
<ul>
<li><span>1</span></li>
<li><span>2</span></li>
<li><span>3</span></li>
<li class="li-active"><span>4. Peser et valider</span></li>
<li><span>5</span></li>
</ul>
</div>
</div>
</div> -->
<div class="scale-screen screen">
<div class="pos-bottom">
<!-- <div class="pos-confirm oe_hidden" id="validation-bloc">
<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>
<div class='add-transaction'>
Valider
<i class='fa fa-angle-double-right'></i>
</div>
</div> -->
<div class="centered-content-flex">
<div class="flex-poids">
<div class="label-scale div-net margin-top">Poids Net</div>
@ -163,15 +134,14 @@
<div>
<div class="label-scale">Poids Brut total:</div>
<div class='weight-brut'>
0.000
0.000 kg
</div>
</div>
<div>
<div class="label-scale ">Tare contenant: </div>
<div class='label-scale tare-container'>
0.000
<!-- <t t-esc="widget.get_current_container_weight()"/> -->
0.000 kg
</div>
</div>
</div>

1
views/pos_transaction.xml

@ -35,6 +35,7 @@
<field name="ean13_verif"/>
<field name="qrcode"/>
<field name="weight_net"/>
<field name="weight_tare"/>
<field name="price_product"/>
<field name="price_net"/>
</group>

Loading…
Cancel
Save