You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
1.3 KiB

# © 2020 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
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',
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")
caisse_id = fields.Char("Identifiant de la caisse")
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:
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