Browse Source

[ADD] Add field config caisse

12-V2.0
Juliana 3 years ago
parent
commit
c7dae6dd34
  1. 1
      models/pos_config.py
  2. 11
      static/src/js/models_and_db.js
  3. 4
      views/pos_config_views.xml

1
models/pos_config.py

@ -15,6 +15,7 @@ class PosConfig(models.Model):
explication_header = fields.Char(string='Explication') explication_header = fields.Char(string='Explication')
weight_default = fields.Char(string='Poids par défault (kg)') weight_default = fields.Char(string='Poids par défault (kg)')
balance_id = fields.Char("Identifiant de la balance") balance_id = fields.Char("Identifiant de la balance")
caisse_id = fields.Char("Identifiant de la caisse")
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")

11
static/src/js/models_and_db.js

@ -145,13 +145,20 @@ odoo.define('vracoop_pos_free_balance_v2.models_and_db_balance', function (requi
} }
}, },
// returns the id of balance/caisse from config
// returns the id of caisse from config
get_balance_id: function(){ get_balance_id: function(){
if (this.config.balance_id) { if (this.config.balance_id) {
return this.config.balance_id; return this.config.balance_id;
} }
}, },
// returns the id of balance from config
get_caisse_id: function(){
if (this.config.caisse_id) {
return this.config.caisse_id;
}
},
// returns if the pos is balance from config // returns if the pos is balance from config
get_is_balance_free: function(){ get_is_balance_free: function(){
if (this.config.is_balance_free) { if (this.config.is_balance_free) {
@ -296,7 +303,7 @@ odoo.define('vracoop_pos_free_balance_v2.models_and_db_balance', function (requi
container_id: this.get_container() ? this.get_container().id : null, container_id: this.get_container() ? this.get_container().id : null,
container_barcode: this.get_container() ? this.get_container().barcode : null, container_barcode: this.get_container() ? this.get_container().barcode : null,
container_weight: this.get_container() ? this.get_container().weight : null, container_weight: this.get_container() ? this.get_container().weight : null,
caisse_id: this.pos.config.balance_id,
caisse_id: this.pos.config.caisse_id,
}; };
}, },
}), }),

4
views/pos_config_views.xml

@ -18,8 +18,8 @@
</div> </div>
<div class="content-group" attrs="{'invisible': [('is_balance_free', '!=', False)]}"> <div class="content-group" attrs="{'invisible': [('is_balance_free', '!=', False)]}">
<div class="row mt16"> <div class="row mt16">
<label for="balance_id" class="col-lg-3 o_light_label"/>
<field name="balance_id"/>
<label for="caisse_id" class="col-lg-3 o_light_label"/>
<field name="caisse_id"/>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save