forked from OCA/margin-analysis
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] started working on the wizard part. Not finished, disabled for now
(lp:c2c-addons/6.1 rev 40.1.30)
- Loading branch information
1 parent
f84ec42
commit 4eafed5
Showing
6 changed files
with
140 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Author: Alexandre Fayolle | ||
# Copyright 2012 Camptocamp SA | ||
# | ||
# 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/>. | ||
# | ||
############################################################################## | ||
|
||
from . import historical_margin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Author: Alexandre Fayolle | ||
# Copyright 2012 Camptocamp SA | ||
# | ||
# 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/>. | ||
# | ||
############################################################################## | ||
import datetime | ||
|
||
from openerp.osv.orm import TransientModel | ||
from openerp.osv import fields | ||
|
||
|
||
class historical_margin(TransientModel): | ||
_name = 'historical_margin' | ||
_description = 'Product historical margin' | ||
_columns = { | ||
'start_date': fields.date('Start Date', help='Date of the first invoice to take into account. The earliest existing invoice will be used if left empty'), | ||
'end_date': fields.date('End Date', help='Date of the last invoice to take into account. The latest existing invoice will be used if left empty') | ||
} | ||
_defaults = { | ||
'start_date': lambda *a: datetime.date(datetime.date.today().year, 1, 1), | ||
#'end_date': lambda *a: datetime.date.today(), | ||
} | ||
|
||
def historical_margin_open_window(self, cr, uid, ids, context=None): | ||
""" | ||
Open the historical margin view | ||
""" | ||
if context is None: | ||
context = {} | ||
wiz = self.read(cr, uid, ids, [], context)[0] | ||
ctx = context.copy() | ||
ctx['start_date'] = wiz.get('start_date') | ||
ctx['end_date'] = wiz.get('end_date') | ||
# XXX FIXME | ||
|
39 changes: 39 additions & 0 deletions
39
product_historical_margin/wizard/historical_margin_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<!-- XXX This file is not processed (not listed in __openerp__.py) --> | ||
<openerp> | ||
<data> | ||
<record id="view_historical_margin" model="ir.ui.view"> | ||
<field name="name">historical_margin.form</field> | ||
<field name="model">historical_margin</field> | ||
<field name="type">form</field> | ||
<field name="arch" type="xml"> | ||
<form string="Historical Margin"> | ||
<group colspan="4"> | ||
<field name="start_date" "/> | ||
<field name="end_date"/> | ||
</group> | ||
<separator string="" colspan="4"/> | ||
<group colspan="4" col="6"> | ||
<button icon="gtk-cancel" special="cancel" string="Cancel"/> | ||
<button icon="terp-gtk-go-back-rtl" string="Compute margins" name="historical_margin_open_window" type="object"/> | ||
</group> | ||
</form> | ||
</field> | ||
</record> | ||
<record id="action_historical_margin" model="ir.actions.act_window"> | ||
<field name="name">Product historical margine</field> | ||
<field name="res_model">historical_margin</field> | ||
<field name="view_type">form</field> | ||
<field name="view_mode">form</field> | ||
<field name="view_id" ref="view_historical_margin"/> | ||
<field name="target">new</field> | ||
<field name="help">Display the historical margin of your products</field> | ||
</record> | ||
<menuitem icon="STOCK_INDENT" action="action_historical_margin" | ||
id="menu_action_account_tree2" | ||
parent="account.menu_finance_charts" /> | ||
</data> | ||
</openerp> |