bzr revid: fp@tinyerp.com-20081021163015-ik6v6rzyytb2czrz
This commit is contained in:
Fabien Pinckaers 2008-10-21 18:30:15 +02:00
commit f7fc628eea
62 changed files with 2446 additions and 181 deletions

17
addons/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>pso-newaddons</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

View File

@ -31,13 +31,13 @@ import rml_parse
from report import report_sxw
class aged_trial_report(rml_parse.rml_parse):
def __init__(self, cr, uid, name, context):
super(aged_trial_report, self).__init__(cr, uid, name, context)
self.line_query = ''
self.total_account = []
self.localcontext.update({
'time': time,
'get_lines': self._get_lines,
@ -46,19 +46,19 @@ class aged_trial_report(rml_parse.rml_parse):
'get_for_period': self._get_for_period,
'get_company': self._get_company,
'get_currency': self._get_currency,
})
def _get_lines(self, form):
if (form['result_selection'] == 'customer' ):
self.ACCOUNT_TYPE = "('receivable')"
elif (form['result_selection'] == 'supplier'):
self.ACCOUNT_TYPE = "('payable')"
else:
self.ACCOUNT_TYPE = "('payable','receivable')"
res = []
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
@ -78,7 +78,7 @@ class aged_trial_report(rml_parse.rml_parse):
for i in range(7):
self.total_account.append(0)
#
for partner in partners:
values = {}
## If choise selection is in the future
@ -94,7 +94,7 @@ class aged_trial_report(rml_parse.rml_parse):
"AND account_account.active",
(form['date1'], partner['id'],form['date1'], form['company_id']))
before = self.cr.fetchone()
self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
values['direction'] = before and before[0] or 0.0
@ -112,7 +112,6 @@ class aged_trial_report(rml_parse.rml_parse):
after = self.cr.fetchone()
self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
values['direction'] = after and after[0] or ""
#print str(values['direction'])
for i in range(5):
self.cr.execute("SELECT SUM(debit-credit) " \
"FROM account_move_line AS line, account_account " \
@ -128,8 +127,6 @@ class aged_trial_report(rml_parse.rml_parse):
during = self.cr.fetchone()
# Ajout du compteur
self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
#print str(during)
values[str(i)] = during and during[0] or ""
self.cr.execute("SELECT SUM(debit-credit) " \
"FROM account_move_line AS line, account_account " \
@ -145,19 +142,16 @@ class aged_trial_report(rml_parse.rml_parse):
values['total'] = total and total[0] or 0.0
## Add for total
self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
print self.total_account,">>>>>>>>>>>>>Total>>>>>>>>>>>>>>>>"
values['name'] = partner['name']
#t = 0.0
#for i in range(5)+['direction']:
# t+= float(values.get(str(i), 0.0) or 0.0)
#values['total'] = t
if values['total']:
res.append(values)
total = 0.0
totals = {}
for r in res:
total += float(r['total'] or 0.0)
@ -166,24 +160,17 @@ class aged_trial_report(rml_parse.rml_parse):
totals[str(i)] += float(r[str(i)] or 0.0)
return res
def _get_total(self,pos):
print self.total_account,"========_get_total========"
period = self.total_account[int(pos)]
return period
return period
def _get_direction(self,pos):
period = self.total_account[int(pos)]
return period
return period
def _get_for_period(self,pos):
period = self.total_account[int(pos)]
return period
return period
def _get_company(self, form):
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
@ -194,5 +181,5 @@ class aged_trial_report(rml_parse.rml_parse):
report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner',
'addons/account/report/aged_trial_balance.rml',parser=aged_trial_report,header=False)

View File

@ -35,8 +35,8 @@ import pooler
class general_ledger_landscape(rml_parse.rml_parse):
_name = 'report.account.general.ledger_landscape'
def preprocess(self, objects, data, ids):
##
self.borne_date = self.get_min_date(data['form'])
@ -46,18 +46,18 @@ class general_ledger_landscape(rml_parse.rml_parse):
new_ids = ids
else:
new_ids.append(data['form']['Account_list'])
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
super(general_ledger_landscape, self).preprocess(objects, data, new_ids)
super(general_ledger_landscape, self).preprocess(objects, data, new_ids)
def __init__(self, cr, uid, name, context):
super(general_ledger_landscape, self).__init__(cr, uid, name, context)
self.query = ""
self.child_ids = ""
self.tot_currency = 0.0
self.period_sql = ""
self.sold_accounts = {}
self.sold_accounts = {}
self.localcontext.update( {
'time': time,
'lines': self.lines,
@ -66,7 +66,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
'sum_solde_account': self._sum_solde_account,
'sum_debit': self._sum_debit,
'sum_credit': self._sum_credit,
'sum_solde': self._sum_solde,
'sum_solde': self._sum_solde,
'get_children_accounts': self.get_children_accounts,
'sum_currency_amount_account': self._sum_currency_amount_account
})
@ -75,7 +75,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
result = {}
#for id in ids:
# result.setdefault(id, False)
for account_line in self.pool.get('account.move.line').browse(cr, uid, ids, context):
# For avoid long text in the field we will limit it to 5 lines
#
@ -85,7 +85,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
num_id_move = str(account_line.move_id.id)
num_id_line = str(account_line.id)
account_id = str(account_line.account_id.id)
# search the basic account
# search the basic account
# We have the account ID we will search all account move line from now until this time
# We are in the case of we are on the top of the account move Line
cr.execute('SELECT distinct(ac.code) as code_rest,ac.name as name_rest from account_account AS ac, account_move_line mv\
@ -103,10 +103,8 @@ class general_ledger_landscape(rml_parse.rml_parse):
result[account_line.id] = concat + '...'
break
rup_id+=1
#print str(result)
return result
def get_min_date(self,form):
## Get max born from account_fiscal year
#
@ -123,9 +121,9 @@ class general_ledger_landscape(rml_parse.rml_parse):
periods = form['periods'][0][2]
if not periods:
sql = """
Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
"""
else:
else:
periods_id = ','.join(map(str, periods))
sql = """
Select min(p.date_start) from account_period as p where p.id in ( """ + periods_id + """)
@ -141,30 +139,30 @@ class general_ledger_landscape(rml_parse.rml_parse):
}
return date_borne
def get_children_accounts(self, account, form):
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
[('parent_id', 'child_of', self.ids)])
#
#
res = []
ctx = self.context.copy()
## We will make the test for period or date
## We will now make the test
#
if form.has_key('fiscalyear'):
if form.has_key('fiscalyear'):
ctx['fiscalyear'] = form['fiscalyear']
ctx['periods'] = form['periods'][0][2]
else:
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
##
#
self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
for child_id in self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])]):
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
sold_account = self._sum_solde_account(child_account,form)
@ -175,7 +173,6 @@ class general_ledger_landscape(rml_parse.rml_parse):
[('account_id','=',child_account.id)],
context=ctx)) <> 0 :
res.append(child_account)
#print "Type de vue :" + form['display_account']
elif form['display_account'] == 'bal_solde':
if child_account.type != 'view' \
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
@ -183,7 +180,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
context=ctx)) <> 0 :
if ( sold_account <> 0.0):
res.append(child_account)
else:
else:
if child_account.type != 'view' \
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
[('account_id','=',child_account.id)],
@ -205,17 +202,17 @@ class general_ledger_landscape(rml_parse.rml_parse):
sum_credit = 0
else:
sum_credit = resultat[0]['sum_credit']
move.init_credit = sum_credit
move.init_debit = sum_debit
else:
move.init_credit = 0
move.init_debit = 0
##
return res
def lines(self, account, form):
inv_types = {
'out_invoice': 'CI: ',
@ -229,9 +226,9 @@ class general_ledger_landscape(rml_parse.rml_parse):
else:
sorttag = 'j.code'
sql = """
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name, l.debit, l.credit, l.period_id
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name, l.debit, l.credit, l.period_id
FROM account_move_line l LEFT JOIN res_currency c on (l.currency_id=c.id) JOIN account_journal j on (l.journal_id=j.id)
AND account_id = %d AND %s
AND account_id = %d AND %s
ORDER by %s"""%(account.id,self.query,sorttag)
self.cr.execute(sql)
res = self.cr.dictfetchall()
@ -258,11 +255,11 @@ class general_ledger_landscape(rml_parse.rml_parse):
if (l['credit'] > 0):
if l['amount_currency'] != None:
l['amount_currency'] = abs(l['amount_currency']) * -1
#
if l['amount_currency'] != None:
self.tot_currency = self.tot_currency + l['amount_currency']
self.tot_currency = self.tot_currency + l['amount_currency']
return res
def _sum_debit_account(self, account, form):
@ -291,7 +288,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
sum_credit += account.init_credit
#
##
return sum_credit
def _sum_solde_account(self, account, form):
@ -301,7 +298,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
sum_solde = self.cr.fetchone()[0] or 0.0
if form['soldeinit']:
sum_solde += account.init_debit - account.init_credit
return sum_solde
def _sum_debit(self, form):
@ -330,31 +327,24 @@ class general_ledger_landscape(rml_parse.rml_parse):
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
"FROM account_move_line l "\
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
# print ("SELECT (sum(debit) - sum(credit)) as Test "\
# "FROM account_move_line l "\
# "WHERE l.account_id in ("+','.join(map(str, child_ids))+") AND "+query+period_sql)
sum_solde = self.cr.fetchone()[0] or 0.0
return sum_solde
def _set_get_account_currency_code(self, account_id):
print"====account_id=====",account_id
self.cr.execute("SELECT c.code as code "\
"FROM res_currency c,account_account as ac "\
"WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
result = self.cr.fetchone()
print"====result====",result
if result:
self.account_currency = result[0]
else:
self.account_currency = False
def _sum_currency_amount_account(self, account, form):
self._set_get_account_currency_code(account.id)
self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %d "%account.id)
total = self.cr.fetchone()
if self.account_currency:
return_field = str(total[0]) + self.account_currency
return return_field

View File

@ -59,7 +59,7 @@ class third_party_ledger(rml_parse.rml_parse):
for date in date_array:
full_str_date.append(str(date))
return full_str_date
#
def transform_period_into_date_array(self,data):
## Get All Period Date
@ -67,66 +67,61 @@ class third_party_ledger(rml_parse.rml_parse):
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
periods_id = data['form']['periods'][0][2]
date_array = []
date_array = []
for period_id in periods_id:
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
self.date_lst = date_array
self.date_lst.sort()
def transform_date_into_date_array(self,data):
return_array = self.date_range(data['form']['date1'],data['form']['date2'])
self.date_lst = return_array
self.date_lst.sort()
def transform_both_into_date_array(self,data):
if not data['form']['periods'][0][2] :
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
periods_id = data['form']['periods'][0][2]
date_array = []
date_array = []
for period_id in periods_id:
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
period_start_date = date_array[0]
date_start_date = data['form']['date1']
period_stop_date = date_array[-1]
date_stop_date = data['form']['date2']
if period_start_date<date_start_date:
start_date = period_start_date
else :
start_date = date_start_date
if date_stop_date<period_stop_date:
stop_date = period_stop_date
else :
stop_date = date_stop_date
print"start_date",start_date
print"stop_date",stop_date
final_date_array = []
final_date_array = final_date_array + self.date_range(start_date, stop_date)
self.date_lst = final_date_array
self.date_lst.sort()
def transform_none_into_date_array(self,data):
sql = "SELECT min(date) as start_date from account_move_line"
self.cr.execute(sql)
start_date = self.cr.fetchone()[0]
print"start_date",start_date
sql = "SELECT max(date) as start_date from account_move_line"
self.cr.execute(sql)
stop_date = self.cr.fetchone()[0]
print"stop_date",stop_date
array= []
array = array + self.date_range(start_date, stop_date)
self.date_lst = array
self.date_lst.sort()
def comma_me(self,amount):
if type(amount) is float :
amount = str('%.2f'%amount)
@ -145,36 +140,31 @@ class third_party_ledger(rml_parse.rml_parse):
for date_string in self.date_lst:
string_map = date_string + ','
return string_map
def preprocess(self, objects, data, ids):
PARTNER_REQUEST = ''
if (data['model'] == 'res.partner'):
print"data['model']",data['model']
## Si on imprime depuis les partenaires
if ids:
PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")"
# Transformation des date
#
#
# if data['form']['fiscalyear']:
# if data['form']['fiscalyear']:
# self.transform_period_into_date_array(data)
# else:
# self.transform_date_into_date_array(data)
##
if data['form']['state'] == 'none':
print"-----none-----"
self.transform_none_into_date_array(data)
elif data['form']['state'] == 'bydate':
print"-----bydate-------"
self.transform_date_into_date_array(data)
elif data['form']['state'] == 'byperiod':
print"-----byperiod-------"
self.transform_period_into_date_array(data)
elif data['form']['state'] == 'all':
print"-----all-------"
self.transform_both_into_date_array(data)
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
#
#new_ids = [id for (id,) in self.cr.fetchall()]
@ -197,7 +187,7 @@ class third_party_ledger(rml_parse.rml_parse):
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
partner_to_use = []
if data['form']['soldeinit'] :
self.cr.execute(
"SELECT DISTINCT line.partner_id " \
@ -227,7 +217,7 @@ class third_party_ledger(rml_parse.rml_parse):
for res_line in res:
partner_to_use.append(res_line['partner_id'])
res = self.cr.dictfetchall()
for res_line in res:
partner_to_use.append(res_line['partner_id'])
new_ids = partner_to_use
@ -260,7 +250,7 @@ class third_party_ledger(rml_parse.rml_parse):
sum = r['debit'] - r['credit']
r['progress'] = sum
full_account.append(r)
self.cr.execute(
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
"FROM account_move_line l " \
@ -278,11 +268,11 @@ class third_party_ledger(rml_parse.rml_parse):
sum = r['debit'] - r['credit']
r['progress'] = sum
full_account.append(r)
return full_account
def _sum_debit_partner(self, partner,data):
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
result_tmp = 0.0
if data['form']['reconcil'] :
@ -303,7 +293,7 @@ class third_party_ledger(rml_parse.rml_parse):
result_tmp = contemp[0] or 0.0
else:
result_tmp = result_tmp + 0.0
self.cr.execute(
"SELECT sum(debit) " \
@ -313,14 +303,14 @@ class third_party_ledger(rml_parse.rml_parse):
" " + RECONCILE_TAG + " " \
"AND date IN (" + self.date_lst_string + ") " ,
(partner.id,))
contemp = self.cr.fetchone()
contemp = self.cr.fetchone()
if contemp != None:
result_tmp = contemp[0] or 0.0
else:
result_tmp = result_tmp + 0.0
return result_tmp
def _sum_credit_partner(self, partner,data):
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
result_tmp = 0.0
@ -342,7 +332,7 @@ class third_party_ledger(rml_parse.rml_parse):
result_tmp = contemp[0] or 0.0
else:
result_tmp = result_tmp + 0.0
self.cr.execute(
"SELECT sum(credit) " \
"FROM account_move_line " \
@ -352,13 +342,13 @@ class third_party_ledger(rml_parse.rml_parse):
"AND date IN (" + self.date_lst_string + ") " ,
(partner.id,))
contemp = self.cr.fetchone()
contemp = self.cr.fetchone()
if contemp != None:
result_tmp = contemp[0] or 0.0
else:
result_tmp = result_tmp + 0.0
return result_tmp
def _sum_debit(self,data):
if not self.ids:
return 0.0
@ -389,18 +379,18 @@ class third_party_ledger(rml_parse.rml_parse):
"WHERE partner_id IN (" + self.partner_ids + ") " \
# "AND account_id IN (" + self.account_ids + ") " \
" " + RECONCILE_TAG + " " \
"AND date IN (" + self.date_lst_string + ") "
"AND date IN (" + self.date_lst_string + ") "
)
contemp = self.cr.fetchone()
contemp = self.cr.fetchone()
if contemp != None:
result_tmp = contemp[0] or 0.0
else:
result_tmp = result_tmp + 0.0
return result_tmp
def _sum_credit(self,data):
if not self.ids:
return 0.0
@ -430,14 +420,14 @@ class third_party_ledger(rml_parse.rml_parse):
"WHERE partner_id IN (" + self.partner_ids + ") " \
# "AND account_id IN (" + self.account_ids + ") " \
" " + RECONCILE_TAG + " " \
"AND date IN (" + self.date_lst_string + ") "
"AND date IN (" + self.date_lst_string + ") "
)
contemp = self.cr.fetchone()
contemp = self.cr.fetchone()
if contemp != None:
result_tmp = contemp[0] or 0.0
else:
result_tmp = result_tmp + 0.0
return result_tmp
def _get_company(self, form):
@ -445,7 +435,7 @@ class third_party_ledger(rml_parse.rml_parse):
def _get_currency(self, form):
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
'addons/account/report/third_party_ledger.rml',parser=third_party_ledger,
header=False)

View File

@ -4,7 +4,8 @@
"access_account_account_type","account.account.type","model_account_account_type","account.group_account_user",1,0,0,0
"access_account_tax","account.tax","model_account_tax","account.group_account_user",1,0,0,0
"access_account_account","account.account","model_account_account","account.group_account_user",1,0,0,0
"access_account_account_partner_manager","account.account partner manager","model_account_account","base.group_user",1,0,0,0
"access_account_account_user","account.account user","model_account_account","base.group_user",1,0,0,0
"access_account_account_partner_manager","account.account partner manager","model_account_account","base.group_partner_manager",1,0,0,0
"access_account_journal_view","account.journal.view","model_account_journal_view","account.group_account_user",1,0,0,0
"access_account_journal_column","account.journal.column","model_account_journal_column","account.group_account_user",1,0,0,0
"access_account_journal","account.journal","model_account_journal","account.group_account_user",1,0,0,0
@ -56,9 +57,6 @@
"access_account_tax_code_manager","account.tax.code","model_account_tax_code","account.group_account_manager",1,1,1,1
"access_account_tax_manager","account.tax","model_account_tax","account.group_account_manager",1,1,1,1
"access_account_invoice_group_invoice","account.invoice group invoice","model_account_invoice","account.group_account_invoice",1,1,1,1
"access_account_invoice_manager","account.invoice","model_account_invoice","account.group_account_manager",1,1,1,1
"access_account_invoice_line_manager","account.invoice.line","model_account_invoice_line","account.group_account_manager",1,1,1,1
"access_account_invoice_tax_manager","account.invoice.tax","model_account_invoice_tax","account.group_account_manager",1,1,1,1
"access_account_analytic_account_manager","account.analytic.account","model_account_analytic_account","account.group_account_manager",1,1,1,1
"access_account_analytic_journal_manager","account.analytic.journal","model_account_analytic_journal","account.group_account_manager",1,1,1,1
"access_account_fiscalyear","account.fiscalyear","model_account_fiscalyear","account.group_account_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_account_account_type account.account.type model_account_account_type account.group_account_user 1 0 0 0
5 access_account_tax account.tax model_account_tax account.group_account_user 1 0 0 0
6 access_account_account account.account model_account_account account.group_account_user 1 0 0 0
7 access_account_account_partner_manager access_account_account_user account.account partner manager account.account user model_account_account base.group_user 1 0 0 0
8 access_account_account_partner_manager account.account partner manager model_account_account base.group_partner_manager 1 0 0 0
9 access_account_journal_view account.journal.view model_account_journal_view account.group_account_user 1 0 0 0
10 access_account_journal_column account.journal.column model_account_journal_column account.group_account_user 1 0 0 0
11 access_account_journal account.journal model_account_journal account.group_account_user 1 0 0 0
57 access_account_tax_code_manager account.tax.code model_account_tax_code account.group_account_manager 1 1 1 1
58 access_account_tax_manager account.tax model_account_tax account.group_account_manager 1 1 1 1
59 access_account_invoice_group_invoice account.invoice group invoice model_account_invoice account.group_account_invoice 1 1 1 1
access_account_invoice_manager account.invoice model_account_invoice account.group_account_manager 1 1 1 1
access_account_invoice_line_manager account.invoice.line model_account_invoice_line account.group_account_manager 1 1 1 1
access_account_invoice_tax_manager account.invoice.tax model_account_invoice_tax account.group_account_manager 1 1 1 1
60 access_account_analytic_account_manager account.analytic.account model_account_analytic_account account.group_account_manager 1 1 1 1
61 access_account_analytic_journal_manager account.analytic.journal model_account_analytic_journal account.group_account_manager 1 1 1 1
62 access_account_fiscalyear account.fiscalyear model_account_fiscalyear account.group_account_manager 1 1 1 1

View File

@ -8,17 +8,17 @@
"access_auction_bid","auction.bid","model_auction_bid","base.group_user",1,1,1,1
"access_auction_bid_line","auction.bid.line","model_auction_bid_line","base.group_user",1,1,1,1
"access_auction_lot_history","auction.lot.history","model_auction_lot_history","base.group_user",1,1,1,1
"access_report_buyer_auction","report.buyer.auction","model_report_buyer_auction","base.group_user",1,1,1,1
"access_report_buyer_auction2","report.buyer.auction2","model_report_buyer_auction2","base.group_user",1,1,1,1
"access_report_seller_auction","report.seller.auction","model_report_seller_auction","base.group_user",1,1,1,1
"access_report_seller_auction2","report.seller.auction2","model_report_seller_auction2","base.group_user",1,1,1,1
"access_report_auction_view","report.auction.view","model_report_auction_view","base.group_user",1,1,1,1
"access_report_auction_view2","report.auction.view2","model_report_auction_view2","base.group_user",1,1,1,1
"access_report_auction_object_date","report.auction.object.date","model_report_auction_object_date","base.group_user",1,1,1,1
"access_report_auction_estimation_adj_category","report.auction.estimation.adj.category","model_report_auction_estimation_adj_category","base.group_user",1,1,1,1
"access_report_auction_adjudication","report.auction.adjudication","model_report_auction_adjudication","base.group_user",1,1,1,1
"access_report_attendance","report.attendance","model_report_attendance","base.group_user",1,1,1,1
"access_report_deposit_border","report.deposit.border","model_report_deposit_border","base.group_user",1,1,1,1
"access_report_object_encoded","report.object.encoded","model_report_object_encoded","base.group_user",1,1,1,1
"access_report_object_encoded_manager","report.object.encoded.manager","model_report_object_encoded_manager","base.group_user",1,1,1,1
"access_report_unclassified_objects","report.unclassified.objects","model_report_unclassified_objects","base.group_user",1,1,1,1
"access_report_buyer_auction","report.buyer.auction","model_report_buyer_auction","base.group_user",1,0,0,0
"access_report_buyer_auction2","report.buyer.auction2","model_report_buyer_auction2","base.group_user",1,0,0,0
"access_report_seller_auction","report.seller.auction","model_report_seller_auction","base.group_user",1,0,0,0
"access_report_seller_auction2","report.seller.auction2","model_report_seller_auction2","base.group_user",1,0,0,0
"access_report_auction_view","report.auction.view","model_report_auction_view","base.group_user",1,0,0,0
"access_report_auction_view2","report.auction.view2","model_report_auction_view2","base.group_user",1,0,0,0
"access_report_auction_object_date","report.auction.object.date","model_report_auction_object_date","base.group_user",1,0,0,0
"access_report_auction_estimation_adj_category","report.auction.estimation.adj.category","model_report_auction_estimation_adj_category","base.group_user",1,0,0,0
"access_report_auction_adjudication","report.auction.adjudication","model_report_auction_adjudication","base.group_user",1,0,0,0
"access_report_attendance","report.attendance","model_report_attendance","base.group_user",1,0,0,0
"access_report_deposit_border","report.deposit.border","model_report_deposit_border","base.group_user",1,0,0,0
"access_report_object_encoded","report.object.encoded","model_report_object_encoded","base.group_user",1,0,0,0
"access_report_object_encoded_manager","report.object.encoded.manager","model_report_object_encoded_manager","base.group_user",1,0,0,0
"access_report_unclassified_objects","report.unclassified.objects","model_report_unclassified_objects","base.group_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 access_auction_bid auction.bid model_auction_bid base.group_user 1 1 1 1
9 access_auction_bid_line auction.bid.line model_auction_bid_line base.group_user 1 1 1 1
10 access_auction_lot_history auction.lot.history model_auction_lot_history base.group_user 1 1 1 1
11 access_report_buyer_auction report.buyer.auction model_report_buyer_auction base.group_user 1 1 0 1 0 1 0
12 access_report_buyer_auction2 report.buyer.auction2 model_report_buyer_auction2 base.group_user 1 1 0 1 0 1 0
13 access_report_seller_auction report.seller.auction model_report_seller_auction base.group_user 1 1 0 1 0 1 0
14 access_report_seller_auction2 report.seller.auction2 model_report_seller_auction2 base.group_user 1 1 0 1 0 1 0
15 access_report_auction_view report.auction.view model_report_auction_view base.group_user 1 1 0 1 0 1 0
16 access_report_auction_view2 report.auction.view2 model_report_auction_view2 base.group_user 1 1 0 1 0 1 0
17 access_report_auction_object_date report.auction.object.date model_report_auction_object_date base.group_user 1 1 0 1 0 1 0
18 access_report_auction_estimation_adj_category report.auction.estimation.adj.category model_report_auction_estimation_adj_category base.group_user 1 1 0 1 0 1 0
19 access_report_auction_adjudication report.auction.adjudication model_report_auction_adjudication base.group_user 1 1 0 1 0 1 0
20 access_report_attendance report.attendance model_report_attendance base.group_user 1 1 0 1 0 1 0
21 access_report_deposit_border report.deposit.border model_report_deposit_border base.group_user 1 1 0 1 0 1 0
22 access_report_object_encoded report.object.encoded model_report_object_encoded base.group_user 1 1 0 1 0 1 0
23 access_report_object_encoded_manager report.object.encoded.manager model_report_object_encoded_manager base.group_user 1 1 0 1 0 1 0
24 access_report_unclassified_objects report.unclassified.objects model_report_unclassified_objects base.group_user 1 1 0 1 0 1 0

View File

@ -1,12 +1,15 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_crm_segmentation,crm.segmentation,model_crm_segmentation,crm.group_crm_manager,1,1,1,1
access_crm_segmentation_line,crm.segmentation.line,model_crm_segmentation_line,crm.group_crm_manager,1,1,1,1
access_crm_case_section,crm.case.section,model_crm_case_section,crm.group_crm_user,1,0,0,0
access_crm_case_categ,crm.case.categ,model_crm_case_categ,crm.group_crm_user,1,0,0,0
access_crm_case_rule,crm.case.rule,model_crm_case_rule,crm.group_crm_user,1,0,0,0
access_crm_case,crm.case,model_crm_case,crm.group_crm_user,1,1,1,1
access_crm_case_log,crm.case.log,model_crm_case_log,crm.group_crm_user,1,1,1,1
access_crm_case_history,crm.case.history,model_crm_case_history,crm.group_crm_user,1,1,1,1
access_crm_case_section_manager,crm.case.section.manager,model_crm_case_section,crm.group_crm_manager,1,1,1,1
access_crm_case_categ_manager,crm.case.categ.manager,model_crm_case_categ,crm.group_crm_manager,1,1,1,1
access_crm_case_rule_manager,crm.case.rule.manager,model_crm_case_rule,crm.group_crm_manager,1,1,1,1
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_crm_segmentation","crm.segmentation","model_crm_segmentation","crm.group_crm_manager",1,1,1,1
"access_crm_segmentation_line","crm.segmentation.line","model_crm_segmentation_line","crm.group_crm_manager",1,1,1,1
"access_crm_case_section","crm.case.section","model_crm_case_section","crm.group_crm_user",1,0,0,0
"access_crm_case_categ","crm.case.categ","model_crm_case_categ","crm.group_crm_user",1,0,0,0
"access_crm_case_rule","crm.case.rule","model_crm_case_rule","crm.group_crm_user",1,0,0,0
"access_crm_case_manger","crm.case manager","model_crm_case","crm.group_crm_user",1,1,1,1
"access_crm_case","crm.case","model_crm_case","crm.group_crm_manager",1,1,1,1
"access_crm_case_log","crm.case.log","model_crm_case_log","crm.group_crm_user",1,1,1,1
"access_crm_case_history","crm.case.history","model_crm_case_history","crm.group_crm_user",1,1,1,1
"access_crm_case_section_manager","crm.case.section.manager","model_crm_case_section","crm.group_crm_manager",1,1,1,1
"access_crm_case_categ_manager","crm.case.categ.manager","model_crm_case_categ","crm.group_crm_manager",1,1,1,1
"access_crm_case_rule_manager","crm.case.rule.manager","model_crm_case_rule","crm.group_crm_manager",1,1,1,1
"access_crm_case_log_manager","crm.case.log manager","model_crm_case_log","crm.group_crm_manager",1,1,1,1
"access_crm_case_history_manager","crm.case.history manager","model_crm_case_history","crm.group_crm_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_crm_segmentation crm.segmentation model_crm_segmentation crm.group_crm_manager 1 1 1 1
3 access_crm_segmentation_line crm.segmentation.line model_crm_segmentation_line crm.group_crm_manager 1 1 1 1
4 access_crm_case_section crm.case.section model_crm_case_section crm.group_crm_user 1 0 0 0
5 access_crm_case_categ crm.case.categ model_crm_case_categ crm.group_crm_user 1 0 0 0
6 access_crm_case_rule crm.case.rule model_crm_case_rule crm.group_crm_user 1 0 0 0
7 access_crm_case access_crm_case_manger crm.case crm.case manager model_crm_case crm.group_crm_user 1 1 1 1
8 access_crm_case_log access_crm_case crm.case.log crm.case model_crm_case_log model_crm_case crm.group_crm_user crm.group_crm_manager 1 1 1 1
9 access_crm_case_history access_crm_case_log crm.case.history crm.case.log model_crm_case_history model_crm_case_log crm.group_crm_user 1 1 1 1
10 access_crm_case_section_manager access_crm_case_history crm.case.section.manager crm.case.history model_crm_case_section model_crm_case_history crm.group_crm_manager crm.group_crm_user 1 1 1 1
11 access_crm_case_categ_manager access_crm_case_section_manager crm.case.categ.manager crm.case.section.manager model_crm_case_categ model_crm_case_section crm.group_crm_manager 1 1 1 1
12 access_crm_case_rule_manager access_crm_case_categ_manager crm.case.rule.manager crm.case.categ.manager model_crm_case_rule model_crm_case_categ crm.group_crm_manager 1 1 1 1
13 access_crm_case_rule_manager crm.case.rule.manager model_crm_case_rule crm.group_crm_manager 1 1 1 1
14 access_crm_case_log_manager crm.case.log manager model_crm_case_log crm.group_crm_manager 1 1 1 1
15 access_crm_case_history_manager crm.case.history manager model_crm_case_history crm.group_crm_manager 1 1 1 1

View File

@ -9,7 +9,7 @@
people to intelligently and efficiently manage tasks, issues,
and requests. It manages key tasks such as communication,
identification, prioritization, assignment, resolution and notification.""",
"depends" : ["crm","report_crm", "process"],
"depends" : ["crm","report_crm", "process", "account"],
"init_xml" : [
"crm_config_view.xml",
"crm_bugs_view.xml",
@ -40,7 +40,7 @@
"crm_helpdesk_menu.xml", "crm_lead_menu.xml",
"crm_meeting_menu.xml",
"security/ir.model.access.csv",
# "process/crm_configuration_process.xml",
"process/crm_configuration_process.xml",
],
"active": False,
"installable": True

View File

@ -0,0 +1,113 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--
Process
-->
<record id="process_process_contractworkflow0" model="process.process">
<field eval="&quot;&quot;&quot;Contracts flow for services companies.&quot;&quot;&quot;" name="note"/>
<field eval="1" name="active"/>
<field eval="&quot;&quot;&quot;Contract Workflow&quot;&quot;&quot;" name="name"/>
</record>
<!--
Process Node
-->
<record id="process_node_leads0" model="process.node">
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act_leads_all"/>
<field name="model_id" ref="crm.model_crm_case"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Leads&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Premier Contact Leads&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_contractworkflow0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'open', 'pending', 'done', 'cancel')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_opportunities0" model="process.node">
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act_oppor11"/>
<field name="model_id" ref="crm.model_crm_case"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Opportunities&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Business Opportunities&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_contractworkflow0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'open', 'pending', 'done', 'cancel')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_accord0" model="process.node">
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act_leads_all"/>
<field name="model_id" ref="crm.model_crm_case"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Accord&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Accord Client Contract&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_contractworkflow0"/>
<field eval="&quot;&quot;&quot;object.state=='done'&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_contractanalytic0" model="process.node">
<field name="menu_id" ref="account.account_analytic_def_account"/>
<field name="model_id" ref="account.model_account_analytic_account"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Contract Analytic&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Analytic accounts&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_contractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_contractpricelist0" model="process.node">
<field name="menu_id" ref="product.menu_product_pricelist_action2"/>
<field name="model_id" ref="product.model_product_pricelist"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Contract Pricelist&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Contract Volume (pricelist)&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_contractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<!--
Process Transition
-->
<record id="process_transition_leadopportunity0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Lead Opportunity&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Creating business opportunities from leads&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_opportunities0"/>
<field model="process.node" name="source_node_id" ref="process_node_leads0"/>
</record>
<record id="process_transition_opportunitiesaccord0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Opportunities Accord&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;When leads are confirmed&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_accord0"/>
<field model="process.node" name="source_node_id" ref="process_node_opportunities0"/>
</record>
<record id="process_transition_accordanalytic0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Accord Analytic&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Goes into the Analytic&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_contractanalytic0"/>
<field model="process.node" name="source_node_id" ref="process_node_accord0"/>
</record>
<record id="process_transition_accordpricelist0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Accord Pricelist&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Goes into the Pricelist&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_contractpricelist0"/>
<field model="process.node" name="source_node_id" ref="process_node_accord0"/>
</record>
</data>
</openerp>

