flectra/addons/point_of_sale/wizard/pos_discount.py

18 lines
581 B
Python
Raw Permalink Normal View History

# -*- 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 11:34:37 +01:00
from flectra import api, fields, models
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})