Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions project_task_activity/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
6 changes: 6 additions & 0 deletions sale_global_three_discounts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import wizard
51 changes: 51 additions & 0 deletions sale_global_three_discounts/__openerp__.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"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,
}
6 changes: 6 additions & 0 deletions sale_global_three_discounts/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -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
61 changes: 61 additions & 0 deletions sale_global_three_discounts/wizard/sale_global_discount_wizard.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_sale_global_discount_wizard_form" model="ir.ui.view">
<field name="name">Sale Order Global Discount Wizard</field>
<field name="model">sale.order.global_discount.wizard</field>
<field name="inherit_id" ref="sale_global_discount.view_sale_global_discount_wizard_form"/>
<field name="arch" type="xml">
<field name="amount" position="replace">
<group>
<group>
<field name="discount1"/>
<field name="discount2"/>
<field name="discount3"/>
</group>
<group>
<field name="discount1_amount" attrs="{'invisible': [('discount1','!=',True)]}"/>
<field name="discount2_amount" attrs="{'invisible': [('discount2','!=',True)]}"/>
<field name="discount3_amount" attrs="{'invisible': [('discount3','!=',True)]}"/>
</group>
</group>
</field>
</field>
</record>
</data>
</openerp>