View File

@ -12,12 +12,13 @@
* User Authentification
* Document Indexation
""",
"depends" : ["base", "process"],
"depends" : ["base", "process", "hr"],
"init_xml" : ["document_data.xml"],
"update_xml" : [
"document_view.xml",
"security/document_security.xml",
"security/ir.model.access.csv",
"process/document_process.xml"
],
"demo_xml" : ["document_demo.xml"],
"active": False,

View File

@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="process_node_papers0" model="process.node">
<field name="menu_id" ref="document.menu_document_directories"/>
<field name="model_id" ref="document.model_document_directory"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Papers&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee get papers and matrieal&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_transition_papersandmaterials0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Papers and materials&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee get papers and necessary materials&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_papers0"/>
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
</record>
</data>
</openerp>

View File

@ -6,5 +6,9 @@
<field name="name">Document / Manager</field>
</record>
<record id="menu_document_configuration" model="ir.ui.menu">
<field name="groups_id" eval="[(6,0,[ref('group_document_manager')])]"/>
</record>
</data>
</openerp>

View File

@ -1,6 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_event_type,event.type,model_event_type,crm.group_crm_user,1,1,1,1
access_event_event,event.event,model_event_event,crm.group_crm_user,1,1,1,1
access_event_registration,event.registration,model_event_registration,crm.group_crm_user,1,1,1,1
access_report_event_registration,report.event.registration,model_report_event_registration,crm.group_crm_user,1,1,1,1
access_report_event_type_registration,report.event.type.registration,model_report_event_type_registration,crm.group_crm_user,1,1,1,1
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_event_type","event.type","model_event_type","crm.group_crm_user",1,1,1,1
"access_event_event","event.event","model_event_event","crm.group_crm_user",1,1,1,1
"access_event_registration","event.registration","model_event_registration","crm.group_crm_user",1,1,1,1
"access_report_event_registration","report.event.registration","model_report_event_registration","crm.group_crm_user",1,0,0,0
"access_report_event_type_registration","report.event.type.registration","model_report_event_type_registration","crm.group_crm_user",1,0,0,0
"access_project_project_crm_user","project.project crm user","project.model_project_project","crm.group_crm_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_event_type event.type model_event_type crm.group_crm_user 1 1 1 1
3 access_event_event event.event model_event_event crm.group_crm_user 1 1 1 1
4 access_event_registration event.registration model_event_registration crm.group_crm_user 1 1 1 1
5 access_report_event_registration report.event.registration model_report_event_registration crm.group_crm_user 1 1 0 1 0 1 0
6 access_report_event_type_registration report.event.type.registration model_report_event_type_registration crm.group_crm_user 1 1 0 1 0 1 0
7 access_project_project_crm_user project.project crm user project.model_project_project crm.group_crm_user 1 0 0 0

View File

@ -40,7 +40,7 @@
Different reports are also provided, mainly for attendance statistics.
""",
"depends" : ["base", "process"],
"depends" : ["base", "crm_configuration", "process"],
"init_xml" : [],
"demo_xml" : [
"hr_demo.xml",
@ -52,6 +52,7 @@
"hr_view.xml",
"hr_wizard.xml",
"hr_department_view.xml",
"process/hr_process.xml"
],
"active": False,
"installable": True

