commit
c3b84c01d6
|
@ -36,6 +36,7 @@ import payment
|
||||||
import wizard
|
import wizard
|
||||||
import account_move_line
|
import account_move_line
|
||||||
import account_invoice
|
import account_invoice
|
||||||
|
import report
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ class payment_type(osv.osv):
|
||||||
_name= 'payment.type'
|
_name= 'payment.type'
|
||||||
_description= 'Payment type'
|
_description= 'Payment type'
|
||||||
_columns= {
|
_columns= {
|
||||||
'name': fields.char('Name', size=64, required=True),
|
'name': fields.char('Name', size=64, required=True,help='Payment Type'),
|
||||||
'code': fields.char('Code', size=64, required=True),
|
'code': fields.char('Code', size=64, required=True,help='Specify the Code for Payment Type'),
|
||||||
'suitable_bank_types': fields.many2many('res.partner.bank.type',
|
'suitable_bank_types': fields.many2many('res.partner.bank.type',
|
||||||
'bank_type_payment_type_rel',
|
'bank_type_payment_type_rel',
|
||||||
'pay_type_id','bank_type_id',
|
'pay_type_id','bank_type_id',
|
||||||
|
@ -54,12 +54,12 @@ class payment_mode(osv.osv):
|
||||||
_name= 'payment.mode'
|
_name= 'payment.mode'
|
||||||
_description= 'Payment mode'
|
_description= 'Payment mode'
|
||||||
_columns= {
|
_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",
|
'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,
|
'journal': fields.many2one('account.journal', 'Journal', required=True,
|
||||||
domain=[('type', '=', 'cash')]),
|
domain=[('type', '=', 'cash')],help='Cash Journal for the Payment Mode'),
|
||||||
'type': fields.many2one('payment.type','Payment type',required=True),
|
'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={}):
|
def suitable_bank_types(self,cr,uid,payment_code=None,context={}):
|
||||||
|
@ -102,9 +102,9 @@ class payment_order(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
_columns = {
|
_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),
|
'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([
|
'state': fields.selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
('open','Confirmed'),
|
('open','Confirmed'),
|
||||||
|
@ -118,7 +118,7 @@ class payment_order(osv.osv):
|
||||||
('now', 'Directly'),
|
('now', 'Directly'),
|
||||||
('due', 'Due date'),
|
('due', 'Due date'),
|
||||||
('fixed', 'Fixed 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_created': fields.date('Creation date', readonly=True),
|
||||||
'date_done': fields.date('Execution date', readonly=True),
|
'date_done': fields.date('Execution date', readonly=True),
|
||||||
}
|
}
|
||||||
|
@ -381,9 +381,9 @@ class payment_line(osv.osv):
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Your Reference', size=64, required=True),
|
'name': fields.char('Your Reference', size=64, required=True),
|
||||||
'communication': fields.char('Communication', size=64, required=True),
|
'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),
|
'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')]),
|
'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),
|
'amount_currency': fields.float('Amount in Partner Currency', digits=(16,2),
|
||||||
required=True, help='Payment amount in the partner currency'),
|
required=True, help='Payment amount in the partner currency'),
|
||||||
# 'to_pay_currency': fields.function(_to_pay_currency, string='To Pay',
|
# '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'),
|
'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'),
|
||||||
'order_id': fields.many2one('payment.order', 'Order', required=True,
|
'order_id': fields.many2one('payment.order', 'Order', required=True,
|
||||||
ondelete='cascade', select=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',
|
'amount': fields.function(_amount, string='Amount in Company Currency',
|
||||||
method=True, type='float',
|
method=True, type='float',
|
||||||
help='Payment amount in the company currency'),
|
help='Payment amount in the company currency'),
|
||||||
|
@ -410,8 +410,8 @@ class payment_line(osv.osv):
|
||||||
# type='char'),
|
# type='char'),
|
||||||
'ml_maturity_date': fields.function(_get_ml_maturity_date, method=True, type='char', string='Maturity Date'),
|
'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'),
|
'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_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"),
|
'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'),
|
# 'partner_payable': fields.function(partner_payable, string="Partner payable", method=True, type='float'),
|
||||||
# 'value_date': fields.function(_value_date, string='Value Date',
|
# 'value_date': fields.function(_value_date, string='Value Date',
|
||||||
# method=True, type='date'),
|
# method=True, type='date'),
|
||||||
|
|
|
@ -73,28 +73,51 @@ class process_process(osv.osv):
|
||||||
|
|
||||||
expr_context = Env(current_object, current_user)
|
expr_context = Env(current_object, current_user)
|
||||||
|
|
||||||
fields = pool.get(res_model).fields_get(cr, uid, context=context)
|
|
||||||
|
|
||||||
def get_resource_info(node):
|
def get_resource_info(node):
|
||||||
ret = False
|
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():
|
for name, field in fields.items():
|
||||||
if node.model_id and field.get('relation', False) == node.model_id.model:
|
if node.model_id and field.get('relation', False) == node.model_id.model:
|
||||||
#TODO: get resource info
|
src_obj = pool.get(src_model).browse(cr, uid, [src_id], context)[0]
|
||||||
pass
|
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
|
return ret
|
||||||
|
|
||||||
|
notes = process.note
|
||||||
nodes = {}
|
nodes = {}
|
||||||
start = []
|
start = []
|
||||||
transitions = {}
|
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:
|
for node in process.node_ids:
|
||||||
data = {}
|
data = {}
|
||||||
data['name'] = node.name
|
data['name'] = node.name
|
||||||
data['model'] = (node.model_id or None) and node.model_id.model
|
data['model'] = (node.model_id or None) and node.model_id.model
|
||||||
data['kind'] = node.kind
|
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['notes'] = node.note
|
||||||
data['active'] = False
|
data['active'] = False
|
||||||
data['gray'] = False
|
data['gray'] = False
|
||||||
|
@ -149,6 +172,10 @@ class process_process(osv.osv):
|
||||||
role = {}
|
role = {}
|
||||||
role['name'] = r.role_id.name
|
role['name'] = r.role_id.name
|
||||||
roles.append(role)
|
roles.append(role)
|
||||||
|
for r in tr.role_ids:
|
||||||
|
role = {}
|
||||||
|
role['name'] = r.name
|
||||||
|
roles.append(role)
|
||||||
transitions[tr.id] = data
|
transitions[tr.id] = data
|
||||||
|
|
||||||
g = tools.graph(nodes.keys(), map(lambda x: (x['source'], x['target']), transitions.values()))
|
g = tools.graph(nodes.keys(), map(lambda x: (x['source'], x['target']), transitions.values()))
|
||||||
|
@ -156,8 +183,8 @@ class process_process(osv.osv):
|
||||||
#g.scale(100, 100, 180, 120)
|
#g.scale(100, 100, 180, 120)
|
||||||
g.scale(*scale)
|
g.scale(*scale)
|
||||||
graph = g.result_get()
|
graph = g.result_get()
|
||||||
miny = -1
|
|
||||||
|
|
||||||
|
miny = -1
|
||||||
for k,v in nodes.items():
|
for k,v in nodes.items():
|
||||||
x = graph[k]['y']
|
x = graph[k]['y']
|
||||||
y = graph[k]['x']
|
y = graph[k]['x']
|
||||||
|
@ -170,7 +197,8 @@ class process_process(osv.osv):
|
||||||
for k, v in nodes.items():
|
for k, v in nodes.items():
|
||||||
y = v['y']
|
y = v['y']
|
||||||
v['y'] = min(y - miny + 10, y)
|
v['y'] = min(y - miny + 10, y)
|
||||||
return dict(nodes=nodes, transitions=transitions)
|
|
||||||
|
return dict(title=title, notes=notes, nodes=nodes, transitions=transitions)
|
||||||
|
|
||||||
process_process()
|
process_process()
|
||||||
|
|
||||||
|
@ -218,6 +246,7 @@ class process_transition(osv.osv):
|
||||||
'target_node_id': fields.many2one('process.node', 'Target Node', required=True, ondelete='cascade'),
|
'target_node_id': fields.many2one('process.node', 'Target Node', required=True, ondelete='cascade'),
|
||||||
'action_ids': fields.one2many('process.transition.action', 'transition_id', 'Buttons'),
|
'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'),
|
'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),
|
'note': fields.text('Description', translate=True),
|
||||||
}
|
}
|
||||||
process_transition()
|
process_transition()
|
||||||
|
|
|
@ -63,6 +63,9 @@
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page string="Roles Required">
|
<page string="Roles Required">
|
||||||
|
<field name="role_ids" colspan="4" nolabel="1"/>
|
||||||
|
</page>
|
||||||
|
<page string="Roles from Workflow">
|
||||||
<field name="transition_ids" colspan="4" nolabel="1"/>
|
<field name="transition_ids" colspan="4" nolabel="1"/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Extra Information">
|
<page string="Extra Information">
|
||||||
|
@ -189,6 +192,9 @@
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page string="Roles Required">
|
<page string="Roles Required">
|
||||||
|
<field name="role_ids" colspan="4" nolabel="1"/>
|
||||||
|
</page>
|
||||||
|
<page string="Roles from Workflow">
|
||||||
<field name="transition_ids" colspan="4" nolabel="1"/>
|
<field name="transition_ids" colspan="4" nolabel="1"/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Extra Information">
|
<page string="Extra Information">
|
||||||
|
@ -276,9 +282,13 @@
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page string="Roles">
|
<page string="Roles Required">
|
||||||
<field name="transition_ids" nolabel="1" colspan="4"/>
|
<field name="role_ids" colspan="4" nolabel="1"/>
|
||||||
</page><page string="Notes">
|
</page>
|
||||||
|
<page string="Roles from Workflow">
|
||||||
|
<field name="transition_ids" colspan="4" nolabel="1"/>
|
||||||
|
</page>
|
||||||
|
<page string="Notes">
|
||||||
<field name="note" nolabel="1" colspan="4"/>
|
<field name="note" nolabel="1" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
|
|
Loading…
Reference in New Issue