diff --git a/project_task_activity/project.py b/project_task_activity/project.py index 33c2b56a..ae0ab843 100644 --- a/project_task_activity/project.py +++ b/project_task_activity/project.py @@ -80,7 +80,7 @@ class project_project(models.Model): string='Activities done', compute='_get_activities_done') progress_activities = fields.Float( string=_("Progress"), - compute='_get_progress_activities', digits=(4, 2)) + compute='_get_progress_activities') @api.one def _get_task_activity(self): @@ -102,5 +102,5 @@ def _get_progress_activities(self): self.progress_activities = 0 if self.activity_ids: if self.activities_todo != 0: - self.progress_activities = 100 * (self.activities_done / - self.activities_todo) + self.progress_activities = round( + 100 * (self.activities_done / self.activities_todo), 1) diff --git a/sale_global_three_discounts/__init__.py b/sale_global_three_discounts/__init__.py new file mode 100755 index 00000000..4454edfc --- /dev/null +++ b/sale_global_three_discounts/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +############################################################################## +# For copyright and license notices, see __openerp__.py file in module root +# directory +############################################################################## +from . import wizard diff --git a/sale_global_three_discounts/__openerp__.py b/sale_global_three_discounts/__openerp__.py new file mode 100644 index 00000000..1e388553 --- /dev/null +++ b/sale_global_three_discounts/__openerp__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) +# All Rights Reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name": "Sale Global Three Discounts", + 'version': '8.0.0.1.0', + 'category': 'Sales Management', + 'sequence': 14, + 'author': 'ADHOC SA', + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'summary': '', + "description": """ +Sale Global Three Discounts +=========================== + + """, + "depends": [ + 'sale_global_discount', + 'sale_three_discounts' + ], + 'external_dependencies': { + }, + "data": [ + 'wizard/sale_global_discount_wizard_view.xml', + ], + 'demo': [ + ], + 'test': [ + ], + 'installable': True, + 'auto_install': True, + 'application': False, +} diff --git a/sale_global_three_discounts/wizard/__init__.py b/sale_global_three_discounts/wizard/__init__.py new file mode 100644 index 00000000..ab64e93e --- /dev/null +++ b/sale_global_three_discounts/wizard/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +############################################################################## +# For copyright and license notices, see __openerp__.py file in module root +# directory +############################################################################## +from . import sale_global_discount_wizard diff --git a/sale_global_three_discounts/wizard/sale_global_discount_wizard.py b/sale_global_three_discounts/wizard/sale_global_discount_wizard.py new file mode 100644 index 00000000..3a3bbead --- /dev/null +++ b/sale_global_three_discounts/wizard/sale_global_discount_wizard.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################## +# For copyright and license notices, see __openerp__.py file in module root +# directory +############################################################################## +from openerp import models, fields, api +import logging +_logger = logging.getLogger(__name__) + + +class sale_global_discount_wizard(models.TransientModel): + _name = "sale.order.global_discount.wizard" + + # todo implement fixed amount + # type = fields.Selection([ + # ('percentage', 'Percentage'), + # ('fixed_amount', 'Fixed Amount'), + # ], + # 'Type', + # required=True, + # default='percentage', + # ) + discount1 = fields.Boolean( + 'Discount 1' + ) + discount2 = fields.Boolean( + 'Discount 2' + ) + discount3 = fields.Boolean( + 'Discount 3' + ) + + discount1_amount = fields.Float( + '(%)', + required=True, + ) + discount2_amount = fields.Float( + '(%)', + required=True, + ) + discount3_amount = fields.Float( + '(%)', + required=True, + ) + amount = fields.Float( + required=False, + ) + + @api.multi + def confirm(self): + self.ensure_one() + order = self.env['sale.order'].browse( + self._context.get('active_id', False)) + for line in order.order_line: + if self.discount1: + line.discount1 = self.discount1_amount + if self.discount2: + line.discount2 = self.discount2_amount + if self.discount3: + line.discount3 = self.discount3_amount + return True diff --git a/sale_global_three_discounts/wizard/sale_global_discount_wizard_view.xml b/sale_global_three_discounts/wizard/sale_global_discount_wizard_view.xml new file mode 100644 index 00000000..d48a302f --- /dev/null +++ b/sale_global_three_discounts/wizard/sale_global_discount_wizard_view.xml @@ -0,0 +1,26 @@ + + + + + Sale Order Global Discount Wizard + sale.order.global_discount.wizard + + + + + + + + + + + + + + + + + + + +