View File

@ -0,0 +1,84 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--
Process
-->
<record id="process_process_employeecontractworkflow0" model="process.process">
<field eval="&quot;&quot;&quot;Employee Contract flow for services companies.&quot;&quot;&quot;" name="note"/>
<field eval="1" name="active"/>
<field eval="&quot;&quot;&quot;Employee Contract Workflow&quot;&quot;&quot;" name="name"/>
</record>
<!--
Process Node
-->
<record id="process_node_jobshiring0" model="process.node">
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act11"/>
<field name="model_id" ref="crm.model_crm_case"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Jobs hiring&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Jobs hiring to new employees&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'open', 'pending', 'done', 'cancel')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_employee0" model="process.node">
<field name="menu_id" ref="hr.menu_open_view_employee_list"/>
<field name="model_id" ref="hr.model_hr_employee"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Employee&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee Complete Form&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_employeecontact0" model="process.node">
<field name="menu_id" ref="hr.menu_open_view_employee_list"/>
<field name="model_id" ref="hr.model_hr_employee"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Employee Contact&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Fill up employee's contact information&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_openerpuser0" model="process.node">
<field name="menu_id" ref="base.menu_users"/>
<field name="model_id" ref="base.model_res_users"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Openerp user&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Create OpenERP User&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<!--
Process Transition
-->
<record id="process_transition_employeejob0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Employee Job&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;After confirming job, he will be a employee&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_employee0"/>
<field model="process.node" name="source_node_id" ref="process_node_jobshiring0"/>
</record>
<record id="process_transition_contactofemployee0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Contact of employee&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Fill up contact information&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_employeecontact0"/>
<field model="process.node" name="source_node_id" ref="process_node_employee0"/>
</record>
</data>
</openerp>

