bzr revid: fp@tinyerp.com-20080922224601-2w8a8txrvbicsxey
This commit is contained in:
Fabien Pinckaers 2008-09-23 00:46:01 +02:00
commit c3b84c01d6
4 changed files with 66 additions and 26 deletions

View File

@ -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:

View File

@ -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'),

View File

@ -73,28 +73,51 @@ 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:
#TODO: get resource info
pass
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
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
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
@ -149,6 +172,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()))
@ -156,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']
@ -170,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(nodes=nodes, transitions=transitions)
return dict(title=title, notes=notes, nodes=nodes, transitions=transitions)
process_process()
@ -218,6 +246,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()

View File

@ -63,6 +63,9 @@
</field>
</page>
<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"/>
</page>
<page string="Extra Information">
@ -189,6 +192,9 @@
</field>
</page>
<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"/>
</page>
<page string="Extra Information">
@ -276,9 +282,13 @@
</form>
</field>
</page>
<page string="Roles">
<field name="transition_ids" nolabel="1" colspan="4"/>
</page><page string="Notes">
<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"/>
</page>
<page string="Notes">
<field name="note" nolabel="1" colspan="4"/>
</page>
</notebook>