From c8d51ca11f4773b4dcdccaaf4245b6e70eca323a Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Mon, 22 Sep 2008 15:39:23 +0530 Subject: [PATCH 1/6] Node with related resource information. bzr revid: ame@tinyerp.com-20080922100923-37nk60zyqv3hxoai --- addons/process/process.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/process/process.py b/addons/process/process.py index 7e53beb4b87..636135cc8e6 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -79,9 +79,12 @@ class process_process(osv.osv): ret = False for name, field in fields.items(): - if node.model_id and field.get('relation', False) == node.model_id.model: - #TODO: get resource info - pass + if node.model_id and field.get('relation', False) == node.model_id.model and current_object[name]: + rel = current_object[name][0] + ret = {} + ret['name'] = rel.name_get(context)[0][1] + ret['model'] = field['relation'] + ret['id'] = rel.id return ret From 1d155900cfa11b1401717bfa7be1cab52300fb39 Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Mon, 22 Sep 2008 16:02:12 +0530 Subject: [PATCH 2/6] Added Tooltips on fields of account_payment module bzr revid: jvo@tinyerp.com-20080922103212-65t7r14t6t7tb7xb --- addons/account_payment/__init__.py | 1 + addons/account_payment/payment.py | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/addons/account_payment/__init__.py b/addons/account_payment/__init__.py index 3b652e0b3a3..7fc464279cd 100644 --- a/addons/account_payment/__init__.py +++ b/addons/account_payment/__init__.py @@ -36,6 +36,7 @@ import payment import wizard import account_move_line import account_invoice +import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_payment/payment.py b/addons/account_payment/payment.py index 3f4665878b8..22ca132453c 100644 --- a/addons/account_payment/payment.py +++ b/addons/account_payment/payment.py @@ -39,8 +39,8 @@ class payment_type(osv.osv): _name= 'payment.type' _description= 'Payment type' _columns= { - 'name': fields.char('Name', size=64, required=True), - 'code': fields.char('Code', size=64, required=True), + 'name': fields.char('Name', size=64, required=True,help='Payment Type'), + 'code': fields.char('Code', size=64, required=True,help='Specify the Code for Payment Type'), 'suitable_bank_types': fields.many2many('res.partner.bank.type', 'bank_type_payment_type_rel', 'pay_type_id','bank_type_id', @@ -54,12 +54,12 @@ class payment_mode(osv.osv): _name= 'payment.mode' _description= 'Payment mode' _columns= { - 'name': fields.char('Name', size=64, required=True), + 'name': fields.char('Name', size=64, required=True,help='Mode of Payment'), 'bank_id': fields.many2one('res.partner.bank', "Bank account", - required=True), + required=True,help='Bank Account for the Payment Mode'), 'journal': fields.many2one('account.journal', 'Journal', required=True, - domain=[('type', '=', 'cash')]), - 'type': fields.many2one('payment.type','Payment type',required=True), + domain=[('type', '=', 'cash')],help='Cash Journal for the Payment Mode'), + 'type': fields.many2one('payment.type','Payment type',required=True,help='Select the Payment Type for the Payment Mode.'), } def suitable_bank_types(self,cr,uid,payment_code=None,context={}): @@ -102,9 +102,9 @@ class payment_order(osv.osv): return res _columns = { - 'date_planned': fields.date('Scheduled date if fixed'), + 'date_planned': fields.date('Scheduled date if fixed',help='Select a date if you have chosen Preferred Date to be fixed.'), 'reference': fields.char('Reference',size=128,required=1), - 'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1), + 'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1,help='Select the Payment Mode to be applied.'), 'state': fields.selection([ ('draft', 'Draft'), ('open','Confirmed'), @@ -118,7 +118,7 @@ class payment_order(osv.osv): ('now', 'Directly'), ('due', 'Due date'), ('fixed', 'Fixed date') - ], "Prefered date", change_default=True, required=True), + ], "Prefered date", change_default=True, required=True,help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."), 'date_created': fields.date('Creation date', readonly=True), 'date_done': fields.date('Execution date', readonly=True), } @@ -381,9 +381,9 @@ class payment_line(osv.osv): _columns = { 'name': fields.char('Your Reference', size=64, required=True), - 'communication': fields.char('Communication', size=64, required=True), - 'communication2': fields.char('Communication 2', size=64), - 'move_line_id': fields.many2one('account.move.line','Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')]), + 'communication': fields.char('Communication', size=64, required=True,help="Used as the message between ordering customer and current company.Depicts 'What do you want to say to the receipent about this oder?'"), + 'communication2': fields.char('Communication 2', size=64,help='The successor message of Communication.'), + 'move_line_id': fields.many2one('account.move.line','Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')],help='This Entry Line will be referred for the information of the ordering customer.'), 'amount_currency': fields.float('Amount in Partner Currency', digits=(16,2), required=True, help='Payment amount in the partner currency'), # 'to_pay_currency': fields.function(_to_pay_currency, string='To Pay', @@ -396,7 +396,7 @@ class payment_line(osv.osv): 'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'), 'order_id': fields.many2one('payment.order', 'Order', required=True, ondelete='cascade', select=True), - 'partner_id': fields.many2one('res.partner', string="Partner",required=True), + 'partner_id': fields.many2one('res.partner', string="Partner",required=True,help='The Ordering Customer'), 'amount': fields.function(_amount, string='Amount in Company Currency', method=True, type='float', help='Payment amount in the company currency'), @@ -410,8 +410,8 @@ class payment_line(osv.osv): # type='char'), 'ml_maturity_date': fields.function(_get_ml_maturity_date, method=True, type='char', string='Maturity Date'), 'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='many2one', relation='account.invoice', string='Invoice Ref'), - 'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text"), - 'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text"), + 'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text",help='Address of the Main Partner'), + 'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text",help='Address of the Ordering Customer.'), # 'partner_payable': fields.function(partner_payable, string="Partner payable", method=True, type='float'), # 'value_date': fields.function(_value_date, string='Value Date', # method=True, type='date'), From ceb689c8e236d94c06c44e96b6291958e43fb76f Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Mon, 22 Sep 2008 16:11:44 +0530 Subject: [PATCH 3/6] Node with related resource information. bzr revid: ame@tinyerp.com-20080922104144-piob6t3zdt2zgcnj --- addons/process/process.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/addons/process/process.py b/addons/process/process.py index 636135cc8e6..8cd51798708 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -73,18 +73,34 @@ class process_process(osv.osv): expr_context = Env(current_object, current_user) - fields = pool.get(res_model).fields_get(cr, uid, context=context) - def get_resource_info(node): ret = False + src_model = res_model + src_id = res_id + + if node.transition_in: + tr = node.transition_in[0] + src = nodes.get(tr.source_node_id.id) + if src['res']: + src_model = src['res']['model'] + src_id = src['res']['id'] + else: + return False + + fields = pool.get(src_model).fields_get(cr, uid, context=context) + for name, field in fields.items(): - if node.model_id and field.get('relation', False) == node.model_id.model and current_object[name]: - rel = current_object[name][0] - ret = {} - ret['name'] = rel.name_get(context)[0][1] - ret['model'] = field['relation'] - ret['id'] = rel.id + if node.model_id and field.get('relation', False) == node.model_id.model: + src_obj = pool.get(src_model).browse(cr, uid, [src_id], context)[0] + rel = src_obj[name] + if rel: + if isinstance(rel, (list, tuple)): + rel = rel[0] + ret = {} + ret['name'] = rel.name_get(context)[0][1] + ret['model'] = field['relation'] + ret['id'] = rel.id return ret From 3128a6f16a38c243dc79ca461a6ee2d8aff78fe7 Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Mon, 22 Sep 2008 17:28:05 +0530 Subject: [PATCH 4/6] Process Notes. bzr revid: ame@tinyerp.com-20080922115805-v74barv0qb07ehxg --- addons/process/process.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/process/process.py b/addons/process/process.py index 8cd51798708..16c16805e18 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -104,6 +104,7 @@ class process_process(osv.osv): return ret + notes = process.note nodes = {} start = [] transitions = {} @@ -113,7 +114,7 @@ class process_process(osv.osv): data['name'] = node.name data['model'] = (node.model_id or None) and node.model_id.model data['kind'] = node.kind - data['subflow'] = (node.subflow_id or None) and node.subflow_id.id + data['subflow'] = (node.subflow_id or False) and [node.subflow_id.id, node.subflow_id.name] data['notes'] = node.note data['active'] = False data['gray'] = False @@ -189,7 +190,7 @@ class process_process(osv.osv): for k, v in nodes.items(): y = v['y'] v['y'] = min(y - miny + 10, y) - return dict(nodes=nodes, transitions=transitions) + return dict(notes=notes, nodes=nodes, transitions=transitions) process_process() From c8f452b00070c3ff6d1a34a32333190fe88e8a0c Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Mon, 22 Sep 2008 18:49:45 +0530 Subject: [PATCH 5/6] Roles for Process transition. bzr revid: ame@tinyerp.com-20080922131945-740do6g3tbo1ipls --- addons/process/process.py | 5 +++++ addons/process/process_view.xml | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/addons/process/process.py b/addons/process/process.py index 16c16805e18..73af1beffec 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -169,6 +169,10 @@ class process_process(osv.osv): role = {} role['name'] = r.role_id.name roles.append(role) + for r in tr.role_ids: + role = {} + role['name'] = r.name + roles.append(role) transitions[tr.id] = data g = tools.graph(nodes.keys(), map(lambda x: (x['source'], x['target']), transitions.values())) @@ -238,6 +242,7 @@ class process_transition(osv.osv): 'target_node_id': fields.many2one('process.node', 'Target Node', required=True, ondelete='cascade'), 'action_ids': fields.one2many('process.transition.action', 'transition_id', 'Buttons'), 'transition_ids': fields.many2many('workflow.transition', 'process_transition_ids', 'ptr_id', 'wtr_id', 'Workflow Transitions'), + 'role_ids': fields.many2many('res.roles', 'process_transition_roles_rel', 'tid', 'rid', 'Roles'), 'note': fields.text('Description', translate=True), } process_transition() diff --git a/addons/process/process_view.xml b/addons/process/process_view.xml index 20015d17e64..d5ae44a2a55 100644 --- a/addons/process/process_view.xml +++ b/addons/process/process_view.xml @@ -63,6 +63,9 @@ + + + @@ -189,6 +192,9 @@ + + + @@ -276,9 +282,13 @@ - - - + + + + + + + From 15b7e9b6b695169325b4e85b6cb5d60c8021c7e9 Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Mon, 22 Sep 2008 20:29:28 +0530 Subject: [PATCH 6/6] Process title with current resource info. bzr revid: ame@tinyerp.com-20080922145928-d1llezo3shuxw6az --- addons/process/process.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/process/process.py b/addons/process/process.py index 73af1beffec..2f3648a86f3 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -103,12 +103,15 @@ class process_process(osv.osv): ret['id'] = rel.id return ret - + notes = process.note nodes = {} start = [] transitions = {} + states = dict(pool.get(res_model).fields_get(cr, uid, context=context).get('state', {}).get('selection', {})) + title = "%s - Resource: %s, State: %s" % (process.name, current_object.name, states.get(getattr(current_object, 'state'), 'N/A')) + for node in process.node_ids: data = {} data['name'] = node.name @@ -180,8 +183,8 @@ class process_process(osv.osv): #g.scale(100, 100, 180, 120) g.scale(*scale) graph = g.result_get() - miny = -1 + miny = -1 for k,v in nodes.items(): x = graph[k]['y'] y = graph[k]['x'] @@ -194,7 +197,8 @@ class process_process(osv.osv): for k, v in nodes.items(): y = v['y'] v['y'] = min(y - miny + 10, y) - return dict(notes=notes, nodes=nodes, transitions=transitions) + + return dict(title=title, notes=notes, nodes=nodes, transitions=transitions) process_process()