View File

@ -1,3 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_action_reason_employee","hr action reason employee","model_hr_action_reason","base.group_user",1,1,1,1
"access_hr_attendance_employee","hr attendance employee","model_hr_attendance","base.group_user",1,1,1,1
"access_hr_action_reason_employee","hr action reason employee","model_hr_action_reason","hr.group_hr_user",1,1,1,1
"access_hr_attendance_employee","hr attendance employee","model_hr_attendance","hr.group_hr_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_action_reason_employee hr action reason employee model_hr_action_reason base.group_user hr.group_hr_user 1 1 1 1
3 access_hr_attendance_employee hr attendance employee model_hr_attendance base.group_user hr.group_hr_user 1 1 1 1

View File

@ -5,6 +5,7 @@
"access_hr_contract_wage_type_user","hr.contract.wage.type user","model_hr_contract_wage_type","hr.group_hr_user",1,0,0,0
"access_hr_contract_wage_type","hr.contract.wage.type","model_hr_contract_wage_type","hr.group_hr_manager",1,1,1,1
"access_hr_contract_wage_type_contract","hr.contract.wage.type contract","model_hr_contract_wage_type","group_hr_contract",1,1,1,1
"access_hr_contract_wage_type_period_contract","hr.contract.wage.type.period contract","model_hr_contract_wage_type_period","group_hr_contract",1,1,1,1
"access_hr_contract_user","hr.contract user","model_hr_contract","hr.group_hr_user",1,0,0,0
"access_hr_contract","hr.contract","model_hr_contract","group_hr_contract",1,1,1,1
"access_hr_employee_contract","hr.employee contract","hr.model_hr_employee","group_hr_contract",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
5 access_hr_contract_wage_type_user hr.contract.wage.type user model_hr_contract_wage_type hr.group_hr_user 1 0 0 0
6 access_hr_contract_wage_type hr.contract.wage.type model_hr_contract_wage_type hr.group_hr_manager 1 1 1 1
7 access_hr_contract_wage_type_contract hr.contract.wage.type contract model_hr_contract_wage_type group_hr_contract 1 1 1 1
8 access_hr_contract_wage_type_period_contract hr.contract.wage.type.period contract model_hr_contract_wage_type_period group_hr_contract 1 1 1 1
9 access_hr_contract_user hr.contract user model_hr_contract hr.group_hr_user 1 0 0 0
10 access_hr_contract hr.contract model_hr_contract group_hr_contract 1 1 1 1
11 access_hr_employee_contract hr.employee contract hr.model_hr_employee group_hr_contract 1 0 0 0

View File

@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_expense_expense,hr.expense.expense,model_hr_expense_expense,base.group_user,1,1,1,1
access_hr_expense_line,hr.expense.line,model_hr_expense_line,base.group_user,1,1,1,1
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_expense_expense","hr.expense.expense","model_hr_expense_expense","hr.group_hr_user",1,1,1,1
"access_hr_expense_line","hr.expense.line","model_hr_expense_line","hr.group_hr_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_expense_expense hr.expense.expense model_hr_expense_expense base.group_user hr.group_hr_user 1 1 1 1
3 access_hr_expense_line hr.expense.line model_hr_expense_line base.group_user hr.group_hr_user 1 1 1 1

View File

@ -32,7 +32,7 @@
"hr_view.xml",
"hr_holidays_report.xml",
"hr_holidays_wizard.xml",
# "process/hr_holidays_process.xml"
"process/hr_holidays_process.xml"
],
# "demo_xml" : ["hr_bel_holidays_2008.xml",],
"demo_xml" : [],

View File

@ -0,0 +1,45 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="process_node_secretariatsocial0" model="process.node">
<field name="menu_id" ref="hr_holidays.menu_open_ask_holidays"/>
<field name="model_id" ref="hr_holidays.model_hr_holidays"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Secretariat Social&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Secretariat social&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_holidays0" model="process.node">
<field name="menu_id" ref="hr_holidays.menu_open_ask_holidays"/>
<field name="model_id" ref="hr_holidays.model_hr_holidays"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Holidays&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee Get holidays&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'validate', 'confirm', 'refuse', 'cancel')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_transition_employeesocial0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Employee Social&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Social Activity&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_secretariatsocial0"/>
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
</record>
<record id="process_transition_employeeholidays0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Employee Holidays&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee get holidays&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_holidays0"/>
<field model="process.node" name="source_node_id" ref="process_node_secretariatsocial0"/>
</record>
</data>
</openerp>

View File

@ -1,4 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_holidays_per_user","hr.holidays.per.user","model_hr_holidays_per_user","base.group_user",1,1,1,1
"access_hr_holydays_status_user","hr.holidays.status user","model_hr_holidays_status","base.group_user",1,1,1,1
"access_hr_holidays_user","hr holidays user","model_hr_holidays","base.group_user",1,1,1,1
"access_hr_holidays_per_user","hr.holidays.per.user","model_hr_holidays_per_user","hr.group_hr_user",1,1,1,1
"access_hr_holydays_status_user","hr.holidays.status user","model_hr_holidays_status","hr.group_hr_user",1,1,1,1
"access_hr_holidays_user","hr holidays user","model_hr_holidays","hr.group_hr_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_holidays_per_user hr.holidays.per.user model_hr_holidays_per_user base.group_user hr.group_hr_user 1 1 1 1
3 access_hr_holydays_status_user hr.holidays.status user model_hr_holidays_status base.group_user hr.group_hr_user 1 1 1 1
4 access_hr_holidays_user hr holidays user model_hr_holidays base.group_user hr.group_hr_user 1 1 1 1

View File

@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_timesheet_invoice_factor,hr_timesheet_invoice.factor,model_hr_timesheet_invoice_factor,base.group_user,1,0,0,0
access_hr_timesheet_invoice_factor,hr_timesheet_invoice.factor,model_hr_timesheet_invoice_factor,account.group_account_invoice,1,1,1,1
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_timesheet_invoice_factor","hr_timesheet_invoice.factor","model_hr_timesheet_invoice_factor","hr.group_hr_user",1,0,0,0
"access_hr_timesheet_invoice_factor","hr_timesheet_invoice.factor","model_hr_timesheet_invoice_factor","account.group_account_invoice",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_timesheet_invoice_factor hr_timesheet_invoice.factor model_hr_timesheet_invoice_factor base.group_user hr.group_hr_user 1 0 0 0
3 access_hr_timesheet_invoice_factor hr_timesheet_invoice.factor model_hr_timesheet_invoice_factor account.group_account_invoice 1 1 1 1

View File

@ -35,7 +35,7 @@
"website" : "http://tinyerp.com/module_hr.html",
"depends" : ["project", "hr_timesheet_sheet"],
"update_xml" : ["hr_timesheet_project_view.xml",
# "process/hr_timesheet_project_process.xml",
"process/hr_timesheet_project_process.xml",
],
"active": False,
"installable": True

View File

@ -1,4 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_timesheet_sheet_sheet,hr_timesheet_sheet.sheet,model_hr_timesheet_sheet_sheet,base.group_user,1,1,1,1
access_hr_timesheet_sheet_sheet_day,hr_timesheet_sheet.sheet.day,model_hr_timesheet_sheet_sheet_day,base.group_user,1,1,1,1
access_hr_timesheet_sheet_sheet_account,hr_timesheet_sheet.sheet.account,model_hr_timesheet_sheet_sheet_account,base.group_user,1,1,1,1
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_timesheet_sheet_sheet","hr_timesheet_sheet.sheet","model_hr_timesheet_sheet_sheet","hr.group_hr_user",1,1,1,1
"access_hr_timesheet_sheet_sheet_day","hr_timesheet_sheet.sheet.day","model_hr_timesheet_sheet_sheet_day","hr.group_hr_user",1,1,1,1
"access_hr_timesheet_sheet_sheet_account","hr_timesheet_sheet.sheet.account","model_hr_timesheet_sheet_sheet_account","hr.group_hr_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_timesheet_sheet_sheet hr_timesheet_sheet.sheet model_hr_timesheet_sheet_sheet base.group_user hr.group_hr_user 1 1 1 1
3 access_hr_timesheet_sheet_sheet_day hr_timesheet_sheet.sheet.day model_hr_timesheet_sheet_sheet_day base.group_user hr.group_hr_user 1 1 1 1
4 access_hr_timesheet_sheet_sheet_account hr_timesheet_sheet.sheet.account model_hr_timesheet_sheet_sheet_account base.group_user hr.group_hr_user 1 1 1 1

