3326.1.3
by Harshad Modi
profile_game |
1 |
# -*- encoding: utf-8 -*-
|
2 |
##############################################################################
|
|
3 |
#
|
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
4 |
# OpenERP, Open Source Management Solution
|
3413.1.2
by Naresh Choksy
Modification in Business Game |
5 |
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
3329.1.2
by Christophe Simonis
passing tiny modules to GPL-3 |
6 |
# $Id$
|
7 |
#
|
|
8 |
# This program is free software: you can redistribute it and/or modify
|
|
9 |
# it under the terms of the GNU General Public License as published by
|
|
10 |
# the Free Software Foundation, either version 3 of the License, or
|
|
11 |
# (at your option) any later version.
|
|
12 |
#
|
|
13 |
# This program is distributed in the hope that it will be useful,
|
|
14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 |
# GNU General Public License for more details.
|
|
17 |
#
|
|
18 |
# You should have received a copy of the GNU General Public License
|
|
19 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
3326.1.3
by Harshad Modi
profile_game |
20 |
#
|
21 |
##############################################################################
|
|
22 |
||
23 |
from osv import fields, osv |
|
24 |
import pooler |
|
25 |
||
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
26 |
class profile_game_phase_one(osv.osv): |
27 |
_name="profile.game.phase1" |
|
3350
by Fabien Pinckaers
improvements |
28 |
_rec_name = 'state' |
3326.1.3
by Harshad Modi
profile_game |
29 |
_columns = { |
30 |
'step1': fields.boolean('Create Quotation', readonly=True), |
|
31 |
'step1_so_id': fields.many2one('sale.order', 'Quotation / Sale Order', readonly=True), |
|
32 |
'step2': fields.boolean('Print Customer Quotation', readonly=True), |
|
33 |
'step3': fields.boolean('Confirm Sale Order', readonly=True), |
|
34 |
||
35 |
'step4': fields.boolean('Print Request for Quotation', readonly=True), |
|
36 |
'step5': fields.boolean('Change Supplier Price', readonly=True), |
|
37 |
'step6': fields.boolean('Confirm Request for Quotation', readonly=True), |
|
38 |
||
39 |
'step7': fields.boolean('Receive Products from Supplier', readonly=True), |
|
40 |
'step8': fields.boolean('Deliver Products to Customer', readonly=True), |
|
41 |
||
42 |
'step9': fields.boolean('Confirm Draft Invoice', readonly=True), |
|
43 |
'step10': fields.boolean('Print Customer Invoice', readonly=True), |
|
44 |
||
45 |
'state' :fields.selection([ |
|
46 |
('not running','Not Running'), |
|
47 |
('quotation','Create Quotation'), |
|
48 |
('print_quote','Print Quotation'), |
|
49 |
('sale','Confirm Sale Order'), |
|
50 |
('print_rfq','Print Request for Quotation'), |
|
51 |
('modify_price','Modify Price RfQ'), |
|
52 |
('confirm_po','Confirm Purchase Order'), |
|
53 |
('receive','Receive Products'), |
|
54 |
('deliver','Deliver Products'), |
|
55 |
('invoice_create','Confirm Invoice'), |
|
56 |
('invoice_print','Print Invoice'), |
|
3356.3.14
by Naresh Choksy
Business Game Phase 2 Introduction |
57 |
('started_phase2','Started Phase Two'), |
3326.1.3
by Harshad Modi
profile_game |
58 |
('done','Done'), |
59 |
], 'State', required=True,readonly=True) |
|
60 |
}
|
|
61 |
_defaults = { |
|
62 |
'state': lambda *args: 'not running' |
|
63 |
}
|
|
64 |
#
|
|
65 |
# TODO: check pre process very carefully
|
|
66 |
#
|
|
3378.1.24
by Naresh Choksy
Business Game in Progress..... |
67 |
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False): |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
68 |
res = super(profile_game_phase_one, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar) |
69 |
p_obj = self.pool.get('profile.game.phase2') |
|
3378.1.24
by Naresh Choksy
Business Game in Progress..... |
70 |
p_id = p_obj.search(cr,uid,[]) |
71 |
p_br = p_obj.browse(cr,uid,p_id) |
|
72 |
for rec in p_br: |
|
3387.3.5
by Naresh Choksy
Business Game |
73 |
if rec.sales_user_id.name or False: |
3378.1.24
by Naresh Choksy
Business Game in Progress..... |
74 |
hr_name = " " |
75 |
if rec.hr_user_id: |
|
76 |
hr_name = rec.hr_user_id.name |
|
3404.1.8
by Naresh Choksy
modification in Business Game |
77 |
res['arch'] = res['arch'].replace('(SM)', rec.sales_user_id.name) |
78 |
res['arch'] = res['arch'].replace('(HRM)',hr_name) |
|
79 |
res['arch'] = res['arch'].replace('(FM)',rec.finance_user_id.name) |
|
80 |
res['arch'] = res['arch'].replace('(LM)', rec.logistic_user_id.name) |
|
3378.1.24
by Naresh Choksy
Business Game in Progress..... |
81 |
return res |
82 |
res['arch'] = res['arch'].replace('(SM)',"") |
|
3397.1.2
by Naresh Choksy
Business Game |
83 |
res['arch'] = res['arch'].replace('(HRM)',"") |
3378.1.24
by Naresh Choksy
Business Game in Progress..... |
84 |
res['arch'] = res['arch'].replace('(FM)',"") |
85 |
res['arch'] = res['arch'].replace('(LM)',"") |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
86 |
return res |
3372.1.5
by Naresh Choksy
business game started new concept |
87 |
|
3326.1.3
by Harshad Modi
profile_game |
88 |
def error(self, cr, uid,step_id, msg=''): |
89 |
err_msg='' |
|
90 |
step=step_id and self.pool.get('game.scenario.step').browse(cr,uid,step_id) or False |
|
91 |
if step: |
|
92 |
err_msg=step.error |
|
3378.1.24
by Naresh Choksy
Business Game in Progress..... |
93 |
raise Exception("%s -- %s\n\n%s"%('warning', _('Warning !'), err_msg+'\n\n'+msg)) |
3350
by Fabien Pinckaers
improvements |
94 |
|
3326.1.3
by Harshad Modi
profile_game |
95 |
def pre_process_quotation(self, cr,uid,step_id, object, method,type, *args): |
96 |
if (not method) and type!='execute': |
|
97 |
return False |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
98 |
if ((object not in ("sale.order", 'sale.order.line')) and (method in ('create','write','unlink'))): |
99 |
self.error(cr, uid,step_id) |
|
3326.1.3
by Harshad Modi
profile_game |
100 |
return (object in ("sale.order", 'sale.order.line')) and (method in ('create')) |
101 |
||
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
102 |
def post_process_quotation(self,cr,uid,step_id,object, method,type,*args): |
3326.1.3
by Harshad Modi
profile_game |
103 |
res=args[-1] |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
104 |
res=res and res.get('result',False) or False |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
105 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
106 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
107 |
if pid and res: |
108 |
return self.write(cr,uid,pid,{'step1':True,'state':'print_quote','step1_so_id':res}) |
|
109 |
return False |
|
110 |
||
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
111 |
def pre_process_print_quote(self,cr,uid,step_id,object, method,type,*args): |
3351
by Fabien Pinckaers
improved_business_game |
112 |
if (type=='execute') and (object not in ("sale.order", 'sale.order.line')) and (method in ('create','write','unlink')): |
113 |
self.error(cr, uid, step_id) |
|
114 |
if type=='execute_wkf': |
|
115 |
self.error(cr, uid, step_id) |
|
116 |
return (type=='report') and (object=="sale.order") |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
117 |
|
118 |
def post_process_print_quote(self,cr,uid,step_id,object, method,type,*args): |
|
119 |
res=args[-1] |
|
120 |
res=res and res.get('result',False) or False |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
121 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
122 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
123 |
if pid: |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
124 |
return self.write(cr,uid,pid,{'step2':True,'state':'sale'}) |
3326.1.3
by Harshad Modi
profile_game |
125 |
return False |
3350
by Fabien Pinckaers
improvements |
126 |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
127 |
def pre_process_sale(self,cr,uid,step_id,object, method,type,*args): |
3351
by Fabien Pinckaers
improved_business_game |
128 |
if (type=='execute') and (method in ('create','unlink')): |
129 |
self.error(cr, uid, step_id) |
|
130 |
if (type=='execute') and (object not in ("sale.order",'sale.order.line')) and (method=='write'): |
|
131 |
self.error(cr, uid, step_id) |
|
132 |
if type!='execute_wkf': |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
133 |
return False |
3351
by Fabien Pinckaers
improved_business_game |
134 |
if method<>'order_confirm': |
135 |
self.error(cr, uid, step_id) |
|
136 |
return True |
|
3350
by Fabien Pinckaers
improvements |
137 |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
138 |
def post_process_sale(self,cr,uid,step_id,object, method,type,*args): |
139 |
res=args[-1] |
|
140 |
res=res and res.get('result',False) or False |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
141 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
142 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
143 |
if pid: |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
144 |
return self.write(cr,uid,pid,{'step3':True,'state':'print_rfq'}) |
145 |
return False |
|
146 |
||
147 |
def pre_process_print_rfq(self, cr,uid,step_id, object, method,type, *args): |
|
3387.2.11
by Naresh Choksy
Business Game Almost Over |
148 |
if type == 'wizard': |
149 |
return False |
|
3350
by Fabien Pinckaers
improvements |
150 |
if (type=='execute') and ((object not in ("purchase.order", 'purchase.order.line')) and (method in ('create','write','unlink'))): |
151 |
self.error(cr, uid,step_id) |
|
152 |
if type not in ('execute','report'): |
|
153 |
self.error(cr, uid,step_id) |
|
3326.1.3
by Harshad Modi
profile_game |
154 |
#if type!='report' and (object in ("purchase.order", 'purchase.order.line') and (method not in ('fields_view_get','create','write','read','button_dummy'))):
|
155 |
# self.error(cr, uid,step_id)
|
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
156 |
return (type=='report' and (object in ("purchase.quotation"))) |
3326.1.3
by Harshad Modi
profile_game |
157 |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
158 |
def post_process_print_rfq(self,cr,uid,step_id,object, method,type,*args): |
3326.1.3
by Harshad Modi
profile_game |
159 |
res=args[-1] |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
160 |
res=res and res.get('result',False) or False |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
161 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
162 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3356.3.22
by Naresh Choksy
business game phase2 the whole flow is on |
163 |
if pid: |
3350
by Fabien Pinckaers
improvements |
164 |
self.write(cr,uid,pid,{'step4':True,'state':'modify_price'}) |
165 |
return True |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
166 |
return False |
3326.1.3
by Harshad Modi
profile_game |
167 |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
168 |
def pre_process_modify_price(self,cr,uid,step_id,object, method,type,*args): |
3326.1.3
by Harshad Modi
profile_game |
169 |
if type=='execute_wkf' and object in ("purchase.order", 'purchase.order.line'): |
170 |
self.error(cr, uid,step_id) |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
171 |
if ((object not in ("purchase.order", 'purchase.order.line')) and (method in ('create','write','unlink'))): |
172 |
self.error(cr, uid,step_id) |
|
173 |
return (object in ('purchase.order.line')) and (method in ('write')) |
|
174 |
||
175 |
def post_process_modify_price(self,cr,uid,step_id,object, method,type,*args): |
|
176 |
res=args[-1] |
|
177 |
res=res and res.get('result',False) or False |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
178 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
179 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
180 |
if pid: |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
181 |
return self.write(cr,uid,pid,{'step5':True,'state':'confirm_po'}) |
3326.1.3
by Harshad Modi
profile_game |
182 |
return False |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
183 |
def pre_process_confirm_po(self,cr,uid,step_id,object, method,type,*args): |
3326.1.3
by Harshad Modi
profile_game |
184 |
if type!='execute_wkf': |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
185 |
return False |
186 |
if ((object not in ("purchase.order",'purchase.order.line')) and (method in ('create','write','unlink'))): |
|
187 |
self.error(cr, uid,step_id) |
|
188 |
return (object in ("purchase.order")) and (method in ('purchase_confirm')) |
|
189 |
||
190 |
def post_process_confirm_po(self,cr,uid,step_id,object, method,type,*args): |
|
191 |
res=args[-1] |
|
192 |
res=res and res.get('result',False) or False |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
193 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
194 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
195 |
if pid: |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
196 |
return self.write(cr,uid,pid,{'step6':True,'state':'receive'}) |
197 |
return False |
|
198 |
||
199 |
def pre_process_receive(self,cr,uid,step_id,object, method,type,*args): |
|
3326.1.3
by Harshad Modi
profile_game |
200 |
# TO DO : fetch name of wizard
|
201 |
if type!='wizard': |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
202 |
return False |
3326.1.3
by Harshad Modi
profile_game |
203 |
wizard_id=args[0] |
3387.2.11
by Naresh Choksy
Business Game Almost Over |
204 |
object=args[1].get('model',False) |
205 |
if object: |
|
206 |
if object not in ("stock.picking"): |
|
207 |
self.error(cr, uid,step_id) |
|
208 |
return object in ("stock.picking") and wizard_id |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
209 |
|
210 |
def post_process_receive(self,cr,uid,step_id,object, method,type,*args): |
|
211 |
res=args[-1] |
|
212 |
res=res and res.get('result',False) or False |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
213 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
214 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
215 |
if pid: |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
216 |
return self.write(cr,uid,pid,{'step7':True,'state':'deliver'}) |
217 |
return False |
|
218 |
def pre_process_deliver(self,cr,uid,step_id,object, method,type,*args): |
|
3326.1.3
by Harshad Modi
profile_game |
219 |
# TO DO : fetch name of wizard
|
220 |
if type!='wizard': |
|
221 |
return False |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
222 |
|
3326.1.3
by Harshad Modi
profile_game |
223 |
wizard_id=args[0] |
224 |
object=args[1]['model'] |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
225 |
if object not in ("stock.picking"): |
226 |
self.error(cr, uid,step_id) |
|
227 |
return object in ("stock.picking") and wizard_id |
|
228 |
||
229 |
def post_process_deliver(self,cr,uid,step_id,object, method,type,*args): |
|
230 |
res=args[-1] |
|
231 |
res=res and res.get('result',False) or False |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
232 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
233 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
234 |
if pid: |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
235 |
return self.write(cr,uid,pid,{'step8':True,'state':'invoice_create'}) |
236 |
return False |
|
3326.1.3
by Harshad Modi
profile_game |
237 |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
238 |
def pre_process_invoice_create(self,cr,uid,step_id,object, method,type,*args): |
3351
by Fabien Pinckaers
improved_business_game |
239 |
if (type=='execute') and ((object not in ("account.invoice",'account.invoice.line')) and (method in ('create','write','unlink'))): |
240 |
self.error(cr, uid,step_id) |
|
241 |
if (type!='execute_wkf'): |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
242 |
return False |
3351
by Fabien Pinckaers
improved_business_game |
243 |
if (type=='execute_wkf') and (method<>'invoice_open'): |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
244 |
self.error(cr, uid,step_id) |
3351
by Fabien Pinckaers
improved_business_game |
245 |
return True |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
246 |
|
247 |
def post_process_invoice_create(self,cr,uid,step_id,object, method,type,*args): |
|
248 |
res=args[-1] |
|
249 |
res=res and res.get('result',False) or False |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
250 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
251 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
252 |
if pid: |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
253 |
return self.write(cr,uid,pid,{'step9':True,'state':'invoice_print'}) |
254 |
return False |
|
3326.1.3
by Harshad Modi
profile_game |
255 |
|
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
256 |
def pre_process_invoice_print(self, cr,uid,step_id, object, method,type, *args): |
3326.1.3
by Harshad Modi
profile_game |
257 |
if type!='report' and (object not in ("account.invoice", 'account.invoice.line')): |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
258 |
return False |
3326.1.3
by Harshad Modi
profile_game |
259 |
#if type!='report' and (object in ("account.invoice", 'account.invoice.line') and (method not in ('create','write','read','button_dummy'))):
|
260 |
# self.error(cr, uid,step_id)
|
|
261 |
return (type=='report' and (object in ("account.invoice", 'account.invoice.line'))) |
|
262 |
||
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
263 |
def post_process_invoice_print(self,cr,uid,step_id,object, method,type,*args): |
3326.1.3
by Harshad Modi
profile_game |
264 |
res=args[-1] |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
265 |
res=res and res.get('result',False) or False |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
266 |
pid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
267 |
pid = self.pool.get('ir.model.data').browse(cr, uid, pid).res_id |
3326.1.3
by Harshad Modi
profile_game |
268 |
if pid: |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
269 |
sid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'retail_phase1') |
3356.3.22
by Naresh Choksy
business game phase2 the whole flow is on |
270 |
sid = self.pool.get('ir.model.data').browse(cr, uid, sid).res_id |
271 |
self.pool.get('game.scenario').write(cr, uid, [sid], {'state':'done'}) |
|
3326.1.3
by Harshad Modi
profile_game |
272 |
return self.write(cr,uid,pid,{'step10':True,'state':'done'}) |
273 |
return False |
|
274 |
||
3378.1.25
by Naresh Choksy
Business Game changed the views,added new functions etc... |
275 |
def generate_account_chart(self, cr, uid, ids, context={}): |
3382.1.25
by Naresh Choksy
Business Game |
276 |
company_id = self.pool.get('res.users').browse(cr, uid, [uid])[0].company_id.id |
277 |
chart = self.pool.get('account.chart.template').search(cr, uid, []) |
|
278 |
wiz_id = self.pool.get('wizard.multi.charts.accounts').create(cr, uid, {'company_id':company_id, |
|
279 |
'chart_template_id':chart[0],'code_digits':6}) |
|
280 |
self.pool.get('wizard.multi.charts.accounts').action_create(cr, uid, [wiz_id], context) |
|
3387.1.8
by Naresh Choksy
Business Game |
281 |
acc_obj = self.pool.get('account.account') |
282 |
inc_acc_id = acc_obj.search(cr, uid, [('code','ilike','701000')])[0] |
|
283 |
exp_acc_id = acc_obj.search(cr, uid, [('code','ilike','601000')])[0] |
|
3387.1.30
by Naresh Choksy
Business Game |
284 |
close_acc = acc_obj.search(cr, uid, [('code','ilike','911000')])[0] |
285 |
acc_obj.write(cr ,uid, close_acc, {'type':'other'}) |
|
3387.1.8
by Naresh Choksy
Business Game |
286 |
|
287 |
acc_journal = self.pool.get('account.journal') |
|
288 |
journal_ids = acc_journal.search(cr, uid, []) |
|
289 |
for journal in acc_journal.browse(cr, uid, journal_ids): |
|
3387.1.30
by Naresh Choksy
Business Game |
290 |
if journal.code in ('JB','SAJ','EXJ','JC'): |
3387.1.8
by Naresh Choksy
Business Game |
291 |
if journal.code == 'JB': |
3387.3.5
by Naresh Choksy
Business Game |
292 |
code = '512000' |
3387.1.8
by Naresh Choksy
Business Game |
293 |
if journal.code == 'SAJ': |
3387.3.5
by Naresh Choksy
Business Game |
294 |
code = '411100' |
3387.1.8
by Naresh Choksy
Business Game |
295 |
if journal.code == 'EXJ': |
3387.3.5
by Naresh Choksy
Business Game |
296 |
code = '401100' |
3387.1.30
by Naresh Choksy
Business Game |
297 |
if journal.code == 'JC': |
3387.3.5
by Naresh Choksy
Business Game |
298 |
code = '911000' |
299 |
account = acc_obj.search(cr, uid, [('code','ilike',code)])[0] |
|
300 |
acc_journal.write(cr, uid, journal.id, {'default_debit_account_id':account, |
|
301 |
'default_credit_account_id':account}) |
|
3382.1.33
by Naresh Choksy
Business Game .... |
302 |
for product in self.pool.get('product.product').search(cr, uid, []): |
3382.1.25
by Naresh Choksy
Business Game |
303 |
self.pool.get('product.product').write(cr, uid, product, |
304 |
{'property_account_income':inc_acc_id,'property_account_expense':exp_acc_id}) |
|
3382.1.33
by Naresh Choksy
Business Game .... |
305 |
return True |
3382.1.25
by Naresh Choksy
Business Game |
306 |
|
3326.1.3
by Harshad Modi
profile_game |
307 |
def confirm(self, cr, uid, ids, context={}): |
3378.1.25
by Naresh Choksy
Business Game changed the views,added new functions etc... |
308 |
self.generate_account_chart(cr, uid, ids, context) |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
309 |
phase2_obj = self.pool.get('profile.game.phase2') |
3382.1.25
by Naresh Choksy
Business Game |
310 |
phase2_obj.create_fiscalyear_and_period(cr, uid, ids, context) |
3326.1.3
by Harshad Modi
profile_game |
311 |
self.write(cr, uid, ids, {'state':'quotation'}) |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
312 |
sid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'retail_phase1') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
313 |
sid = self.pool.get('ir.model.data').browse(cr, uid, sid, context=context).res_id |
3326.1.3
by Harshad Modi
profile_game |
314 |
self.pool.get('game.scenario').write(cr, uid, [sid], {'state':'running'}) |
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
315 |
sid = self.pool.get('ir.model.data')._get_id(cr, uid, 'profile_business_game', 'step_quotation') |
3335.1.6
by Naresh Choksy
modified views,objects,functions and added new functions in profile_game_retail |
316 |
sid = self.pool.get('ir.model.data').browse(cr, uid, sid, context=context).res_id |
317 |
return self.pool.get('game.scenario.step').write(cr, uid, [sid], {'state':'running'}) |
|
3326.1.3
by Harshad Modi
profile_game |
318 |
|
3387.1.4
by Naresh Choksy
Business Game |
319 |
def check_state(self, cr, uid, context = {}): |
320 |
curr_id = self.search(cr, uid, [])[0] |
|
321 |
obj = self.browse(cr, uid, curr_id) |
|
322 |
if obj.state != 'started_phase2': |
|
323 |
return False |
|
3387.3.5
by Naresh Choksy
Business Game |
324 |
return True |
3387.1.4
by Naresh Choksy
Business Game |
325 |
|
3404.1.12
by Naresh Choksy
Business Game Renamed and some modification |
326 |
profile_game_phase_one() |
3326.1.3
by Harshad Modi
profile_game |
327 |
|
3378.1.24
by Naresh Choksy
Business Game in Progress..... |
328 |
class sale_order(osv.osv): |
329 |
_inherit = "sale.order" |
|
330 |
_columns = {} |
|
331 |
_defaults = { |
|
332 |
'order_policy': lambda *a: 'postpaid', |
|
333 |
}
|
|
334 |
sale_order() |
|
335 |
||
336 |