2018-01-16 06:58:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-16 11:34:37 +01:00
|
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
2018-01-16 06:58:15 +01:00
|
|
|
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra import api, fields, models
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class PosDiscount(models.TransientModel):
|
|
|
|
_name = 'pos.discount'
|
|
|
|
_description = 'Add a Global Discount'
|
|
|
|
|
|
|
|
discount = fields.Float(string='Discount (%)', required=True, digits=(16, 2), default=5)
|
|
|
|
|
|
|
|
@api.multi
|
|
|
|
def apply_discount(self):
|
|
|
|
self.ensure_one()
|
|
|
|
for order in self.env['pos.order'].browse(self.env.context.get('active_id', False)):
|
|
|
|
order.lines.write({'discount': self.discount})
|