6
addons/lunch/__init__.py Normal file
View File

@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
import lunch
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

15
addons/lunch/__terp__.py Normal file
View File

@ -0,0 +1,15 @@
# -*- encoding: utf-8 -*-
{
"name": "Lunch Module",
"author": "Tiny",
"version": "0.1",
"depends": ["base", "process", "hr"],
"init_xml": [],
"update_xml": ['lunch_wizard.xml', 'lunch_view.xml', 'lunch_report.xml',
'process/lunch_process.xml'
],
"demo_xml": ['lunch_demo.xml'],
"installable": True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

171
addons/lunch/lunch.py Normal file
View File

@ -0,0 +1,171 @@
# -*- encoding: utf-8 -*-
from osv import osv, fields
import time
class lunch_category(osv.osv):
_name = 'lunch.category'
_description = "Category"
_columns = {
'name': fields.char('Name', required=True, size=50),
}
_order = 'name'
lunch_category()
class lunch_product(osv.osv):
_name = 'lunch.product'
def _category_name_get(self, cr, uid, context={}):
obj = self.pool.get('lunch.category')
cat_ids= obj.search(cr,uid,[])
res = obj.read(cr,uid,cat_ids,['name', 'category'])
return [(str(r['id']), r['name']) for r in res]+ [('0','')]
_columns = {
'name': fields.char('Name', size=50, required=True),
'category_id': fields.selection(_category_name_get, 'Category', size=32),
'description': fields.char('Description', size=128, required=False),
'price': fields.float('Price', digits=(16,2)),
'active': fields.boolean('Active'),
}
_defaults = {
'active': lambda *a : True,
}
lunch_product()
class lunch_cashbox(osv.osv):
_name='lunch.cashbox'
def amount_available(self, cr, uid, ids, field_name, arg, context):
cr.execute("SELECT box,sum(amount) from lunch_cashmove where active = 't' group by box")
r = dict(cr.fetchall())
for i in ids :
r.setdefault(i,0)
return r
_columns={
'manager':fields.many2one('res.users','Manager'),
'name':fields.char('Name',size=30,required=True, unique = True),
'sum_remain': fields.function(amount_available, method=True, string='Remained Total'),
}
lunch_cashbox()
class lunch_cashmove(osv.osv):
_name= 'lunch.cashmove'
_columns={
'name': fields.char('Name',size=128),
'user_cashmove': fields.many2one('res.users','User Name', required=True),
'amount': fields.float('Amount', digits=(16,2)),
'box':fields.many2one('lunch.cashbox','Box Name',size=30,required=True),
'active':fields.boolean('Active'),
'create_date': fields.datetime('Created date', readonly=True),
}
_defaults={
'active': lambda *a: True,
}
lunch_cashmove()
class lunch_order(osv.osv):
_name='lunch.order'
_rec_name= "user_id"
def _price_get(self, cr, uid, ids, name, args, context=None):
res = {}
for o in self.browse(cr, uid, ids):
res[o.id] = o.product.price
return res
_columns={
'user_id': fields.many2one('res.users','User Name', required=True,
readonly=True, states={'draft':[('readonly',False)]}),
'product':fields.many2one('lunch.product','Product', required=True,
readonly=True, states={'draft':[('readonly',False)]}, change_default=True),
'date': fields.date('Date',readonly=True,states={'draft':[('readonly',False)]}),
'cashmove':fields.many2one('lunch.cashmove', 'CashMove' , readonly=True ),
'descript':fields.char('Description Order', readonly=True, size=50,
states={'draft':[('readonly',False)]}),
'state': fields.selection([('draft','Draft'), ('confirmed','Confirmed'),],
'State', readonly=True, select=True),
'price': fields.function(_price_get, method=True, string="Price"),
}
_defaults={
'user_id': lambda self,cr,uid,context: uid,
'date': lambda self,cr,uid,context: time.strftime('%Y-%m-%d'),
'state': lambda self,cr,uid,context: 'draft',
}
def confirm(self,cr,uid,ids,box,context):
cashmove_ref= self.pool.get('lunch.cashmove')
for order in self.browse(cr,uid,ids):
if order.state == 'confirmed':
continue
new_id= cashmove_ref.create(cr,uid,{'name': order.product.name+' order',
'amount':-order.product.price,
'user_cashmove':order.user_id.id,
'box':box,
'active':True,
})
self.write(cr,uid,[order.id],{'cashmove':new_id, 'state':'confirmed'})
return {}
def lunch_order_cancel(self,cr,uid,ids,context):
orders= self.browse(cr,uid,ids)
for order in orders:
if not order.cashmove:
continue
self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
self.write(cr,uid,ids,{'state':'draft'})
return {}
def onchange_product(self, cr, uid, ids, product):
if not product:
return {'value': {'price': 0.0}}
price = self.pool.get('lunch.product').read(cr, uid, product, ['price'])['price']
return {'value': {'price': price}}
lunch_order()
class report_lunch_amount(osv.osv):
_name='report.lunch.amount'
_description = "Amount available by user and box"
_auto = False
_rec_name= "user"
_columns = {
'user_id': fields.many2one('res.users','User Name',readonly=True),
'amount': fields.float('Amount', readonly=True, digits=(16,2)),
'box':fields.many2one('lunch.cashbox','Box Name',size=30,readonly=True),
}
def init(self, cr):
cr.execute("""
create or replace view report_lunch_amount as (
select
min(lc.id) as id,
lc.user_cashmove as user_id,
sum(amount) as amount,
lc.box as box
from
lunch_cashmove lc
where
active = 't'
group by lc.user_cashmove, lc.box
)""")
report_lunch_amount()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<terp>
<data noupdate="1">
<record model="lunch.category" id="categ_sandwich">
<field name="name">Sandwich</field>
</record>
<record model="lunch.product" id="product_club">
<field name="name">Club</field>
<field name="category_id" eval="str(ref('categ_sandwich'))"/>
<field name="price">2.75</field>
</record>
<record model="lunch.cashbox" id="cashbox_cashbox">
<field name="name">Cashbox</field>
<field name="manager" ref="base.user_admin"/>
</record>
</data>
</terp>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<terp>
<data>
<report
id="report_lunch_order"
string="Print Order"
model="lunch.order"
name="lunch.order"
rml="lunch/report/order.rml"
auto="False"
/>
</data>
</terp>

232
addons/lunch/lunch_view.xml Normal file
View File

@ -0,0 +1,232 @@
<?xml version="1.0"?>
<openerp>
<data>
<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
<menuitem name="Lunch" parent="menu_tools" id="menu_lunch" />
<menuitem name="Configuration" parent="menu_lunch" id="menu_lunch_category_root" sequence="1"/>
<record model="ir.ui.view" id="view_lunch_order_form">
<field name="name">Order</field>
<field name="model">lunch.order</field>
<field name="arch" type="xml">
<form string="Order">
<group colspan="2" col="4">
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="product" select="1" on_change="onchange_product(product)"/>
<field name="price"/>
<field name="descript"/>
<field name="cashmove"/>
<field name="state" select="2"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_lunch_order_tree">
<field name="name">Order</field>
<field name="model">lunch.order</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Order">
<field name="user_id"/>
<field name="product"/>
<field name="date"/>
<field name="cashmove"/>
<field name="state"/>
<field name="descript"/>
<field name="price" sum="Total price"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_lunch_order_form">
<field name="name">Make order</field>
<field name="res_model">lunch.order</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem name="Make order" parent="menu_lunch" id="menu_lunch_order_form" action="action_lunch_order_form"/>
<record model="ir.actions.act_window" id="action_lunch_order_day_form">
<field name="name"> Order of the day</field>
<field name="res_model">lunch.order</field>
<field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
</record>
<menuitem name="Order of the day" parent="menu_lunch_order_form" id="menu_lunch_order_day_form" action="action_lunch_order_day_form"/>
<record model="ir.ui.view" id="view_lunch_cashbox_form">
<field name="name">CashBox</field>
<field name="model">lunch.cashbox</field>
<field name="arch" type="xml">
<form string="CashBox">
<field name="name" select="1"/>
<field name="manager" select="1"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_lunch_cashbox_tree">
<field name="name">CashBox</field>
<field name="model">lunch.cashbox</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="CashBox" colors="red:sum_remain&lt;=0">
<field name="name" select="1"/>
<field name="manager" select="1"/>
<field name="sum_remain" select="1"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_lunch_cashbox_form">
<field name="name"> CashBox </field>
<field name="res_model">lunch.cashbox</field>
</record>
<menuitem name="CashBox" parent="menu_lunch_category_root" id="menu_lunch_cashbox_form" action="action_lunch_cashbox_form"/>
<record model="ir.ui.view" id="view_lunch_cashmove_form">
<field name="name">CashMove</field>
<field name="model">lunch.cashmove</field>
<field name="arch" type="xml">
<form string="CashMove">
<field name="name" select="1"/>
<field name="user_cashmove" select="1"/>
<field name="amount" select="2"/>
<field name="box" select="1"/>
<field name="create_date" select="1"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_lunch_cashmove_tree">
<field name="name">CashMove</field>
<field name="model">lunch.cashmove</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="CashMove" editable="top">
<field name="name" select="1" required="1"/>
<field name="user_cashmove" select="1"/>
<field name="amount" select="1" sum="Total amount"/>
<field name="box" select="1"/>
<field name="create_date"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_lunch_cashmove_form">
<field name="name">CashMove</field>
<field name="res_model">lunch.cashmove</field>
</record>
<menuitem name="Cash Moves" parent="menu_lunch" id="menu_lunch_cashmove_form" action="action_lunch_cashmove_form"/>
<record model="ir.ui.view" id="view_lunch_category_form">
<field name="name"> Category of product </field>
<field name="model">lunch.category</field>
<field name="arch" type="xml">
<form string="Category">
<separator string="Category related to Products" colspan="4"/>
<field name="name" select="1"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_lunch_category_tree">
<field name="name">Category</field>
<field name="model">lunch.category</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Order">
<field name="name" select="1"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_lunch_category_form">
<field name="name"> Category of product </field>
<field name="res_model">lunch.category</field>
</record>
<record model="ir.ui.view" id="view_lunch_product_form">
<field name="name">Products</field>
<field name="type">form</field>
<field name="model">lunch.product</field>
<field name="arch" type="xml">
<form string="Products">
<field name="name" select="1"/>
<field name="category_id" select="1"/>
<field name="description" select="1"/>
<field name="price" select="1"/>
<field name="active" select="1"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_lunch_product_tree">
<field name="name">Products</field>
<field name="model">lunch.product</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Products">
<field name="name" select="1"/>
<field name="category_id" select="1"/>
<field name="description" select="1"/>
<field name="price" select="1"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_lunch_product_form">
<field name="name">Product</field>
<field name="res_model">lunch.product</field>
</record>
<menuitem name="Tools/Lunch/Configuration/Products" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="1"/>
<menuitem name="Products" parent="menu_lunch_category_root" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="1"/>
<menuitem name="Category of product" parent="menu_lunch_product_form" id="menu_lunch_category_form" action="action_lunch_category_form" />
<record model="ir.ui.view" id="view_report_lunch_amount_tree">
<field name="name">Lunch amount</field>
<field name="model">report.lunch.amount</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Box Amount by User">
<field name="box" select="1"/>
<field name="user_id" select="1"/>
<field name="amount" select="1" sum="Total box" />
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_report_lunch_amount_form">
<field name="name">Lunch amount</field>
<field name="model">report.lunch.amount</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Box Amount by User">
<field name="user_id" select="1"/>
<field name="box" select="1"/>
<field name="amount" select="1"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_report_lunch_amount_tree">
<field name="name">Lunch amount</field>
<field name="res_model">report.lunch.amount</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Box Amount by User" parent="menu_lunch" action="action_report_lunch_amount_tree" id="menu_lunch_report_amount_tree"/>
</data>
</openerp>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" ?>
<terp>
<data>
<wizard
string="Confirm Order"
model="lunch.order"
name="lunch.order.confirm"
keyword="client_action_multi"
id="lunch_order_confirm"/>
<wizard
string="Cancel Order"
model="lunch.order"
name="lunch.order.cancel"
keyword="client_action_multi"
id="wizard_id_cancel"/>
<wizard
string="Set CashBox to Zero"
model="lunch.cashbox"
name="lunch.cashbox.clean"
keyword="client_action_multi"
id="wizard_clean_cashbox"/>
</data>
</terp>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="process_node_lunchbox0" model="process.node">
<field name="menu_id" ref="lunch.menu_lunch_product_form"/>
<field name="model_id" ref="lunch.model_lunch_product"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Lunchbox&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee get lunchbox if he wants lunch&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_transition_employeelunch0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Employee lunch&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee get lunch&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_lunchbox0"/>
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
import order
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,53 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import time
from report import report_sxw
from osv import osv
class order(report_sxw.rml_parse):
def sum_price(self, orders):
res = 0.0
for o in orders:
res += o.price
return res
def __init__(self, cr, uid, name, context):
super(order, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'sum_price': self.sum_price,
})
report_sxw.report_sxw('report.lunch.order', 'lunch.order',
'addons/lunch/report/order.rml',parser=order, header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,132 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="34.0" y1="42.0" width="527" height="758"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tableau2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
</blockTableStyle>
<blockTableStyle id="Tableau1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman" fontSize="15.0" leading="19"/>
<paraStyle name="P2" fontName="Times-Roman" fontSize="16.0" leading="20"/>
<paraStyle name="P3" fontName="Times-Roman"/>
<paraStyle name="P4" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
<paraStyle name="P5" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P6" fontName="Times-BoldItalic" fontSize="9.0" leading="11"/>
<paraStyle name="P7" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11"/>
<paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P11" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P12" fontName="Times-BoldItalic" fontSize="6.0" leading="8"/>
<paraStyle name="P13" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P14" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Header" fontName="Times-Roman"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footnote" rightIndent="0.0" leftIndent="14.0" fontName="Times-Roman" fontSize="10.0" leading="13"/>
<paraStyle name="Index" fontName="Times-Roman"/>
</stylesheet>
<story>
<para style="P1">
<font face="Times-Roman">Printed at : [[time.strftime("%Hh%M")]]</font>
</para>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P3">
<font color="white"> </font>
</para>
<blockTable colWidths="149.0,135.0,103.0,140.0" repeatRows="1" style="Tableau2">
<tr>
<td>
<para style="P4">Name</para>
</td>
<td>
<para style="P4">Order</para>
</td>
<td>
<para style="P4">Description</para>
</td>
<td>
<para style="P4">Unit Price</para>
</td>
</tr>
</blockTable>
<section>
<para style="P5">
<font color="white"> </font>
</para>
</section>
<blockTable colWidths="148.0,135.0,103.0,140.0" style="Tableau1">
<tr>
<td>
<para style="P7">[[repeatIn(objects, 'o') ]]</para>
<para style="P7">[[ o.user_id.name ]]</para>
</td>
<td>
<para style="P8">[[o.product.name ]]</para>
</td>
<td>
<para style="P9">[[ o.descript ]]</para>
<para style="P10">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P14">[['%.2f' % o.price ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P12">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P11">[[ '%.2f' % sum_price(objects) ]]</para>
</td>
</tr>
</blockTable>
<para style="P6">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
import confirm
import cancel
import reset_box
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
import wizard
import netsvc
import ir
import pooler
cancel_form = """<?xml version="1.0"?>
<form string="Cancel Order">
<label string="Are you sure you want to cancel this order ?"/>
</form>"""
cancel_fields = {
}
def _cancel(self,cr,uid,data,context):
return pooler.get_pool(cr.dbname).get('lunch.order').lunch_order_cancel(cr,uid,data['ids'],context)
class order_cancel(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':cancel_form, 'fields':cancel_fields, 'state':[('end','No'),('cancel','Yes')]}
},
'cancel': {
'actions': [_cancel],
'result': {'type':'state', 'state':'end'}
}
}
order_cancel('lunch.order.cancel')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,67 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import wizard
import netsvc
import ir
import pooler
confirm_order_form = """<?xml version="1.0"?>
<form title="Confirm">
<separator string="Orders Confirmation" colspan="4"/>
<field name="confirm_cashbox"/>
<newline/>
</form>
"""
confirm_order_fields = {
'confirm_cashbox': {'string':'Name of box', 'type':'many2one', 'required':True, 'relation':'lunch.cashbox' },
}
def _confirm(self,cr,uid,data,context):
pool= pooler.get_pool(cr.dbname)
order_ref = pool.get('lunch.order')
order_ref.confirm(cr,uid,data['ids'],data['form']['confirm_cashbox'],context)
return {}
class order_confirm(wizard.interface):
states = {
'init': {
'action':[],
'result':{'type' : 'form', 'arch' : confirm_order_form, 'fields' : confirm_order_fields, 'state' : [('end', 'Cancel'),('go', 'Confirm Order') ]},
},
'go' : {
'actions' : [_confirm],
'result' : {'type' : 'state', 'state' : 'end'}
},
}
order_confirm('lunch.order.confirm')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,56 @@
# -*- encoding: utf-8 -*-
import wizard
import netsvc
import ir
import pooler
set_to_zero_form = """<?xml version="1.0"?>
<form string="Reset cashbox">
<label string="Are you sure you want to reset this cashbox ?"/>
</form>"""
confirm_setting_zero_fields = {}
def _set_to_zero(self,cr,uid,data,context):
pool= pooler.get_pool(cr.dbname)
cashmove_ref = pool.get('lunch.cashmove')
cr.execute("select user_cashmove, box,sum(amount) from lunch_cashmove where active= 't' and box in (%s) group by user_cashmove, box"%','.join(map(str,data['ids'])))
res= cr.fetchall()
cr.execute("update lunch_cashmove set active = 'f' where active= 't' and box in (%s)"%','.join(map(str,data['ids'])))
## to_unactive= {}.fromkeys([r[0] for r in cr.fetchall]).keys()
## print to_unactive
## cashmove_ref.write(cr,uid,to_unactive,{'active':False})
##
for (user_id,box_id,amount) in res:
cashmove_ref.create(cr,uid,{'name': 'Summary for user'+ str(user_id),
'amount': amount,
'user_cashmove': user_id,
'box': box_id,
'active': True,
})
return {}
class cashbox_set_to_zero(wizard.interface):
states = {
'init': {
'action':[],
'result':{'type' : 'form',
'arch' : set_to_zero_form,
'fields' : confirm_setting_zero_fields,
'state' : [('end', 'Cancel'),('zero', 'Set to Zero') ]},
},
'zero' : {
'actions' : [_set_to_zero],
'result' : {'type' : 'state', 'state' : 'end'}
},
}
cashbox_set_to_zero('lunch.cashbox.clean')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_membership_membership_line_partner_manager","membership.membership_line partner_manager","model_membership_membership_line","base.group_partner_manager",1,1,1,1
"access_membership_membership_line","membership.membership_line","model_membership_membership_line","base.group_user",1,0,0,0
"access_membership_membership_line","membership.membership_line","model_membership_membership_line",,1,0,0,0
"access_report_partner_member_year","report.partner_member.year","model_report_partner_member_year","base.group_partner_manager",1,0,0,0
"access_report_partner_member_year_new","report.partner_member.year_new","model_report_partner_member_year_new","base.group_partner_manager",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_membership_membership_line_partner_manager membership.membership_line partner_manager model_membership_membership_line base.group_partner_manager 1 1 1 1
3 access_membership_membership_line membership.membership_line model_membership_membership_line base.group_user 1 0 0 0
4 access_report_partner_member_year report.partner_member.year model_report_partner_member_year base.group_partner_manager 1 0 0 0
5 access_report_partner_member_year_new report.partner_member.year_new model_report_partner_member_year_new base.group_partner_manager 1 0 0 0

