bzr revid: fp@tinyerp.com-20080925093313-40a9z0wy9mbqs41p
This commit is contained in:
Fabien Pinckaers
2008-09-25 11:33:13 +02:00
4 changed files with 65 additions and 56 deletions
+13 -7
View File
@@ -924,15 +924,21 @@ class account_move_reconcile(osv.osv):
{'reconcile_id': rec.id }
)
return True
def name_get(self, cr, uid, ids, context=None):
result = {}
if not len(ids):
return []
result = []
for r in self.browse(cr, uid, ids, context):
total = reduce(lambda y,t: (t.debit or 0.0) - (t.credit or 0.0) + y, r.line_partial_ids, 0.0)
if total:
result[r.id] = '%s (%.2f)' % (r.name, total)
name = '%s (%.2f)' % (r.name, total)
result.append((r.id,name))
else:
result[r.id] = r.name
result.append((r.id,r.name))
return result
account_move_reconcile()
#----------------------------------------------------------
@@ -1510,7 +1516,7 @@ class account_config_wizard(osv.osv_memory):
}
def install_account_chart(self, cr, uid,ids, context=None):
for res in self.read(cr,uid,ids):
for res in self.read(cr,uid,ids):
id = res['charts']
def install(id):
mod_obj = self.pool.get('ir.module.module')
@@ -1558,7 +1564,7 @@ class account_config_wizard(osv.osv_memory):
'target':'new',
}
account_config_wizard()
@@ -2036,8 +2042,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'res_model': 'ir.module.module.configuration.wizard',
'type': 'ir.actions.act_window',
'target':'new',
}
}
wizard_multi_charts_accounts()
+2 -2
View File
@@ -481,7 +481,7 @@ class account_move_line(osv.osv):
self_debit = -writeoff
# If comment exist in context, take it
if context['comment']:
if 'comment' in context and context['comment']:
libelle=context['comment']
else:
libelle='Write-Off'
@@ -629,7 +629,7 @@ class account_move_line(osv.osv):
if raise_ex:
raise osv.except_osv(_('Wrong Accounting Entry!'), _('Both Credit and Debit cannot be zero!'))
account_obj = self.pool.get('account.account')
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
raise osv.except_osv(_('Bad account!'), _('You can not use an inactive account!'))
if update_check:
+1 -46
View File
@@ -208,51 +208,6 @@ class crossovered_budget_lines(osv.osv):
}
crossovered_budget_lines()
#class account_budget_post(osv.osv): #old code
# _name = 'account.budget.post'
# _inherit = 'account.budget.post'
# _columns = {
# 'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'general_budget_id', 'Budget Lines'),
# }
#account_budget_post()
#
#class account_budget_post_dotation(osv.osv):
# _name = 'account.budget.post.dotation'
# _inherit = 'account.budget.post.dotation'
#
# def _tot_planned(self, cr, uid, ids,name,args,context):
# res={}
# for line in self.browse(cr, uid, ids):
# if line.period_id:
# obj_period=self.pool.get('account.period').browse(cr, uid,line.period_id.id)
#
# total_days=strToDate(obj_period.date_stop) - strToDate(obj_period.date_start)
# budget_id=line.post_id and line.post_id.id or False
# query="select id from crossovered_budget_lines where general_budget_id= '"+ str(budget_id) + "' AND (date_from >='" +obj_period.date_start +"' and date_from <= '"+obj_period.date_stop + "') OR (date_to >='" +obj_period.date_start +"' and date_to <= '"+obj_period.date_stop + "') OR (date_from <'" +obj_period.date_start +"' and date_to > '"+obj_period.date_stop + "')"
# cr.execute(query)
# res1=cr.fetchall()
#
# tot_planned=0.00
# for record in res1:
# obj_lines = self.pool.get('crossovered.budget.lines').browse(cr, uid,record[0])
# count_days = min(strToDate(obj_period.date_stop),strToDate(obj_lines.date_to)) - max(strToDate(obj_period.date_start), strToDate(obj_lines.date_from))
# days_in_period = count_days.days +1
# count_days = strToDate(obj_lines.date_to) - strToDate(obj_lines.date_from)
# total_days_of_rec = count_days.days +1
# tot_planned += obj_lines.planned_amount/total_days_of_rec* days_in_period
# res[line.id]=tot_planned
# else:
# res[line.id]=0.00
# return res
#
# _columns = {
# 'tot_planned':fields.function(_tot_planned,method=True, string='Total Planned Amount',type='float',store=True),
# }
#
#account_budget_post_dotation()
class account_analytic_account(osv.osv):
_name = 'account.analytic.account'
_inherit = 'account.analytic.account'
@@ -266,7 +221,7 @@ account_analytic_account()
#--------------------------------------------------------------
# moved from account/project/project.py
# ---------------------------------------------------------
# Budgets
# Budgets.
# ---------------------------------------------------------
#class account_analytic_budget_post(osv.osv):
+49 -1
View File
@@ -204,7 +204,7 @@ class process_process(osv.osv):
update_relatives(r, _id, _model)
for nid, node in nodes.items():
if node['active'] or node['model'] == res_model:
if not node['gray'] and (node['active'] or node['model'] == res_model):
update_relatives(nid, res_id, res_model)
break
@@ -231,6 +231,44 @@ class process_process(osv.osv):
return dict(title=title, perm=perm, notes=notes, nodes=nodes, transitions=transitions)
def copy(self, cr, uid, id, default=None, context={}):
""" Deep copy the entire process.
"""
if not default:
default = {}
pool = pooler.get_pool(cr.dbname)
process = pool.get('process.process').browse(cr, uid, [id], context)[0]
nodes = {}
transitions = {}
# first copy all nodes and and map the new nodes with original for later use in transitions
for node in process.node_ids:
for t in node.transition_in:
tr = transitions.setdefault(t.id, {})
tr['target'] = node.id
for t in node.transition_out:
tr = transitions.setdefault(t.id, {})
tr['source'] = node.id
nodes[node.id] = pool.get('process.node').copy(cr, uid, node.id, context=context)
# then copy transitions with new nodes
for tid, tr in transitions.items():
vals = {
'source_node_id': nodes[tr['source']],
'target_node_id': nodes[tr['target']]
}
tr = pool.get('process.transition').copy(cr, uid, tid, default=vals, context=context)
# and finally copy the process itself with new nodes
default.update({
'active': True,
'node_ids': [(6, 0, nodes.values())]
})
return super(process_process, self).copy(cr, uid, id, default, context)
process_process()
class process_node(osv.osv):
@@ -256,6 +294,16 @@ class process_node(osv.osv):
'model_states': lambda *args: False,
'flow_start': lambda *args: False,
}
def copy(self, cr, uid, id, default=None, context={}):
if not default:
default = {}
default.update({
'transition_in': [],
'transition_out': []
})
return super(process_node, self).copy(cr, uid, id, default, context)
process_node()
class process_node_condition(osv.osv):