View File

@ -0,0 +1,5 @@
# -*- encoding: utf-8 -*-
import partner
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,18 @@
# -*- encoding: utf-8 -*-
{
"name" : "Partner extension to synchronize TinyERP with ldap",
"version" : "1.0",
"author" : "Tiny",
"depends" : ["base", "hr", "process"],
"category" : "Generic Modules/Inventory Control",
"description": "Synchronise partners through a LDAP module. Has been used to synchronise partners in Outlook and Tiny ERP.",
"init_xml" : [],
"demo_xml" : [],
"update_xml" : ["wizard.xml",
"process/partner_ldap_process.xml"
],
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,42 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from osv import osv, fields
class address_ldap(osv.osv):
_inherit = 'res.partner.address'
_columns = {
'dn' : fields.char('Distinguished name', size=128),
}
address_ldap()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,33 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="process_node_ldap0" model="process.node">
<field name="model_id" ref="base.model_res_partner_address"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;LDAP&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;LDAP (all services)&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_transition_employeeldap0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Employee LDAP&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Employee get all services of that company&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_ldap0"/>
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
</record>
<record id="process_transition_ldapuser0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;LDAP User&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Create your own openerp user&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="hr.process_node_openerpuser0"/>
<field model="process.node" name="source_node_id" ref="process_node_ldap0"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" ?>
<terp>
<data>
<wizard string="Synchronize with ldap" model="res.partner.address" name="partners.sync_ldap" id="wizard_ldap_sync" />
<menuitem name="Partners/Synchronize With Ldap" action="wizard_ldap_sync" type="wizard" />
</data>
</terp>

View File

@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
import synchronize
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,149 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import sys
if sys.version_info[:2] < (2, 4):
from sets import Set as set
import time
import ldap
import ldap.modlist
import wizard
import pooler
BASE_DN = 'ou=addressbook,dc=localdomain'
def terp2ldap(data):
res = {}
for ldap_name, terp in LDAP_TERP_MAPPER.items():
if callable(terp) and terp(data):
res[ldap_name] = [terp(data)]
elif isinstance(terp, basestring) and data[terp]:
res[ldap_name] = ['%s' % data[terp]]
return res
def get_lastname(dico):
lnames = dico['name'].split(' ', 1)[1:]
if lnames:
return ' '.join(lnames)
else:
return dico['name']
def get_street(dico):
return ' '.join([dico[x] for x in ('street', 'street2') if dico[x]])
def get_name(attribute):
def func(dico):
return dico[attribute][1]
return func
LDAP_TERP_MAPPER = {
'displayname': 'name',
'mail': 'email',
'o': get_name('partner_id'),
'telephoneNumber': 'phone',
'street': get_street,
'postalcode': 'zip',
'l': 'city',
'cn': 'name',
'sn': get_lastname,
'uid': 'id',
}
class sync_ldap(wizard.interface):
_login_arch = '''<?xml version="1.0" ?>
<form string="LDAP Credentials">
<field name="ldap_host" colspan="4" />
<field name="dn" colspan="4" />
<field name="password" colspan="4" />
</form>
'''
_login_fields = {
'ldap_host': {'string': 'LDAP Host', 'type': 'char', 'size': 128},
'dn': {'string': 'Distinguished name', 'type': 'char', 'size': 128},
'password': {'string': 'Password', 'type': 'char', 'size': 128},
}
def _do_sync(self, cr, uid, data, context):
l = ldap.open(data['form']['ldap_host'])
l.simple_bind_s(data['form']['dn'], data['form']['password'])
ldap_objs = dict(l.search_s(BASE_DN, ldap.SCOPE_ONELEVEL, 'objectclass=*',
LDAP_TERP_MAPPER.keys()))
address = pooler.get_pool(cr.dbname).get('res.partner.address')
terp_objs = dict([(x['id'], x) for x in address.read(cr, uid, address.search(cr, uid, []))])
ldap_set = [int(x['uid'][0]) for x in ldap_objs.values()]
terp_set = terp_objs.keys()
for to_delete in ldap_set:
if to_delete in terp_set:
continue
l.delete_s('uid=%s,%s' % (to_delete, BASE_DN))
for to_add in terp_set:
if to_add in ldap_set:
continue
new_dn = 'uid=%s,%s' % (to_add, BASE_DN)
ldap_data = {'objectclass' : ['organizationalPerson', 'inetOrgPerson']}
ldap_data.update(terp2ldap(terp_objs[to_add]))
l.add_s(new_dn, ldap.modlist.addModlist(ldap_data))
address.write(cr, uid, [to_add], {'dn' : new_dn})
for to_update in terp_set:
if to_update not in ldap_set:
continue
current_dn = 'uid=%s,%s' % (to_update, BASE_DN)
modlist = ldap.modlist.modifyModlist(ldap_objs[current_dn], terp2ldap(terp_objs[to_update]))
if modlist:
l.modify_s(current_dn, modlist)
return {}
states = {
'init' : {
'actions' : [],
'result' : {
'type' : 'form',
'arch' : _login_arch,
'fields' : _login_fields,
'state' : (('end', 'Cancel'),('sync', 'Synchronize'))
},
},
'sync' : {
'actions' : [ _do_sync ],
'result' : { 'type' : 'state', 'state' : 'end' },
},
}
sync_ldap('partners.sync_ldap')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -4,7 +4,7 @@
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_sale.html",
"depends" : ["sale", "crm", "product", "account"],
"depends" : ["sale", "crm_configuration", "product", "account"],
"category" : "Generic Modules/Sales & Purchases",
"description": """
This module adds a shortcut on one or several cases in the CRM.
@ -18,7 +18,9 @@
""",
"init_xml" : [],
"demo_xml" : [],
"update_xml" : ["sale_crm_wizard.xml"],
"update_xml" : ["sale_crm_wizard.xml",
"process/sale_crm_process.xml"
],
"active": False,
"installable": True
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="process_node_contractsale0" model="process.node">
<field name="menu_id" ref="sale.menu_sale_order"/>
<field name="model_id" ref="sale.model_sale_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Contract Sale&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Contract Command (sale)&quot;&quot;&quot;" name="note"/>
<field name="process_id" ref="crm_configuration.process_process_contractworkflow0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'manual', 'waiting_date', 'progress', 'shipping_except', 'invoice_except', 'done', 'cancel')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_transition_accordsale0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Accord Sale&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Goes into the Sale&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_contractsale0"/>
<field model="process.node" name="source_node_id" ref="crm_configuration.process_node_accord0"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
import sandwich
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,14 @@
# -*- encoding: utf-8 -*-
{
"name" : "Sandwich Module",
"author" : "Tiny",
"version" : "1.0",
"category" : "Generic Modules/Others",
"depends" : ["base", "product"],
"demo_xml" : ["sandwich_demo.xml"],
"update_xml" : ["sandwich_view.xml", "sandwich_report.xml", "sandwich_wizard.xml"],
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
import sandwich_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,45 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import time
from report import report_sxw
#
# sandwich command report
#
class sandwich_order_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(sandwich_order_print, self).__init__(cr, uid, name, context)
self.localcontext.update( {
'time': time,
})
report_sxw.report_sxw('report.sandwich.order.print','sandwich.order','addons/sandwich/report/sandwich_report.rml',parser=sandwich_order_print)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,142 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tableau2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tableau1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#c0c0c0" start="0,0" stop="0,0"/>
<blockBackground colorName="#c0c0c0" start="1,0" stop="1,0"/>
<blockBackground colorName="#c0c0c0" start="2,0" stop="2,0"/>
<blockBackground colorName="#c0c0c0" start="3,0" stop="3,0"/>
<blockBackground colorName="#c0c0c0" start="4,0" stop="4,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT"/>
<paraStyle name="P2" fontName="Times-Roman" fontSize="12.0" leading="15"/>
<paraStyle name="P3" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P4" fontName="Times-Roman" fontSize="12.0" leading="15"/>
<paraStyle name="P5" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="P6" fontName="Times-Roman" fontSize="12.0" leading="15"/>
<paraStyle name="P7" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT"/>
<paraStyle name="P8" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
<paraStyle name="P9" fontName="Times-Roman" alignment="RIGHT"/>
<paraStyle name="P10" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
</stylesheet>
<story>
<para style="P1">[[ repeatIn(objects, 'o') ]]</para>
<blockTable colWidths="280.0,202.0" repeatRows="1" style="Tableau2">
<tr>
<td>
<para style="Table Contents">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P2">[[ o.partner['name'] ]]</para>
<para style="P2">[[ o.partner.address[0]['street'] ]]</para>
<para style="P2">[[ o.partner.address[0]['street2'] ]]</para>
<para style="P2">[[ o.partner.address[0]['zip'] ]], [[ o.partner.address[0]['city'] ]]</para>
<para style="P2">[[ o.partner.address[0].state_id['name'] ]]</para>
<para style="P2">[[ o.partner.address[0].country_id['name'] ]]</para>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P2">Phone : [[ o.partner.address[0]['phone'] ]]</para>
<para style="P2">FAX : [[ o.partner.address[0]['fax'] ]]</para>
</td>
</tr>
</blockTable>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P2">Document : [[ o['name'] ]]</para>
<para style="P2">Date : [[ o['date'] ]]</para>
<para style="P3">Printing date : [[ time.strftime('%d/%m/%Y') ]]</para>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P4">
<font color="white"> </font>
</para>
<blockTable colWidths="192.0,71.0,87.0,69.0,64.0" style="Tableau1">
<tr>
<td>
<para style="P5">Item</para>
</td>
<td>
<para style="Table Heading">Quantity</para>
</td>
<td>
<para style="Table Heading">User</para>
</td>
<td>
<para style="Table Heading">Unit price</para>
</td>
<td>
<para style="Table Heading">Total Price</para>
</td>
</tr>
<tr>
<td>
<para style="P6"><b>[[ repeatIn(o.order_lines, 'a') ]]</b>
[[ a.product_id['name'] ]]</para>
</td>
<td>
<para style="P8">[[ a['quantity'] ]]</para>
</td>
<td>
<para style="P8">[[ a.user_id['login'] ]]</para>
</td>
<td>
<para style="P9">[[ a.product_id['price'] ]]</para>
</td>
<td>
<para style="P9">[[ a.product_id['price'] * a['quantity'] ]]</para>
</td>
</tr>
</blockTable>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P4">[[ o['note'] ]]</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P10">
<font color="white"> </font>
</para>
</story>
</document>

101
addons/sandwich/sandwich.py Normal file
View File

@ -0,0 +1,101 @@
# -*- encoding: utf-8 -*-
import time
from osv import osv, fields
import pooler
#
# Type of type of products (food, drink, lsd, other...)
#
class sandwich_product_type(osv.osv):
_name = 'sandwich.product.type'
_columns = {
'name': fields.char('Name of the type', size=20, required=True),
'description': fields.char('Type\'s description', size=255),
}
sandwich_product_type()
#
# Type Of Sandwich
#
class sandwich_product(osv.osv):
_name = 'sandwich.product'
_columns = {
'name': fields.char('Product name', size=50, required=True),
'price': fields.float('Product price'),
'product_type_id': fields.many2one('sandwich.product.type','Type of product'),
}
sandwich_product()
#
# Sandwich command
#
class sandwich_order(osv.osv):
_name = 'sandwich.order'
_columns = {
'name': fields.char('Name', size=50, required=True),
'date': fields.date('Order date'),
'order_lines': fields.one2many('sandwich.order.line','order_id','Order lines'),
'note': fields.text('Notes'),
'partner': fields.many2one('res.partner','Partner', required=True),
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d'),
}
sandwich_order()
#
# Sandwich lines of command
#
class sandwich_order_line(osv.osv):
_name = 'sandwich.order.line'
_columns = {
'name': fields.char('Description', size=50, required=True),
'product_id': fields.many2one('sandwich.product', 'Product'),
'user_id': fields.many2one('res.users', 'User id', required=True),
'quantity': fields.integer('Quantity', required=True),
'order_id': fields.many2one('sandwich.order', 'Order'),
'date': fields.date('Date'),
'product_type_id':fields.many2one('sandwich.product.type','Product type',change_default=True),
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d'),
'user_id': lambda self, cr, uid, c: uid,
'quantity': lambda *a: 1
}
def onchange_user_id(self, cr, uid, id, user_id, product_type_id, context={}, *args):
# print id, user_id, product_type_id, context
if (not user_id) or (not product_type_id):
return {}
cr.execute('SELECT product_id,name,quantity FROM sandwich_order_line WHERE user_id=%d AND product_type_id=%d ORDER BY date DESC LIMIT 1', (user_id, product_type_id))
res = cr.dictfetchone()
if res:
return {'value': res}
# else
return {'value': {'product_id': False, 'name': '', 'quantity': 1}}
def onchange_product_type_id(self, cr, uid, id, user_id, product_type_id, context={}):
if (not product_type_id) or (not user_id):
return {}
cr.execute('SELECT product_id,name,quantity FROM sandwich_order_line WHERE user_id=%d AND product_type_id=%d ORDER BY date DESC LIMIT 1', (user_id, product_type_id))
res = cr.dictfetchone()
if res:
return {'value': res}
# else
return {'value': {'product_id': False, 'name': '', 'quantity': 1}}
def onchange_product_id(self, cr, uid, id, product_id, context={}):
if not product_id:
return {}
res = pooler.get_pool(cr.dbname).get('sandwich.product').read(cr, uid, [ product_id ], ['name','product_type_id'])
return {'value': res}
#return {'value': {'name': name or product_id.name, 'product_type_id': product_id.product_type_id}}
sandwich_order_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,81 @@
<?xml version="1.0"?>
<terp>
<data noupdate="1">
<record model="sandwich.product.type" id="sandwich">
<field name="name">sandwich</field>
<field name="description">something to eat</field>
</record>
<record model="sandwich.product.type" id="drink">
<field name="name">drink</field>
<field name="description">Something to drink</field>
</record>
<record model="sandwich.product.type" id="candy">
<field name="name">candy</field>
<field name="description">so sweeeeeet, but so bad for your teeth...</field>
</record>
<record model="sandwich.product" id="club">
<field name="name">club</field>
<field name="price">2.00</field>
<field name="product_type_id" ref="sandwich"/>
</record>
<record model="sandwich.product" id="chicken_curry">
<field name="name">chicken-curry</field>
<field name="price">2.00</field>
<field name="product_type_id" ref="sandwich"/>
</record>
<record model="sandwich.product" id="tuna">
<field name="name">Tuna</field>
<field name="price">2.50</field>
<field name="product_type_id" ref="sandwich"/>
</record>
<record model="sandwich.product" id="cheese">
<field name="name">cheese</field>
<field name="price">1.50</field>
<field name="product_type_id" ref="sandwich"/>
</record>
<record model="sandwich.product" id="little_coke">
<field name="name">Little Coke 0.5l</field>
<field name="price">1.05</field>
<field name="product_type_id" ref="drink"/>
</record>
<record model="sandwich.product" id="coke">
<field name="name">Coke 1.0l</field>
<field name="price">2.00</field>
<field name="product_type_id" ref="drink"/>
</record>
<record model="sandwich.product" id="big_coke">
<field name="name">Big Coke 2.0l</field>
<field name="price">3.50</field>
<field name="product_type_id" ref="drink"/>
</record>
<record model="sandwich.product" id="cecemel">
<field name="name">Cecemel</field>
<field name="price">1.35</field>
<field name="product_type_id" ref="drink"/>
</record>
<record model="sandwich.product" id="water">
<field name="name">water</field>
<field name="price">0.75</field>
<field name="product_type_id" ref="drink"/>
</record>
<record model="sandwich.product" id="mars">
<field name="name">Mars</field>
<field name="price">0.80</field>
<field name="product_type_id" ref="candy"/>
</record>
<record model="sandwich.product" id="snicker">
<field name="name">Snickers</field>
<field name="price">0.80</field>
<field name="product_type_id" ref="candy"/>
</record>
<record model="sandwich.product" id="twix">
<field name="name">Twix</field>
<field name="price">1.00</field>
<field name="product_type_id" ref="candy"/>
</record>
</data>
</terp>

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<terp>
<data>
<report id="sandwich_order_print"
string="Sandwichs order"
model="sandwich.order"
name="sandwich.order.print"
rml="sandwich/report/sandwich_report.rml"
auto="False"/>
</data>
</terp>

View File

@ -0,0 +1,191 @@
<terp>
<data>
<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
<record model="ir.ui.view" id="sandwich_product_type_view_form">
<field name="name">sandwich.product.type</field>
<field name="model">sandwich.product.type</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Product type definition">
<field name="name" select="1"/>
<field name="description" select="1" />
</form>
</field>
</record>
<record model="ir.ui.view" id="sandwich_product_type_view_tree">
<field name="name">sandwich.product.type</field>
<field name="model">sandwich.product.type</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Product type definition">
<field name="name"/>
<field name="description"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_sandwich_product_type">
<field name="res_model">sandwich.product.type</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="domain">[]</field>
</record>
<menuitem name="Sandwich" id="menu_tools_sandwich" parent="menu_tools"/>
<menuitem name="Configuration" id="menu_tools_sandwich_configuration" parent="menu_tools_sandwich"/>
<menuitem name="Type of Product" id="menu_tools_sandwich_type_product" parent="menu_tools_sandwich_configuration" action="action_sandwich_product_type"/>
<record model="ir.ui.view" id="sandwich_product_view_tree">
<field name="name">sandwich.product</field>
<field name="model">sandwich.product</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Product definition">
<field name="name"/>
<field name="price"/>
<field name="product_type_id"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="sandwich_product_view_form">
<field name="name">sandwich.product</field>
<field name="model">sandwich.product</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Product definition">
<field name="name" select="1"/>
<field name="price" select="1" />
<field name="product_type_id" select="1"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_sandwich_product">
<field name="res_model">sandwich.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
</record>
<menuitem name="Product" id="menu_tools_sandwich_product" parent="menu_tools_sandwich_configuration" action="action_sandwich_product"/>
<record model="ir.ui.view" id="sandwich_order_line_view_tree">
<field name="name">sandwich.order.line.tree</field>
<field name="model">sandwich.order.line</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Product order lines">
<field name="date"/>
<field name="product_id"/>
<field name="quantity"/>
<field name="user_id" />
<field name="name"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="sandwich_order_line_view_form">
<field name="name">sandwich.order.line.form</field>
<field name="model">sandwich.order.line</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Product order lines">
<field name="product_type_id" select="1" on_change="onchange_user_id(user_id,product_type_id)"/>
<field name="user_id" select="1" on_change="onchange_user_id(user_id,product_type_id)"/>
<field name="product_id" select="1" onchange="onchange_product_id(product_id)" domain="[('product_type_id','=',product_type_id)]"/>
<field name="quantity" select="1"/>
<field name="name" select="1"/>
<field name="date" select="1"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_sandwich_order_line">
<field name="res_model">sandwich.order.line</field>
<field name="view_type">form</field>
<field name="domain">[]</field>
<field name="view_id" ref="sandwich_order_line_view_form"/>
</record>
<menuitem name="Order Lines" id="menu_tools_sandwich_orderlines" parent="menu_tools_sandwich" action="action_sandwich_order_line"/>
<record model="ir.actions.act_window" id="action_sandwich_my_order_line">
<field name="name">My order lines</field>
<field name="res_model">sandwich.order.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('user_id','=',uid)]</field>
</record>
<menuitem name="My Order Lines" id="menu_tools_sandwich_my_orderlines" parent="menu_tools_sandwich_orderlines" action="action_sandwich_my_order_line"/>
<record model="ir.actions.act_window" id="action_sandwich_my_order_line_of_the_day">
<field name="name">My order lines of the day</field>
<field name="res_model">sandwich.order.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('user_id','=',uid),('date','=',time.strftime('%Y-%m-%d'))]</field>
</record>
<menuitem name="My Order Lines of the Day" id="menu_tools_sandwich_my_orderlines_day" parent="menu_tools_sandwich_my_orderlines" action="action_sandwich_my_order_line_of_the_day"/>
<record model="ir.actions.act_window" id="action_sandwich_order_line_of_the_day">
<field name="name">Order lines of the day</field>
<field name="res_model">sandwich.order.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
</record>
<menuitem name="Order Lines of the Day" id="menu_tools_sandwich_orderlines_day" parent="menu_tools_sandwich_orderlines" action="action_sandwich_order_line_of_the_day"/>
<record model="ir.ui.view" id="sandwich_order_view_tree">
<field name="name">sandwich.order.tree</field>
<field name="model">sandwich.order</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Ordering of this day sandwich">
<field name="order_lines"/>
<field name="name"/>
<field name="note"/>
<field name="partner"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="sandwich_order_view_form">
<field name="name">sandwich.order.form</field>
<field name="model">sandwich.order</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Ordering of this day sandwich">
<notebook>
<page string="Sandwich Order">
<separator string="Informations" colspan="4"/>
<field name="name" colspan="4" select="1"/>
<field name="partner" select="1"/>
<field name="date" select="1"/>
<separator string="Order lines" colspan="4"/>
<field name="order_lines" colspan="4"/>
</page>
<page string="notes">
<field name="note" colspan="4" nolabel="1" select="1"/>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_sandwich_order">
<field name="name">Today's orders</field>
<field name="res_model">sandwich.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="False"/>
<field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
</record>
<menuitem name="Today's Orders" id="menu_tools_sandwich_today_order" parent="menu_tools_sandwich" action="action_sandwich_order"/>
</data>
</terp>

View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<terp>
<data>
<wizard string="Reload / Complete order" id="sandwich_order_wizard" model="sandwich.order" name="sandwich.order.wizard"/>
<wizard string="Send remind request" id="sandwich_order_recall_wizard" model="sandwich.order" name="sandwich.order.recall.wizard"/>
<record model="ir.actions.wizard" id="wiz_sandwich_create">
<field name="name">Create Order of the day</field>
<field name="wiz_name">sandwich.order_create</field>
</record>
<menuitem name="Create Order" id="menu_tools_sandwich_createorder" parent="menu_tools_sandwich" action="wiz_sandwich_create" type="wizard"/>
</data>
</terp>

View File

@ -0,0 +1,32 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import sandwich_wizard
import order_create
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,83 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id: makesale.py 1183 2005-08-23 07:43:32Z pinky $
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from mx.DateTime import now
import wizard
import netsvc
import ir
import pooler
sale_form = """<?xml version="1.0"?>
<form string="Make an order">
<field name="name" required="True" />
<field name="partner_id" required="True" />
</form>"""
sale_fields = {
'name' : {'string' : 'Order name', 'type': 'char'},
'partner_id' : {'string':'Suplier', 'relation':'res.partner', 'type':'many2one'},
}
class make_sale(wizard.interface):
def _makeOrder(self, cr, uid, data, context):
order = pooler.get_pool(cr.dbname).get('sandwich.order')
line = pooler.get_pool(cr.dbname).get('sandwich.order.line')
oid = order.create(cr, uid, {
'name': data['form']['name'],
'partner': data['form']['partner_id'],
})
name=data['form']['name']
cr.execute('update sandwich_order_line set order_id=%d where order_id is null', (oid,))
value = {
'domain': "[('id','in',["+str(oid)+"])]",
'name': "Create Sandwich Orders:"+name,
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'sandwich.order',
'view_id': False,
'type': 'ir.actions.act_window',
'res_id': oid
}
return value
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'form', 'arch' : sale_form, 'fields' : sale_fields, 'state' : [('end', 'Cancel'),('order', 'Make an order')]}
},
'order' : {
'actions': [],
'result': {'type': 'action', 'action': _makeOrder, 'state':'end'},
}
}
make_sale('sandwich.order_create')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,131 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import wizard
import pooler
#
# This class fill in the order with kind of automatically generated order lines, based on the last order for a user concerning a type of product
#
class sandwich_order_wizard(wizard.interface):
def _sandwich_order_wizard_order(self, cr, uid, data, context):
if not len(data['ids']):
return {}
cr.execute('update sandwich_order_line set order_id=%d where order_id is null', (data['ids'][0],))
for order in pooler.get_pool(cr.dbname).get('sandwich.order').browse(cr, uid, data['ids']):
for user_id in data['form']['user_id'][0][2]:
for producttype in data['form']['product_type_id'][0][2]:
if not pooler.get_pool(cr.dbname).get('sandwich.order.line').search(cr, uid, [('user_id','=',user_id),('product_type_id','=',producttype),('order_id','=',order.id)]):
vals = {
'user_id': user_id,
'order_id': order.id,
'date': order.date,
'product_type_id': producttype
}
vals.update( pooler.get_pool(cr.dbname).get('sandwich.order.line').onchange_user_id(cr, uid, uid, user_id, producttype)['value'] )
pooler.get_pool(cr.dbname).get('sandwich.order.line').create(cr, uid, vals)
return {}
_sandwich_order_wizard_form = '''<?xml version="1.0"?>
<form string="Complete order">
<separator string="Set orders for the day" colspan="4"/>
<field name="user_id"/>
<field name="product_type_id"/>
</form> '''
_sandwich_order_wizard_fields = {
'user_id': {'string': 'User', 'type': 'many2many','relation':'res.users'},
'product_type_id': {'string': 'Product', 'type': 'many2many', 'relation':'sandwich.product.type'},
}
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':_sandwich_order_wizard_form, 'fields':_sandwich_order_wizard_fields, 'state':[('end','Cancel'),('complete','Complete order')]}
},
'complete': {
'actions': [_sandwich_order_wizard_order],
'result': {'type': 'state', 'state': 'end'}
}
}
sandwich_order_wizard('sandwich.order.wizard')
#
# This class send a request message to users who don't have their order filled in for this day
#
class sandwich_order_recall_wizard(wizard.interface):
def _sandwich_order_recall_wizard_send(self, cr, uid, data, context):
for user_id in data['form']['user_id'][0][2]:
if not pooler.get_pool(cr.dbname).get('sandwich.order.line').search(cr, uid, [('user_id','=',user_id),('order_id','=',data['id'])]):
request = pooler.get_pool(cr.dbname).get('res.request')
request.create(cr, uid, {
'name' : "Please order your lunch of the day",
'priority' : '0',
'state' : 'active',
'body' : """Hello,
It seems like you have forgotten to order your sandwich (or meal).
As it will be ordered soon, it seems to be a rather nice idea to complete your
order for today ASAP. If you do not, you'll probably get the same meal as yesterday...
Thanks,
--
Tiny ERP
""",
'act_from' : uid,
'act_to' : user_id,
})
return {}
_sandwich_order_recall_wizard_form = '''<?xml version="1.0"?>
<form string="Recall orders to users">
<separator string="List of user to remind the order" colspan="4"/>
<field name="user_id" colspan="4"/>
</form>'''
_sandwich_order_recall_wizard_fields = {
'user_id': {'string': 'Baaaad users !', 'type': 'many2many', 'relation': 'res.users'},
}
states = {
'init' : {
'actions' : [],
'result' : {'type': 'form', 'arch': _sandwich_order_recall_wizard_form, 'fields': _sandwich_order_recall_wizard_fields, 'state': [('end','Cancel'),('send','Send')]},
},
'send' : {
'actions' : [_sandwich_order_recall_wizard_send],
'result' : {'type': 'state', 'state': 'end'},
}
}
sandwich_order_recall_wizard('sandwich.order.recall.wizard')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: