@@ -442,6 +442,7 @@ class account_journal(osv.osv):
|
||||
'name': fields.char('Journal Name', size=64, required=True, translate=True),
|
||||
'code': fields.char('Code', size=16),
|
||||
'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True),
|
||||
'refund_journal': fields.boolean('Refund Journal'),
|
||||
|
||||
'type_control_ids': fields.many2many('account.account.type', 'account_journal_type_rel', 'journal_id','type_id', 'Type Controls', domain=[('code','<>','view'), ('code', '<>', 'closed')]),
|
||||
'account_control_ids': fields.many2many('account.account', 'account_account_type_rel', 'journal_id','account_id', 'Account', domain=[('type','<>','view'), ('type', '<>', 'closed')]),
|
||||
@@ -790,7 +791,7 @@ class account_move(osv.osv):
|
||||
def button_cancel(self, cr, uid, ids, context={}):
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
if not line.journal_id.update_posted:
|
||||
raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !'))
|
||||
raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should mark the journal to allow canceling entries.'))
|
||||
if len(ids):
|
||||
cr.execute('update account_move set state=%s where id in ('+','.join(map(str,ids))+')', ('draft',))
|
||||
return True
|
||||
|
||||
@@ -55,7 +55,7 @@ class account_analytic_line(osv.osv):
|
||||
return False
|
||||
return True
|
||||
_constraints = [
|
||||
(_check_company, 'You can not create analytic line that is not in the same company than the account line', ['account_id'])
|
||||
# (_check_company, 'You can not create analytic line that is not in the same company than the account line', ['account_id'])
|
||||
]
|
||||
|
||||
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<field name="price_unit" select="1"/>
|
||||
<field name="discount"/>
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field colspan="4" name="origin" select="1"/>
|
||||
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id" on_change="onchange_account_id(parent.partner_id,account_id)"/>
|
||||
<field domain="[('type','<>','view'), ('company_id', '=', parent.company_id)]" name="account_analytic_id"/>
|
||||
<newline/>
|
||||
|
||||
@@ -624,6 +624,8 @@ class account_move_line(osv.osv):
|
||||
attrs.append('sum="Total debit"')
|
||||
elif field.field=='credit':
|
||||
attrs.append('sum="Total credit"')
|
||||
elif field.field=='account_tax_id':
|
||||
attrs.append('domain="[(\'parent_id\',\'=\',False)]"')
|
||||
elif field.field=='account_id' and journal.id:
|
||||
attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'<>\',\'view\'), (\'type\',\'<>\',\'closed\')]"')
|
||||
if field.readonly:
|
||||
@@ -676,7 +678,80 @@ class account_move_line(osv.osv):
|
||||
if update_check:
|
||||
if ('account_id' in vals) or ('journal_id' in vals) or ('period_id' in vals) or ('move_id' in vals) or ('debit' in vals) or ('credit' in vals) or ('date' in vals):
|
||||
self._update_check(cr, uid, ids, context)
|
||||
|
||||
obj_line=self.browse(cr, uid, ids[0])
|
||||
lines={}
|
||||
|
||||
obj_analytic_line=self.pool.get('account.analytic.line')
|
||||
analytic=True
|
||||
journal_flag=False
|
||||
del_line=False
|
||||
|
||||
if ('journal_id' in vals):
|
||||
journal=self.pool.get('account.journal').browse(cr,uid,vals['journal_id'])
|
||||
journal_flag=True
|
||||
|
||||
del_line=True
|
||||
|
||||
if del_line:
|
||||
for obj in obj_line.analytic_lines:
|
||||
obj_analytic_line.unlink(cr,uid,obj.id)
|
||||
analytic=False
|
||||
|
||||
if obj_line.analytic_lines:
|
||||
mode='write'
|
||||
else:
|
||||
mode='create'
|
||||
|
||||
if obj_line.analytic_lines and analytic:
|
||||
if ('analytic_account_id' in vals):
|
||||
lines['account_id'] = vals['analytic_account_id']
|
||||
|
||||
if ('account_id' in vals):
|
||||
lines['general_account_id'] = vals['account_id']
|
||||
|
||||
if ('name' in vals):
|
||||
lines['name'] = vals['name']
|
||||
|
||||
if ('date' in vals):
|
||||
lines['date'] = vals['date']
|
||||
|
||||
if ('ref' in vals and vals['ref']):
|
||||
lines['ref'] = vals['ref']
|
||||
|
||||
if ('quantity' in vals and vals['quantity']):
|
||||
lines['unit_amount'] = vals['quantity']
|
||||
|
||||
if ('credit' in vals and vals['credit']):
|
||||
lines['amount'] = vals['credit']
|
||||
|
||||
if ('debit' in vals and vals['debit']):
|
||||
lines['amount'] = vals['debit']
|
||||
|
||||
if journal_flag:
|
||||
lines['journal_id']=journal.analytic_journal_id.id
|
||||
|
||||
if lines:
|
||||
if mode=='write':
|
||||
obj_analytic_line.write(cr,uid,obj_line.analytic_lines[0].id,lines,context)
|
||||
|
||||
result = super(osv.osv, self).write(cr, uid, ids, vals, context)
|
||||
|
||||
if mode=='create' and analytic and obj_line.analytic_account_id:
|
||||
if obj_line.journal_id.analytic_journal_id:
|
||||
vals_lines={
|
||||
'name': obj_line.name,
|
||||
'date': obj_line.date,
|
||||
'account_id': obj_line.analytic_account_id.id,
|
||||
'unit_amount':obj_line.quantity,
|
||||
'amount': obj_line.debit or obj_line.credit,
|
||||
'general_account_id': obj_line.account_id.id,
|
||||
'journal_id': obj_line.journal_id.analytic_journal_id.id,
|
||||
'ref': obj_line.ref,
|
||||
'move_id':obj_line.id
|
||||
}
|
||||
obj_analytic_line.create(cr,uid,vals_lines)
|
||||
|
||||
if check:
|
||||
done = []
|
||||
for line in self.browse(cr, uid, ids):
|
||||
@@ -719,7 +794,6 @@ class account_move_line(osv.osv):
|
||||
context={}
|
||||
account_obj = self.pool.get('account.account')
|
||||
tax_obj=self.pool.get('account.tax')
|
||||
|
||||
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
|
||||
raise osv.except_osv(_('Bad account!'), _('You can not use an inactive account!'))
|
||||
if 'journal_id' in vals and 'journal_id' not in context:
|
||||
@@ -786,29 +860,69 @@ class account_move_line(osv.osv):
|
||||
if not ok:
|
||||
raise osv.except_osv(_('Bad account !'), _('You can not use this general account in this journal !'))
|
||||
|
||||
result = super(osv.osv, self).create(cr, uid, vals, context)
|
||||
# result = super(osv.osv, self).create(cr, uid, vals, context)
|
||||
if 'analytic_account_id' in vals and vals['analytic_account_id']:
|
||||
if journal.analytic_journal_id:
|
||||
vals['analytic_lines'] = [(0,0, {
|
||||
'name': vals['name'],
|
||||
'date': vals['date'],
|
||||
'account_id': vals['analytic_account_id'],
|
||||
'unit_amount': vals['quantity'],
|
||||
'unit_amount':'quantity' in vals and vals['quantity'] or 1.0,
|
||||
'amount': vals['debit'] or vals['credit'],
|
||||
'general_account_id': vals['account_id'],
|
||||
'journal_id': journal.analytic_journal_id.id,
|
||||
'ref': vals['ref'],
|
||||
})]
|
||||
|
||||
else:
|
||||
raise osv.except_osv(_('No analytic journal !'), _('Please set an analytic journal on this financial journal !'))
|
||||
result = super(osv.osv, self).create(cr, uid, vals, context)
|
||||
# CREATE Taxes
|
||||
if 'account_tax_id' in vals and vals['account_tax_id']:
|
||||
tax_id=tax_obj.browse(cr,uid,vals['account_tax_id'])
|
||||
total = vals['credit'] or (-vals['debit'])
|
||||
total = vals['debit'] - vals['credit']
|
||||
if journal.refund_journal:
|
||||
base_code = 'ref_base_code_id'
|
||||
tax_code = 'ref_tax_code_id'
|
||||
account_id = 'account_paid_id'
|
||||
base_sign = 'ref_base_sign'
|
||||
tax_sign = 'ref_tax_sign'
|
||||
else:
|
||||
base_code = 'base_code_id'
|
||||
tax_code = 'tax_code_id'
|
||||
account_id = 'account_collected_id'
|
||||
base_sign = 'base_sign'
|
||||
tax_sign = 'tax_sign'
|
||||
|
||||
tmp_cnt = 0
|
||||
for tax in tax_obj.compute(cr,uid,[tax_id],total,1.00):
|
||||
self.write(cr, uid,[result], {
|
||||
'tax_code_id': tax['base_code_id'],
|
||||
'tax_amount': tax['base_sign'] * total
|
||||
})
|
||||
#create the base movement
|
||||
if tmp_cnt == 0:
|
||||
if tax[base_code]:
|
||||
tmp_cnt += 1
|
||||
self.write(cr, uid,[result], {
|
||||
'tax_code_id': tax[base_code],
|
||||
'tax_amount': tax[base_sign] * abs(total)
|
||||
})
|
||||
else:
|
||||
data = {
|
||||
'move_id': vals['move_id'],
|
||||
'journal_id': vals['journal_id'],
|
||||
'period_id': vals['period_id'],
|
||||
'name': vals['name']+' '+tax['name'],
|
||||
'date': vals['date'],
|
||||
'partner_id': vals.get('partner_id',False),
|
||||
'ref': vals.get('ref',False),
|
||||
'account_tax_id': False,
|
||||
'tax_code_id': tax[base_code],
|
||||
'tax_amount': tax[base_sign] * abs(total),
|
||||
'account_id': vals['account_id'],
|
||||
'credit': 0.0,
|
||||
'debit': 0.0,
|
||||
}
|
||||
if data['tax_code_id']:
|
||||
self.create(cr, uid, data, context)
|
||||
|
||||
#create the VAT movement
|
||||
data = {
|
||||
'move_id': vals['move_id'],
|
||||
'journal_id': vals['journal_id'],
|
||||
@@ -818,13 +932,15 @@ class account_move_line(osv.osv):
|
||||
'partner_id': vals.get('partner_id',False),
|
||||
'ref': vals.get('ref',False),
|
||||
'account_tax_id': False,
|
||||
'tax_code_id': tax['tax_code_id'],
|
||||
'tax_amount': tax['tax_sign'] * tax['amount'],
|
||||
'account_id': tax['account_paid_id'], # or collected ?
|
||||
'credit': tax['amount']>0 and tax['amount'] or 0.0,
|
||||
'debit': tax['amount']<0 and -tax['amount'] or 0.0,
|
||||
'tax_code_id': tax[tax_code],
|
||||
'tax_amount': tax[tax_sign] * abs(tax['amount']),
|
||||
'account_id': tax[account_id],
|
||||
'credit': tax['amount']<0 and -tax['amount'] or 0.0,
|
||||
'debit': tax['amount']>0 and tax['amount'] or 0.0,
|
||||
}
|
||||
self.create(cr, uid, data, context)
|
||||
if data['tax_code_id']:
|
||||
self.create(cr, uid, data, context)
|
||||
|
||||
if check:
|
||||
tmp = self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
|
||||
if journal.entry_posted and tmp:
|
||||
|
||||
@@ -172,7 +172,6 @@
|
||||
<field name="name">Chart of Accounts</field>
|
||||
<field name="res_model">account.account</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_account_tree"/>
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
</record>
|
||||
@@ -717,10 +716,10 @@
|
||||
<page string="Analytic Lines">
|
||||
<field colspan="4" name="analytic_lines" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Move Lines">
|
||||
<!--<page string="Move Lines">
|
||||
<field colspan="4" name="reconcile_implicit"/>
|
||||
<field colspan="4" name="parent_move_lines" nolabel="0"/>
|
||||
</page>
|
||||
</page>-->
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
+149
-134
File diff suppressed because it is too large
Load Diff
@@ -861,6 +861,7 @@ class account_invoice_line(osv.osv):
|
||||
_description = "Invoice line"
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=256, required=True),
|
||||
'origin': fields.char('Origin', size=256, help="Reference of the document that produced this invoice."),
|
||||
'invoice_id': fields.many2one('account.invoice', 'Invoice Ref', ondelete='cascade', select=True),
|
||||
'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'),
|
||||
'product_id': fields.many2one('product.product', 'Product', ondelete='set null'),
|
||||
@@ -1043,7 +1044,7 @@ class account_invoice_tax(osv.osv):
|
||||
val={}
|
||||
val['invoice_id'] = inv.id
|
||||
val['name'] = tax['name']
|
||||
val['amount'] = cur_obj.round(cr, uid, cur, tax['amount'])
|
||||
val['amount'] = tax['amount']
|
||||
val['manual'] = False
|
||||
val['sequence'] = tax['sequence']
|
||||
val['base'] = tax['price_unit'] * line['quantity']
|
||||
@@ -1070,6 +1071,8 @@ class account_invoice_tax(osv.osv):
|
||||
tax_grouped[key]['base_amount'] += val['base_amount']
|
||||
tax_grouped[key]['tax_amount'] += val['tax_amount']
|
||||
|
||||
for t in tax_grouped.values():
|
||||
t['amount'] = cur_obj.round(cr, uid, cur, t['amount'])
|
||||
return tax_grouped
|
||||
|
||||
def move_line_get(self, cr, uid, invoice_id):
|
||||
|
||||
@@ -36,27 +36,27 @@ from osv import osv
|
||||
|
||||
class general_ledger(rml_parse.rml_parse):
|
||||
_name = 'report.account.general.ledger'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def preprocess(self, objects, data, ids):
|
||||
##
|
||||
|
||||
|
||||
|
||||
|
||||
self.borne_date = self.get_min_date(data['form'])
|
||||
|
||||
|
||||
|
||||
|
||||
##
|
||||
new_ids = []
|
||||
if (data['model'] == 'account.account'):
|
||||
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, self).preprocess(objects, data, new_ids)
|
||||
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(general_ledger, self).__init__(cr, uid, name, context)
|
||||
self.date_borne = {}
|
||||
@@ -64,7 +64,7 @@ class general_ledger(rml_parse.rml_parse):
|
||||
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,
|
||||
@@ -73,7 +73,7 @@ class general_ledger(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
|
||||
})
|
||||
@@ -82,7 +82,7 @@ class general_ledger(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
|
||||
#
|
||||
@@ -92,7 +92,7 @@ class general_ledger(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\
|
||||
@@ -115,10 +115,8 @@ class general_ledger(rml_parse.rml_parse):
|
||||
return result
|
||||
|
||||
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
|
||||
@@ -130,20 +128,21 @@ class general_ledger(rml_parse.rml_parse):
|
||||
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])]):
|
||||
|
||||
if account and account.child_consol_ids: # add ids of consolidated childs also of selected account
|
||||
ctx['consolidate_childs'] = True
|
||||
ctx['account_id'] = account.id
|
||||
ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])],context=ctx)
|
||||
|
||||
for child_id in ids_acc:
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
|
||||
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
|
||||
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
|
||||
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
@@ -158,52 +157,51 @@ class general_ledger(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)],
|
||||
context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
|
||||
|
||||
##
|
||||
|
||||
|
||||
|
||||
|
||||
## We will now compute solde initiaux
|
||||
|
||||
|
||||
if not len(res):
|
||||
return[account]
|
||||
else:
|
||||
for move in res:
|
||||
|
||||
|
||||
SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'"
|
||||
self.cr.execute(SOLDEINIT)
|
||||
resultat = self.cr.dictfetchall()
|
||||
|
||||
resultat = self.cr.dictfetchall()
|
||||
|
||||
if resultat[0] :
|
||||
|
||||
|
||||
if resultat[0]['sum_debit'] == None:
|
||||
sum_debit = 0
|
||||
else:
|
||||
|
||||
|
||||
sum_debit = resultat[0]['sum_debit']
|
||||
if resultat[0]['sum_credit'] == None:
|
||||
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 get_min_date(self,form):
|
||||
|
||||
|
||||
## Get max born from account_fiscal year
|
||||
#
|
||||
sql = """ select min(fy.date_start) as start_date,max(fy.date_stop) as stop_date from account_fiscalyear
|
||||
@@ -218,9 +216,9 @@ class general_ledger(rml_parse.rml_parse):
|
||||
periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date 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) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """)
|
||||
@@ -236,9 +234,9 @@ class general_ledger(rml_parse.rml_parse):
|
||||
periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date 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) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """)
|
||||
@@ -270,8 +268,8 @@ class general_ledger(rml_parse.rml_parse):
|
||||
}
|
||||
return self.date_borne
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def lines(self, account, form):
|
||||
inv_types = {
|
||||
'out_invoice': 'CI: ',
|
||||
@@ -280,27 +278,27 @@ class general_ledger(rml_parse.rml_parse):
|
||||
'in_refund': 'SR: ',
|
||||
}
|
||||
### We will now compute solde initaux
|
||||
|
||||
|
||||
if form['sortbydate'] == 'sort_date':
|
||||
sorttag = 'l.date'
|
||||
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 as l
|
||||
LEFT JOIN res_currency c on (l.currency_id=c.id)
|
||||
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
|
||||
WHERE l.date<='%s'
|
||||
AND l.date>='%s'
|
||||
ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag)
|
||||
|
||||
AND %s
|
||||
WHERE l.date<='%s'
|
||||
AND l.date>='%s'
|
||||
ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag)
|
||||
|
||||
self.cr.execute(sql)
|
||||
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
sum = 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
for l in res:
|
||||
@@ -324,7 +322,7 @@ class general_ledger(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']
|
||||
@@ -356,7 +354,7 @@ class general_ledger(rml_parse.rml_parse):
|
||||
sum_credit += account.init_credit
|
||||
#
|
||||
##
|
||||
|
||||
|
||||
return sum_credit
|
||||
|
||||
def _sum_solde_account(self, account, form):
|
||||
@@ -366,7 +364,7 @@ class general_ledger(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
|
||||
|
||||
|
||||
@@ -402,7 +400,7 @@ class general_ledger(rml_parse.rml_parse):
|
||||
# "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):
|
||||
self.cr.execute("SELECT c.code as code "\
|
||||
"FROM res_currency c,account_account as ac "\
|
||||
@@ -412,20 +410,20 @@ class general_ledger(rml_parse.rml_parse):
|
||||
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
|
||||
else:
|
||||
currency_total = self.tot_currency = 0.0
|
||||
return currency_total
|
||||
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/general_ledger.rml', parser=general_ledger, header=False)
|
||||
|
||||
@@ -199,8 +199,11 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
|
||||
#
|
||||
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])]):
|
||||
if account and account.child_consol_ids: # add ids of consolidated childs also of selected account
|
||||
ctx['consolidate_childs'] = True
|
||||
ctx['account_id'] = account.id
|
||||
ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])], context=ctx)
|
||||
for child_id in ids_acc:
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
@@ -294,9 +297,9 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
else :
|
||||
l['partner'] = ''
|
||||
|
||||
|
||||
|
||||
sum = l['debit'] - l ['credit']
|
||||
|
||||
|
||||
c = time.strptime(l['date'],"%Y-%m-%d")
|
||||
l['date'] = time.strftime("%d-%m-%Y",c)
|
||||
l['progress'] = sum
|
||||
|
||||
@@ -195,6 +195,7 @@
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
@@ -203,7 +204,7 @@
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
|
||||
@@ -241,29 +242,29 @@
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.partner_id.title or '' ]][[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.title or '' ]][[ o.address_invoice_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.street ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.zip or '' ]][[ o.address_invoice_id.city or '' ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_8">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_8">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_8">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_8">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_header">Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||
<para style="terp_header">Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]][[ o.number ]]</para>
|
||||
<para style="terp_header">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
|
||||
<para style="terp_header">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para>
|
||||
<para style="terp_header">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para>
|
||||
<para style="terp_header">Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
|
||||
<para style="terp_header">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||
<para style="terp_header">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||
<para style="terp_header">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||
<para style="terp_header">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]][[ o.number ]]</para>
|
||||
<para style="terp_header">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]][[ o.number ]]</para>
|
||||
<para style="terp_header">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]][[ o.number ]]</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
@@ -276,7 +277,7 @@
|
||||
<para style="terp_tblheader_General_Centre">Invoice Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Partner Code</para>
|
||||
<para style="terp_tblheader_General_Centre">Partner Ref.</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -289,7 +290,7 @@
|
||||
<para style="terp_default_Centre_9">[[ o.date_invoice ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ o.address_invoice_id.partner_id.ref or '' ]]</para>
|
||||
<para style="terp_default_Centre_9">[[ o.address_invoice_id.partner_id.ref or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -314,7 +315,7 @@
|
||||
<para style="terp_tblheader_Details_Right">Disc. (%)</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Price</para>
|
||||
<para style="terp_tblheader_Details_Centre">Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -326,22 +327,22 @@
|
||||
<para style="terp_default_9">[[ l.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ ', '.join([lt.name for lt in l.invoice_line_tax_id]) ]]</para>
|
||||
<para style="terp_default_9">[[ ', '.join([lt.name for lt in l.invoice_line_tax_id]) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(l.quantity) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(l.quantity) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ (l.uos_id and l.uos_id.name) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(l.price_unit) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(l.price_unit) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ l.discount and formatLang (l.discount) or '' ]] </para>
|
||||
<para style="terp_default_Right_9">[[ l.discount and formatLang (l.discount) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(l.price_subtotal) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(l.price_subtotal) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
|
||||
@@ -349,7 +350,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Note">[[ format(l.note or removeParentNode('tr')) ]]</para>
|
||||
<para style="terp_default_Note">[[ format(l.note or removeParentNode('tr')) ]]</para>
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Note">
|
||||
@@ -389,10 +393,10 @@
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<blockTable colWidths="277.0,247.0" style="Table_Format_2">
|
||||
<blockTable colWidths="371.0,153.0" style="Table_Format_2">
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="138.0,138.0" style="Table_format_Table_Line_total">
|
||||
<blockTable colWidths="176.0,258.0" style="Table_format_Table_Line_total">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_2">
|
||||
@@ -408,13 +412,13 @@
|
||||
</blockTable>
|
||||
</td>
|
||||
<td>
|
||||
<blockTable colWidths="120.0,91.0,29.0" style="Table_eclu_Taxes_Total">
|
||||
<blockTable colWidths="62.0,59.0,25.0" style="Table_eclu_Taxes_Total">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Net Total:</para>
|
||||
<para style="P1">Net Total:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
|
||||
@@ -424,13 +428,13 @@
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="120.0,92.0,28.0" style="Table_Taxes_Total">
|
||||
<blockTable colWidths="63.0,58.0,26.0" style="Table_Taxes_Total">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Taxes:</para>
|
||||
<para style="P1">Taxes:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax) or '0.00']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
|
||||
@@ -440,13 +444,13 @@
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="119.0,93.0,28.0" style="Table_Total_Include_Taxes">
|
||||
<blockTable colWidths="63.0,58.0,26.0" style="Table_Total_Include_Taxes">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Total:</para>
|
||||
<para style="P1">Total:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(o.amount_total) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(o.amount_total) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
|
||||
@@ -459,20 +463,23 @@
|
||||
<blockTable colWidths="530.0" style="Table_Main_Table">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">[[ format(o.amount_tax or removeParentNode('blockTable')) ]]</para>
|
||||
<para style="terp_default_8">[[ format(o.amount_tax or removeParentNode('blockTable')) ]]</para>
|
||||
<blockTable colWidths="54.0,58.0,67.0" style="Table_Tax_Header">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Tax</para>
|
||||
<para style="terp_tblheader_Details_Centre">Tax</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Right">Base</para>
|
||||
<para style="terp_tblheader_Details_Right">Base</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Right">Amount</para>
|
||||
<para style="terp_tblheader_Details_Right">Amount</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -487,7 +494,7 @@
|
||||
<para style="terp_default_Right_8">[[ formatLang(t.base) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_8">[[ formatLang(t.amount) or 0.00 ]]</para>
|
||||
<para style="terp_default_Right_8">[[ formatLang(t.amount) or 0.00 ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -534,7 +541,7 @@
|
||||
<blockTable colWidths="530.0" style="Table_Coment_Payment_Term">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ format(o.comment or removeParentNode('blockTable')) ]]</para>
|
||||
<para style="terp_default_9">[[ format(o.comment or removeParentNode('blockTable')) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -544,7 +551,7 @@
|
||||
<blockTable colWidths="530.0" style="Table_Payment_Terms">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ format((o.payment_term and o.payment_term.note) or removeParentNode('blockTable')) ]]</para>
|
||||
<para style="terp_default_9">[[ format((o.payment_term and o.payment_term.note) or removeParentNode('blockTable')) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
@@ -47,7 +47,7 @@ class wiz_state_open(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('yes','Yes'),('end','No')]}
|
||||
'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','No','gtk-no'),('yes','Yes','gtk-yes')]}
|
||||
},
|
||||
'yes': {
|
||||
'actions': [_change_inv_state],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -29,7 +29,7 @@ Add menu to show relevant information for each manager.""",
|
||||
"category" : "Generic Modules/Accounting",
|
||||
"module": "",
|
||||
"website": "http://www.camptocamp.com/",
|
||||
"depends" : ["account","hr_timesheet","hr_timesheet_invoice"],
|
||||
"depends" : ["account","hr_timesheet","hr_timesheet_invoice","project"],
|
||||
"init_xml" : [],
|
||||
"update_xml" : [
|
||||
"security/ir.model.access.csv",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_analytic_analysis
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:28+0000\n"
|
||||
"PO-Revision-Date: 2008-10-09 12:57+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
@@ -18,11 +18,9 @@ msgstr ""
|
||||
|
||||
#. module: account_analytic_analysis
|
||||
#: constraint:ir.model:0
|
||||
msgid ""
|
||||
"The Object name must start with x_ and not contain any special character !"
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
"Le nom de l'objet doit commencer avec x_ et ne pas contenir de charactères "
|
||||
"spéciaux !"
|
||||
"Le nom de l'objet doit commencer avec x_ et ne pas contenir de charactères spéciaux !"
|
||||
|
||||
#. module: account_analytic_analysis
|
||||
#: field:account.analytic.account,remaining_ca:0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -24,7 +24,7 @@
|
||||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://tinyerp.com",
|
||||
"category" : "Generic Modules/product_analytic_default",
|
||||
"category" : "Generic Modules/Accounting",
|
||||
"description": """
|
||||
Allows to automatically select analytic accounts based on criterions:
|
||||
* Product
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_analytic_default
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:25+0000\n"
|
||||
"PO-Revision-Date: 2008-10-09 13:01+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
{
|
||||
"name" : "Multiple-plans management in analytic accounting",
|
||||
"name" : "Multiple-plans management in Analytic Accounting",
|
||||
"version" : "1.0",
|
||||
"depends" : ["account", "account_analytic_default"],
|
||||
"author" : "Tiny",
|
||||
|
||||
@@ -135,12 +135,14 @@ class account_analytic_plan_instance(osv.osv):
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
|
||||
wiz_id = self.pool.get('ir.actions.wizard').search(cr, uid, [("wiz_name","=","create.model")])
|
||||
res = super(account_analytic_plan_instance,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
|
||||
|
||||
if (res['type']=='form'):
|
||||
plan_id = False
|
||||
if context.get('journal_id',False):
|
||||
plan_id = self.pool.get('account.journal').browse(cr, uid, int(context['journal_id']), context).plan_id
|
||||
elif context.get('plan_id',False):
|
||||
plan_id = self.pool.get('account.analytic.plan').browse(cr, uid, int(context['plan_id']), context).plan_id
|
||||
plan_id = self.pool.get('account.analytic.plan').browse(cr, uid, int(context['plan_id']), context)
|
||||
|
||||
if plan_id:
|
||||
i=1
|
||||
res['arch'] = """<form string="%s">
|
||||
@@ -189,6 +191,9 @@ class account_analytic_plan_instance(osv.osv):
|
||||
if total_per_plan < item.min_required or total_per_plan > item.max_required:
|
||||
raise osv.except_osv("Value Error" ,"The Total Should be Between " + str(item.min_required) + " and " + str(item.max_required))
|
||||
|
||||
if not vals['name'] and not vals['code']:
|
||||
raise osv.except_osv('Error', 'Make sure You have entered Name and Code for the model !')
|
||||
|
||||
return super(account_analytic_plan_instance, self).create(cr, uid, vals, context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context={}, check=True, update_check=True):
|
||||
@@ -205,9 +210,9 @@ class account_analytic_plan_instance(osv.osv):
|
||||
#and finally modify the old model to be not a model anymore
|
||||
vals['plan_id'] = False
|
||||
if not vals.has_key('name'):
|
||||
vals['name'] = this.name+'*'
|
||||
vals['name'] = this.name and (str(this.name)+'*') or "*"
|
||||
if not vals.has_key('code'):
|
||||
vals['code'] = this.code+'*'
|
||||
vals['code'] = this.code and (str(this.code)+'*') or "*"
|
||||
return self.write(cr, uid, [this.id],vals, context)
|
||||
else:
|
||||
#this plan instance isn't a model, so a simple write is fine
|
||||
@@ -309,6 +314,11 @@ class account_move_line(osv.osv):
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
self.called=False
|
||||
if ('analytics_id' in vals) and (not vals['analytics_id']):
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
toremove = self.pool.get('account.analytic.line').search(cr, uid, [('move_id','=',line.id)], context=context)
|
||||
if toremove:
|
||||
self.pool.get('account.analytic.line').unlink(cr, uid, toremove, context=context)
|
||||
result = super(account_move_line, self).write(cr, uid, ids, vals, context, check, update_check)
|
||||
self._analytic_update(cr, uid, ids, context)
|
||||
return result
|
||||
@@ -325,8 +335,6 @@ class account_invoice(osv.osv):
|
||||
_name = "account.invoice"
|
||||
_inherit="account.invoice"
|
||||
|
||||
|
||||
|
||||
def line_get_convert(self, cr, uid, x, part, date, context={}):
|
||||
res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context)
|
||||
res['analytics_id']=x.get('analytics_id',False)
|
||||
|
||||
@@ -95,10 +95,10 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Analytic Distribution">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="plan_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="plan_id" select="2"/>
|
||||
<field name="journal_id" select="2"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -115,7 +115,7 @@
|
||||
<act_window name="Distribution Models"
|
||||
domain="[('plan_id', '=', active_id),('plan_id','<>',False)]"
|
||||
context="{'plan_id': active_id}"
|
||||
res_model="account.analytic.instance"
|
||||
res_model="account.analytic.plan.instance"
|
||||
src_model="account.analytic.plan"
|
||||
id="account_analytic_instance_model_open"/>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_analytic_plans
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:29+0000\n"
|
||||
"PO-Revision-Date: 2008-10-09 13:24+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -29,6 +29,7 @@ info = '''<?xml version="1.0"?>
|
||||
<label string="This distribution model has been saved.\nYou will be able to reuse it later."/>
|
||||
</form>'''
|
||||
|
||||
|
||||
def activate(self, cr, uid, data, context):
|
||||
plan_obj = pooler.get_pool(cr.dbname).get('account.analytic.plan.instance')
|
||||
if data['id']:
|
||||
@@ -43,6 +44,8 @@ def activate(self, cr, uid, data, context):
|
||||
else:
|
||||
return 'endit'
|
||||
|
||||
def _do_nothing(self, cr, uid, data, context):
|
||||
return 1
|
||||
|
||||
class create_model(wizard.interface):
|
||||
|
||||
@@ -57,7 +60,7 @@ class create_model(wizard.interface):
|
||||
},
|
||||
'endit': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':'', 'fields':{}, 'state':[('end','OK')]} #FIXME: check
|
||||
'result': {'type':'action','action':_do_nothing , 'state':'end'} #FIXME: check
|
||||
},
|
||||
}
|
||||
create_model('create.model')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_balance
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:29+0000\n"
|
||||
"PO-Revision-Date: 2008-10-09 14:13+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!--
|
||||
Budgets
|
||||
-->
|
||||
|
||||
|
||||
<record id="view_budget_post_tree" model="ir.ui.view">
|
||||
<field name="name">account.budget.post.tree</field>
|
||||
<field name="model">account.budget.post</field>
|
||||
@@ -80,7 +80,7 @@
|
||||
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="graph,tree">
|
||||
<graph type="bar" string="Lines">
|
||||
<field name="analytic_account_id" />
|
||||
<field name="general_budget_id" operator="+" />
|
||||
<!--<field name="general_budget_id" operator="+" />-->
|
||||
<field name="planned_amount" operator="+"/>
|
||||
<field group="True" name="general_budget_id"/>
|
||||
</graph>
|
||||
@@ -270,7 +270,7 @@
|
||||
</form>
|
||||
<graph type="bar" string="Lines">
|
||||
<field name="general_budget_id" />
|
||||
<field name="analytic_account_id" operator="+"/>
|
||||
<!--<field name="analytic_account_id" operator="+"/>-->
|
||||
<field name="planned_amount" operator="+"/>
|
||||
<field group="True" name="analytic_account_id"/>
|
||||
</graph>
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:26+0000\n"
|
||||
"PO-Revision-Date: 2008-10-14 10:30+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_date_check
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:23+0000\n"
|
||||
"PO-Revision-Date: 2008-10-10 06:24+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_followup
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:26+0000\n"
|
||||
"PO-Revision-Date: 2008-10-10 06:38+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -31,12 +31,12 @@
|
||||
* order all the lines of an invoice
|
||||
* add titles, comment lines, sub total lines
|
||||
* draw horizontal lines and put page breaks
|
||||
|
||||
|
||||
Moreover, there is one option which allow you to print all the selected invoices with a given special message at the bottom of it. This feature can be very useful for printing your invoices with end-of-year wishes, special punctual conditions...
|
||||
|
||||
""",
|
||||
"website" : "http://tinyerp.com/",
|
||||
"category" : "Generic Modules/Project & Services",
|
||||
"category" : "Generic Modules/Projects & Services",
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_invoice_layout
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:12+0000\n"
|
||||
"PO-Revision-Date: 2008-10-10 06:56+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_payment
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:29+0000\n"
|
||||
"PO-Revision-Date: 2008-10-10 08:14+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -74,7 +74,7 @@ class account_report(osv.osv):
|
||||
del context['fiscalyear']
|
||||
acc = self.pool.get('account.account')
|
||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0)
|
||||
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
|
||||
def _calc_debit(code,year=0):
|
||||
context['fiscalyear']=_calc_context(year,obj_fy)
|
||||
@@ -82,7 +82,7 @@ class account_report(osv.osv):
|
||||
del context['fiscalyear']
|
||||
acc = self.pool.get('account.account')
|
||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0)
|
||||
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
|
||||
def _calc_balance(code,year=0):
|
||||
context['fiscalyear']=_calc_context(year,obj_fy)
|
||||
@@ -90,12 +90,12 @@ class account_report(osv.osv):
|
||||
del context['fiscalyear']
|
||||
acc = self.pool.get('account.account')
|
||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||
return reduce(lambda y,x=0: x.balance+y, acc.browse(cr, uid, acc_id, context),0)
|
||||
return reduce(lambda y,x=0: x.balance+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
|
||||
def _calc_report(*code):
|
||||
acc = self.pool.get('account.report.report')
|
||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0)
|
||||
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
|
||||
def _calc_tax_code(code,period=0):
|
||||
context['period_id']=_calc_context(period,obj_period)
|
||||
@@ -104,7 +104,7 @@ class account_report(osv.osv):
|
||||
context['period_id']=context['period_id'][0]
|
||||
acc = self.pool.get('account.tax.code')
|
||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||
return reduce(lambda y,x=0: x.sum_period+y, acc.browse(cr, uid, acc_id, context),0)
|
||||
return reduce(lambda y,x=0: x.sum_period+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
result = {}
|
||||
for rep in self.browse(cr, uid, ids, context):
|
||||
objdict = {
|
||||
|
||||
@@ -5,5 +5,12 @@
|
||||
|
||||
<report auto="False" id="report_print_indicators" model="account.report.history" name="print.indicators" rml="account_report/report/print_indicator.rml" string="Indicators"/>
|
||||
|
||||
<report
|
||||
auto="False"
|
||||
id="report_indicator_pdf"
|
||||
menu="False"
|
||||
model="account.report.report"
|
||||
name="print.indicator.pdf"
|
||||
string="Print Indicators in PDF"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -3,5 +3,8 @@
|
||||
<data>
|
||||
<wizard id="wizard_print_indicators" name="print.indicators" string="Print Indicators"/>
|
||||
<menuitem action="wizard_print_indicators" type="wizard" parent="account_report.menu_action_account_report_tree_view" id="menu_wizard_print_indicators"/>
|
||||
|
||||
<wizard id="wizard_indicators_with_pdf" model="account.report.report" name="print.indicators.pdf" string="Indicators in PDF" keyword="client_action_multi" />
|
||||
<!--<menuitem action="wizard_indicators_with_pdf" type="wizard" parent="account_report.menu_action_account_report_tree_view" id="menu_wizard_print_indicators_with_pdf"/>-->
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_report
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:23+0000\n"
|
||||
"PO-Revision-Date: 2008-10-10 08:15+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -96,6 +96,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||
self.treecount=0
|
||||
self.list=[]
|
||||
self.header_name=self.header_val=[]
|
||||
self.main_dict={}
|
||||
|
||||
def repeatIn(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[]):
|
||||
self._node.data = ''
|
||||
@@ -202,39 +203,62 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||
|
||||
theme.default_font_size = 12
|
||||
|
||||
tb = text_box.T(loc=(0,700),line_style=line_style.darkblue,text=str(obj_history.code))
|
||||
|
||||
base_x=100
|
||||
base_y=700
|
||||
|
||||
if obj_history.child_ids:
|
||||
tb.add_arrow((100, 700))
|
||||
can.line(line_style.black,base_x-30,base_y,base_x-30,base_y-(50*(len(obj_history.child_ids)-1)))
|
||||
tb.draw()
|
||||
self.child_dist=0
|
||||
def draw_tree(obj_his,base_x,base_y,level=0):
|
||||
self.child_dist=0
|
||||
for i in range(len(obj_his.child_ids)):
|
||||
can.line(line_style.black,base_x-30,base_y,base_x-30,base_y-(50*(i+len(obj_his.child_ids[i].child_ids))))
|
||||
if i<>0:
|
||||
a = arrow.T(head_style = 1)
|
||||
if self.child_dist:
|
||||
diff=self.child_dist
|
||||
else:
|
||||
diff=self.child_dist+i
|
||||
a.draw([(base_x-(30),base_y-(50*diff)), (base_x,base_y-(50*diff))])
|
||||
|
||||
if obj_his.child_ids[i].child_ids:
|
||||
tb12 = text_box.T(loc=(base_x,base_y-(50*(self.child_dist))), text=str(obj_his.child_ids[i].code))
|
||||
tb12.add_arrow((base_x+(100*(level+1)),base_y-(50*(self.child_dist))))
|
||||
tb12.draw()
|
||||
draw_tree(obj_his.child_ids[i],base_x+(100*(level+1)),base_y-(50*(self.child_dist)),level+1)
|
||||
level=0
|
||||
self.level=0
|
||||
self.child_dist=0
|
||||
|
||||
def draw_tree(obj_history,base_x,base_y,level=0,i=0):
|
||||
self.line_y=base_y
|
||||
if obj_history.child_ids:
|
||||
if self.child_dist:
|
||||
diff=i*self.child_dist
|
||||
self.child_dist=0
|
||||
else:
|
||||
tb12 = text_box.T(loc=(base_x,base_y-(50*(i+self.child_dist))), text=str(obj_his.child_ids[i].code))
|
||||
tb12.draw()
|
||||
self.child_dist=len(obj_his.child_ids[i].child_ids)
|
||||
#
|
||||
draw_tree(obj_history,base_x,base_y,0)
|
||||
diff=i
|
||||
if self.level>0 and (base_y-(50*diff)) >= self.level:
|
||||
base_y=self.level-(50*i)
|
||||
else:
|
||||
base_y=base_y-(50*diff)
|
||||
tb = text_box.T(loc=(base_x,base_y),line_style=line_style.darkblue,text="/hC"+str(obj_history.code)+":\n"+str(obj_history.amount))
|
||||
|
||||
tb.add_arrow((base_x+100,base_y))
|
||||
tb.draw()
|
||||
|
||||
if level!=0:
|
||||
a = arrow.T(head_style = 1)
|
||||
a.draw([(base_x-30,base_y), (base_x,base_y)])
|
||||
level+=1
|
||||
|
||||
if i>0:
|
||||
can.line(line_style.black,base_x-30,base_y,base_x-30,self.line_y)
|
||||
|
||||
i=0
|
||||
for child in obj_history.child_ids:
|
||||
draw_tree(child,base_x+(100),base_y,level,i)
|
||||
i+=1
|
||||
|
||||
child_dist=len(obj_history.child_ids)
|
||||
self.child_dist=max(self.child_dist,child_dist)
|
||||
|
||||
else:
|
||||
|
||||
if self.level>0 and (base_y-(50*i)) >= self.level:
|
||||
base_y=self.level-(50)
|
||||
else:
|
||||
base_y=base_y-(50*(i))
|
||||
|
||||
tb12 = text_box.T(loc=(base_x,base_y), text="/hC"+str(obj_history.code)+":\n"+str(obj_history.amount))
|
||||
tb12.draw()
|
||||
|
||||
if i>0:
|
||||
can.line(line_style.black,base_x-30,base_y,base_x-30,self.line_y)
|
||||
a = arrow.T(head_style = 1)
|
||||
a.draw([(base_x-30,base_y), (base_x,base_y)])
|
||||
self.level=base_y
|
||||
self.line_y=900
|
||||
draw_tree(obj_history,0,900,0)
|
||||
can.close()
|
||||
|
||||
os.system('cp '+'tree_image'+str(self.treecount)+'.png ' +path+str(self.treecount)+'.png')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -21,5 +21,6 @@
|
||||
##############################################################################
|
||||
|
||||
import wizard_print_indicators
|
||||
import wizard_print_indicators_with_pdf
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import time
|
||||
import datetime
|
||||
import sys
|
||||
from mx.DateTime import *
|
||||
import tools
|
||||
from report.render import render
|
||||
from report.interface import report_int
|
||||
import os
|
||||
import base64
|
||||
import StringIO
|
||||
|
||||
form = '''<?xml version="1.0"?>
|
||||
<form string="Print Indicators with PDF">
|
||||
<label string="Select the PDF file on which Indicators will be printed."/>
|
||||
<newline/>
|
||||
<field name="file" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
fields = {
|
||||
'file': {'string':'Select a PDF File', 'type':'binary','required':True,'filters':['*.pdf']},
|
||||
}
|
||||
|
||||
|
||||
class external_pdf(render):
|
||||
def __init__(self, pdf):
|
||||
render.__init__(self)
|
||||
self.pdf = pdf
|
||||
self.output_type='pdf'
|
||||
def _render(self):
|
||||
return self.pdf
|
||||
|
||||
|
||||
class report_custom(report_int):
|
||||
def create(self, cr, uid, ids, data, context={}):
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
obj_indicator = pool.get('account.report.report')
|
||||
code_ids = obj_indicator.browse(cr,uid,data['id'])
|
||||
|
||||
self.list={}
|
||||
|
||||
def find_child(obj):
|
||||
self.list[obj.code]=str(obj.amount)
|
||||
if obj.child_ids:
|
||||
for child in obj.child_ids:
|
||||
find_child(child)
|
||||
return True
|
||||
|
||||
find_child(code_ids)
|
||||
|
||||
file_contents=base64.decodestring(data['form']['file'])
|
||||
fp = StringIO.StringIO(file_contents)
|
||||
|
||||
infile = open(tools.config['addons_path']+"/test.pdf", 'wb')
|
||||
infile.write(fp.read())
|
||||
infile.close()
|
||||
|
||||
obj_user=pool.get('res.users').browse(cr,uid,uid)
|
||||
self.list['printing_user']=obj_user.name
|
||||
self.list['company_name']=obj_user.company_id.name
|
||||
self.list['company_vat']=obj_user.company_id.partner_id.vat
|
||||
self.list['printing_time']=time.strftime('%H:%M:%S')
|
||||
self.list['printing_date']=time.strftime('%D')
|
||||
|
||||
tools.pdf_utils.fill_pdf(tools.config['addons_path']+"/test.pdf",'/tmp/output.pdf',self.list)
|
||||
self.obj = external_pdf(file('/tmp/output.pdf').read())
|
||||
self.obj.render()
|
||||
return (self.obj.pdf, 'pdf')
|
||||
|
||||
report_custom('report.print.indicator.pdf')
|
||||
|
||||
class wizard_print_indicators_with_pdf(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel'),('print','Print')]}
|
||||
},
|
||||
'print': {
|
||||
'actions':[],
|
||||
'result' :{'type':'print','report':'print.indicator.pdf', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_print_indicators_with_pdf('print.indicators.pdf')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * account_reporting
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:32+0000\n"
|
||||
"PO-Revision-Date: 2008-10-09 14:29+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:27+0000\n"
|
||||
"PO-Revision-Date: 2008-10-09 20:00+0000\n"
|
||||
"Last-Translator: Fabien Pinckaers <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-10-28 11:52:53+0000\n"
|
||||
"PO-Revision-Date: 2008-10-28 11:52:53+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
{
|
||||
"name" : "Auction module",
|
||||
"version" : "1.0",
|
||||
"category" : "Generic Modules/Others",
|
||||
"depends" : ["base","account","l10n_be","hr_attendance"],
|
||||
"category" : "Generic Modules/Auction",
|
||||
"depends" : ["base","account","hr_attendance"],
|
||||
"update_xml" : [
|
||||
# FIXME: review security rules...
|
||||
"security/ir.model.access.csv",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="type">view</field>
|
||||
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||
<field name="parent_id" type="list">
|
||||
<value search="[('type','=','view'),('code','=','7')]" model="account.account"/>
|
||||
<value search="[('type','=','view')]" model="account.account"/>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<field name="type">view</field>
|
||||
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||
<field name="parent_id" type="list">
|
||||
<value search="[('type','=','view'),('code','=','6')]" model="account.account"/>
|
||||
<value search="[('type','=','view')]" model="account.account"/>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:25+0000\n"
|
||||
"PO-Revision-Date: 2008-10-14 15:04+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,406 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import psycopg
|
||||
import csv
|
||||
|
||||
db_old = "in"
|
||||
print 'Extracting data from db '+db_old
|
||||
|
||||
def import_sql(cr, fname, query, fields=None, trigger=None):
|
||||
cr.execute(query)
|
||||
if not fields:
|
||||
fields = map(lambda x: x[0], cr.description)
|
||||
fp = file(fname,'wb')
|
||||
result = cr.fetchall()
|
||||
if trigger:
|
||||
result = map(lambda x: tuple(trigger(cr, list(x))), result)
|
||||
writer = csv.writer(fp,lineterminator='\n')
|
||||
writer.writerow(fields)
|
||||
writer.writerows(result)
|
||||
fp.close()
|
||||
|
||||
|
||||
db = psycopg.connect("dbname="+db_old)
|
||||
cr = db.cursor()
|
||||
|
||||
|
||||
|
||||
cr.execute("update auction_lots set state='draft' where state is null or state = '' ")
|
||||
cr.execute("update auction_lots set state='sold' where state='invoiced'")
|
||||
|
||||
|
||||
cr.execute('select id,name from res_partner')
|
||||
res= cr.fetchall()
|
||||
names=[]
|
||||
for r in res:
|
||||
if r[1] in names:
|
||||
cr.execute("update res_partner set name= %s where id=%d",(r[1]+str(r[0]),r[0]))
|
||||
else:
|
||||
names.append(r[1])
|
||||
|
||||
# cr.execute('select id,name from res_country')
|
||||
# res= cr.fetchall()
|
||||
# names=[]
|
||||
# for r in res:
|
||||
# if r[1] in names:
|
||||
# cr.execute("update res_country set name= %s where id=%d",(str(r[1])+str(r[0]),r[0]))
|
||||
# else:
|
||||
# names.append(r[1])
|
||||
|
||||
# cr.execute('select id,code from res_country')
|
||||
# res= cr.fetchall()
|
||||
# names=[]
|
||||
# for r in res:
|
||||
# if r[1] in names:
|
||||
# cr.execute("update res_country set code= %s where id=%d",(str(r[1])+str(r[0]),r[0]))
|
||||
# else:
|
||||
# names.append(r[1])
|
||||
|
||||
|
||||
|
||||
def _account_trigger(cr, x):
|
||||
x = list(x)
|
||||
if x[5] not in ('receivable','payable','view','income','expense','tax','cash','asset','equity','closed'):
|
||||
x[5] = {'stock_inventory':'asset','stock_income':'income','stock_expense':'expense'}.get(x[5], 'asset')
|
||||
return tuple(x)
|
||||
# account.account
|
||||
import_sql(cr,
|
||||
'account.account.csv',
|
||||
"select 'account' || id as id, code, name, 'EUR' as currency_id, True as active, type from account_account",
|
||||
trigger = _account_trigger
|
||||
)
|
||||
|
||||
#account.tax
|
||||
import_sql(cr,
|
||||
'account.tax.csv',
|
||||
"""select
|
||||
'tax' || id as id,
|
||||
domain,
|
||||
name,
|
||||
'account'||account_collected_id as "account_collected_id:id",
|
||||
'account'||account_paid_id as "account_paid_id:id",
|
||||
amount,
|
||||
child_depend,
|
||||
type
|
||||
from
|
||||
account_tax
|
||||
"""
|
||||
)
|
||||
|
||||
#res.country
|
||||
# import_sql(cr,
|
||||
# 'res.country.csv',
|
||||
# """
|
||||
# select
|
||||
# 'country'||id as id,
|
||||
# coalesce(name,id::char(10)) as "name",
|
||||
# coalesce(code,id::char(10)) as "code"
|
||||
# from
|
||||
# res_country
|
||||
# """
|
||||
# )
|
||||
#clients category
|
||||
import_sql(cr,
|
||||
'res.partner.category.csv',
|
||||
"""
|
||||
select
|
||||
name,
|
||||
active
|
||||
from
|
||||
res_partner_category
|
||||
"""
|
||||
)
|
||||
##res.partner.category.rel
|
||||
#import_sql(cr,
|
||||
# 'res.partner.category.rel.csv',
|
||||
# """
|
||||
# select
|
||||
# 'partner'||rel.partner_id as "partner_id:id",
|
||||
# 'categ'||rel.category_id as "category_id:id"
|
||||
# from
|
||||
# res_partner_category_rel rel, res_partner r
|
||||
# where rel.partner_id=r.id
|
||||
# """
|
||||
#)
|
||||
#res.partner
|
||||
import_sql(cr,
|
||||
'res.partner.csv',
|
||||
"""
|
||||
select
|
||||
'partner'||r.id as id,
|
||||
r.lang,
|
||||
r.website,
|
||||
r.name,
|
||||
r.comment,
|
||||
|
||||
r.active
|
||||
from
|
||||
res_partner r
|
||||
"""
|
||||
)
|
||||
|
||||
# (select cat.name||'\N' from res_partner r1, res_partner_category cat,res_partner_category_rel rel where r1.id=rel.partner_id and rel.category_id=cat.id) as "category_id",
|
||||
# title,
|
||||
|
||||
#res.partner.address
|
||||
import_sql(cr,
|
||||
'res.partner.address.csv',
|
||||
"""
|
||||
select
|
||||
'address'||id as id,
|
||||
coalesce('partner'||partner_id,'partner_unknown') as "partner_id:id",
|
||||
name,
|
||||
street,
|
||||
zip,
|
||||
city,
|
||||
email,
|
||||
phone,
|
||||
type,
|
||||
mobile,
|
||||
fax
|
||||
from
|
||||
res_partner_address
|
||||
"""
|
||||
)
|
||||
# 'country'||country as "country_id:id",
|
||||
|
||||
|
||||
#auction.lot.category
|
||||
|
||||
import_sql(cr,
|
||||
'auction.lot.category.csv',
|
||||
"""
|
||||
select
|
||||
'cat'||id as "id",
|
||||
name,
|
||||
active
|
||||
from
|
||||
auction_lot_category
|
||||
order by
|
||||
id
|
||||
"""
|
||||
)
|
||||
#auction.dates.csv
|
||||
|
||||
import_sql(cr,
|
||||
'auction.dates.csv',
|
||||
"""
|
||||
select
|
||||
|
||||
'date'||id as "id",
|
||||
'Auction'||id as "name",
|
||||
expo1,
|
||||
expo2,
|
||||
'auction_db.account'||acc_expense as "acc_expense:id",
|
||||
'auction_db.account'||acc_income as "acc_income:id",
|
||||
coalesce(state,'draft') as "state",
|
||||
auction1,
|
||||
auction2,
|
||||
'account.expenses_journal' as "journal_seller_id:id",
|
||||
'account.sales_journal' as "journal_id:id",
|
||||
'auction_db.aaa_un' as "account_analytic_id:id"
|
||||
|
||||
from
|
||||
auction_dates
|
||||
order by
|
||||
id
|
||||
"""
|
||||
)
|
||||
|
||||
# auction.artist.csv
|
||||
|
||||
import_sql(cr,
|
||||
'auction.artists.csv',
|
||||
"""
|
||||
select
|
||||
'artist'||id as "id",
|
||||
name,
|
||||
biography,
|
||||
birth_death_dates
|
||||
|
||||
from
|
||||
auction_artists
|
||||
order by
|
||||
id
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# auction.deposit.csv
|
||||
|
||||
import_sql(cr,
|
||||
'auction.deposit.csv',
|
||||
"""
|
||||
select
|
||||
'deposit'||id as "id",
|
||||
name,
|
||||
date_dep,
|
||||
coalesce('auction_db.partner'||partner_id,'auction_db.partner_unknown') as "partner_id:id",
|
||||
method,
|
||||
'auction_db.tax'||tax_id as "tax_id:id",
|
||||
total_neg
|
||||
|
||||
from
|
||||
auction_deposit
|
||||
order by
|
||||
id
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
#lot
|
||||
import_sql(cr,
|
||||
'auction.lots.csv',
|
||||
"""
|
||||
select
|
||||
'lot'||l.id as id,
|
||||
'auction_db2.date'||l.auction_id as "auction_id:id",
|
||||
'auction_db2.deposit'||l.bord_vnd_id as "bord_vnd_id:id",
|
||||
l.name,
|
||||
l.name2,
|
||||
l.author_right,
|
||||
l.lot_est1,
|
||||
l.lot_est1,
|
||||
l.lot_local,
|
||||
l.artist_id,
|
||||
l.artist2_id,
|
||||
l.important,
|
||||
l.obj_desc,
|
||||
l.obj_num,
|
||||
l.obj_ret,
|
||||
l.obj_comm,
|
||||
l.obj_price,
|
||||
l.ach_avance,
|
||||
l.ach_login,
|
||||
'auction_db.partner'||l.ach_uid as "ach_uid:id",
|
||||
l.ach_emp,
|
||||
l.vnd_lim,
|
||||
l.vnd_lim_net,
|
||||
coalesce(l.state,'draft') as "state",
|
||||
'auction_db.product_product_unknown' as "product_id:id"
|
||||
from
|
||||
auction_lots l join auction_dates d on (l.auction_id=d.id) join auction_deposit o on (l.bord_vnd_id=o.id) where d.expo2 like '2007%'
|
||||
order by
|
||||
l.id
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# 'auction_db.invoice'||ach_inv_id as "ach_inv_id:id",
|
||||
# 'auction_db.invoice'||ach_inv_id as "sel_inv_id:id",
|
||||
|
||||
def _deposit(cr, rec):
|
||||
if not rec[3]:
|
||||
rec[3] = '6025'
|
||||
return rec
|
||||
|
||||
|
||||
|
||||
|
||||
# 'invoice'||invoice_id as "invoice_id:id",
|
||||
import_sql(cr,
|
||||
'account.invoice.csv',
|
||||
"""
|
||||
select
|
||||
'invoice'||id as "id",
|
||||
comment,
|
||||
date_due,
|
||||
number,
|
||||
'base.main_company' as "company_id:id",
|
||||
'auction_db.address'||address_invoice_id as "address_invoice_id:id",
|
||||
'auction_db.partner'||partner_id as "partner_id:id",
|
||||
state,
|
||||
type,
|
||||
'auction_db.account'||account_id as "account_id:id",
|
||||
date_invoice,
|
||||
name,
|
||||
'auction_db.address'||address_contact_id as "address_contact_id:id"
|
||||
from
|
||||
account_invoice
|
||||
order by
|
||||
id
|
||||
"""
|
||||
)
|
||||
|
||||
import_sql(cr,
|
||||
'account.invoice.line.csv',
|
||||
"""
|
||||
select
|
||||
name,
|
||||
'invoice'||invoice_id as "invoice_id:id",
|
||||
price_unit,
|
||||
'auction_db.account'||account_id as "account_id:id",
|
||||
quantity
|
||||
from
|
||||
account_invoice_line
|
||||
order by
|
||||
id
|
||||
"""
|
||||
)
|
||||
|
||||
#auction.bid.csv
|
||||
|
||||
import_sql(cr,
|
||||
'auction.bid.csv',
|
||||
"""
|
||||
select
|
||||
'bid'||b.id as "id",
|
||||
'date'||b.auction_id as "auction_id:id",
|
||||
coalesce('auction_db.partner'||b.partner_id,'auction_db.partner_unknown') as "partner_id:id",
|
||||
b.name,
|
||||
b.contact_tel
|
||||
from
|
||||
auction_bid b join auction_dates d on (b.auction_id=d.id) where d.expo2 like '2007%'
|
||||
order by
|
||||
b.id
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
#auction.bid_line.csv
|
||||
import_sql(cr,
|
||||
'auction.bid_line.csv',
|
||||
"""
|
||||
select
|
||||
line.name,
|
||||
'auction_db2.bid'||line.bid_id as "bid_id:id",
|
||||
'auction_db3.lot'||line.lot_id as "lot_id:id",
|
||||
line.price,
|
||||
line.call
|
||||
|
||||
from
|
||||
auction_bid_line line join auction_bid b on (b.id=line.bid_id) join auction_lots lot on (lot.id=line.lot_id) join auction_deposit o on (lot.bord_vnd_id=o.id) join auction_dates d on (lot.auction_id=d.id) where d.expo2 like '2007%' and o.date_dep like '2007%'
|
||||
order by
|
||||
line.id
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cr.close()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import psycopg
|
||||
import csv
|
||||
|
||||
db_old = "in"
|
||||
print 'Extracting data from db '+db_old
|
||||
#
|
||||
#def import_sql(cr, fname, query, fields=None, trigger=None):
|
||||
# cr.execute(query)
|
||||
# fp = file(fname,'wb')
|
||||
# result = cr.fetchall()
|
||||
# if trigger:
|
||||
# result = map(lambda x: tuple(trigger(cr, list(x))), result)
|
||||
# writer = csv.writer(fp,lineterminator='\n')
|
||||
# writer.writerow(["id","lang","website","name","comment","active","category_id"])
|
||||
# for line in result:
|
||||
# cr.execute("SELECT c.name from res_partner_category_rel r join res_partner p on (p.id=r.partner_id) join res_partner_category c on (r.category_id=c.id) where p.name=%s",(line[3],))
|
||||
# cats= ",".join([l[0] for l in cr.fetchall()])
|
||||
# print "cats",cats
|
||||
# line=line + (cats,)
|
||||
# writer.writerow(line)
|
||||
# fp.close()
|
||||
#
|
||||
#db = psycopg.connect("dbname="+db_old)
|
||||
#cr = db.cursor()
|
||||
def import_sql(cr, fname, query, fields=None, trigger=None):
|
||||
cr.execute(query)
|
||||
fp = file(fname,'wb')
|
||||
result = cr.fetchall()
|
||||
if trigger:
|
||||
result = map(lambda x: tuple(trigger(cr, list(x))), result)
|
||||
writer = csv.writer(fp,lineterminator='\n')
|
||||
writer.writerow(["id","lang","website","name","comment","active","category_id"])
|
||||
for line in result:
|
||||
cr.execute("SELECT c.name from res_partner_category_rel r join res_partner p on (p.id=r.partner_id) join res_partner_category c on (r.category_id=c.id) where p.name=%s",(line[3],))
|
||||
l = ''
|
||||
for x in cr.fetchall():
|
||||
if not l:
|
||||
l = x[0]
|
||||
else:
|
||||
l += ',' + x[0]
|
||||
writer.writerow(line + (l,))
|
||||
|
||||
|
||||
# print l
|
||||
# head,tail= l[:1], l[1:]
|
||||
# if not head: head= [None]
|
||||
# writer.writerow(line+tuple(head))
|
||||
# for t in tail:
|
||||
# writer.writerow((None,None,None,None,None,None)+(t,))
|
||||
|
||||
|
||||
# for l in cr.fetchall():
|
||||
# a=0
|
||||
# lenght=len(l)
|
||||
# line=line + (l[a],)
|
||||
# print "l[0]",a,l[a]
|
||||
# print line
|
||||
# writer.writerow(line)
|
||||
# a=a+1
|
||||
# while a< lenght:
|
||||
# line2=(None,None,None,None,None,None,) +(l[a],)
|
||||
# writer.writerow(line2)
|
||||
# a=a+1
|
||||
fp.close()
|
||||
|
||||
# if l[0] != cats:
|
||||
# line2=",,,,,"+(l[0][1:],)
|
||||
# print "line2",line2
|
||||
db = psycopg.connect("dbname="+db_old)
|
||||
cr = db.cursor()
|
||||
|
||||
cr.execute("update auction_lots set state='draft' where state is null or state = '' ")
|
||||
cr.execute("update auction_lots set state='sold' where state='invoiced'")
|
||||
|
||||
|
||||
cr.execute('select id,name from res_partner')
|
||||
res= cr.fetchall()
|
||||
names=[]
|
||||
for r in res:
|
||||
if r[1] in names:
|
||||
cr.execute("update res_partner set name= %s where id=%d",(r[1]+str(r[0]),r[0]))
|
||||
else:
|
||||
names.append(r[1])
|
||||
|
||||
|
||||
##clients category
|
||||
#import_sql(cr,
|
||||
# 'res.partner.category.csv',
|
||||
# """
|
||||
# select
|
||||
# name,
|
||||
# active
|
||||
# from
|
||||
# res_partner_category
|
||||
# """
|
||||
#)
|
||||
|
||||
#res.partner
|
||||
import_sql(cr,
|
||||
'res.partner.csv',
|
||||
"""
|
||||
select
|
||||
'partner'||r.id as id,
|
||||
r.lang,
|
||||
r.website,
|
||||
r.name,
|
||||
r.comment,
|
||||
r.active
|
||||
from
|
||||
res_partner r --limit 10
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# (select cat.name||'\N' from res_partner r1, res_partner_category cat,res_partner_category_rel rel where r1.id=rel.partner_id and rel.category_id=cat.id) as "category_id",
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * base_contact
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:33+0000\n"
|
||||
"PO-Revision-Date: 2008-10-08 14:13+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * base_iban
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-10 15:05:34+0000\n"
|
||||
"PO-Revision-Date: 2008-09-10 15:05:34+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * base_module_publish
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-10 15:05:35+0000\n"
|
||||
"PO-Revision-Date: 2008-09-10 15:05:35+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -41,7 +41,8 @@ def fnct_call(fnct):
|
||||
if args[4] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc'):
|
||||
if _old_args is not None:
|
||||
args[5].update(_old_args)
|
||||
mod.recording_data.append(('query', args, argv,res))
|
||||
if args[5]:
|
||||
mod.recording_data.append(('query', args, argv,res))
|
||||
return res
|
||||
return execute
|
||||
|
||||
@@ -55,7 +56,6 @@ def fnct_call_workflow(fnct):
|
||||
return res
|
||||
return exec_workflow
|
||||
|
||||
|
||||
class base_module_record(osv.osv):
|
||||
_name = "ir.module.record"
|
||||
_columns = {
|
||||
@@ -93,6 +93,8 @@ class base_module_record(osv.osv):
|
||||
return val
|
||||
|
||||
def _get_id(self, cr, uid, model, id):
|
||||
if type(id)==type(()):
|
||||
id=id[0]
|
||||
if (model,id) in self.ids:
|
||||
return self.ids[(model,id)], False
|
||||
dt = self.pool.get('ir.model.data')
|
||||
@@ -107,11 +109,11 @@ class base_module_record(osv.osv):
|
||||
record = doc.createElement('record')
|
||||
record.setAttribute("id", record_id)
|
||||
record.setAttribute("model", model)
|
||||
record_list = [record]
|
||||
lids = self.pool.get('ir.model.data').search(cr, uid, [('model','=',model)])
|
||||
res = self.pool.get('ir.model.data').read(cr, uid, lids[:1], ['module'])
|
||||
if res:
|
||||
self.depends[res[0]['module']]=True
|
||||
record_list = [record]
|
||||
fields = self.pool.get(model).fields_get(cr, uid)
|
||||
for key,val in data.items():
|
||||
if not (val or (fields[key]['type']=='boolean')):
|
||||
@@ -145,7 +147,7 @@ class base_module_record(osv.osv):
|
||||
record.appendChild(field)
|
||||
elif fields[key]['type'] in ('one2many',):
|
||||
for valitem in (val or []):
|
||||
if valitem[0]==0:
|
||||
if valitem[0] in (0,1):
|
||||
if key in self.pool.get(model)._columns:
|
||||
fname = self.pool.get(model)._columns[key]._fields_id
|
||||
else:
|
||||
@@ -181,11 +183,55 @@ class base_module_record(osv.osv):
|
||||
val = val and ('"""%s"""' % val.replace('\\', '\\\\').replace('"', '\"')) or 'False'
|
||||
if isinstance(val, basestring):
|
||||
val = val.decode('utf8')
|
||||
|
||||
field.setAttribute(u"eval", val)
|
||||
record.appendChild(field)
|
||||
return record_list, noupdate
|
||||
|
||||
def get_copy_data(self, cr, uid,model,id,result):
|
||||
res = []
|
||||
obj=self.pool.get(model)
|
||||
data=obj.read(cr, uid,[id])
|
||||
if type(data)==type([]):
|
||||
del data[0]['id']
|
||||
data=data[0]
|
||||
else:
|
||||
del data['id']
|
||||
|
||||
mod_fields = obj.fields_get(cr, uid)
|
||||
for f in filter(lambda a: isinstance(obj._columns[a], fields.function)\
|
||||
and (not obj._columns[a].store),obj._columns):
|
||||
del data[f]
|
||||
|
||||
for key,val in data.items():
|
||||
if result.has_key(key):
|
||||
continue
|
||||
if mod_fields[key]['type'] == 'many2one':
|
||||
if type(data[key])==type(True) or type(data[key])==type(1):
|
||||
result[key]=data[key]
|
||||
else:
|
||||
result[key]=data[key][0]
|
||||
|
||||
elif mod_fields[key]['type'] in ('one2many',):
|
||||
rel = mod_fields[key]['relation']
|
||||
if len(data[key]):
|
||||
res1=[]
|
||||
for rel_id in data[key]:
|
||||
res=[0,0]
|
||||
res.append(self.get_copy_data(cr, uid,rel,rel_id,{}))
|
||||
res1.append(res)
|
||||
result[key]=res1
|
||||
else:
|
||||
result[key]=data[key]
|
||||
|
||||
elif mod_fields[key]['type'] == 'many2many':
|
||||
result[key]=[(6,0,data[key])]
|
||||
|
||||
else:
|
||||
result[key]=data[key]
|
||||
for k,v in obj._inherits.items():
|
||||
del result[v]
|
||||
return result
|
||||
|
||||
def _generate_object_xml(self, cr, uid, rec, recv, doc, result=None):
|
||||
record_list = []
|
||||
noupdate = False
|
||||
@@ -198,48 +244,62 @@ class base_module_record(osv.osv):
|
||||
record,update = self._create_record(cr, uid, doc, rec[3], rec[6], id)
|
||||
noupdate = noupdate or update
|
||||
record_list += record
|
||||
|
||||
elif rec[4]=='create':
|
||||
id = self._create_id(cr, uid, rec[3],rec[5])
|
||||
record,noupdate = self._create_record(cr, uid, doc, rec[3], rec[5], id)
|
||||
self.ids[(rec[3],result)] = id
|
||||
record_list += record
|
||||
|
||||
elif rec[4]=='copy':
|
||||
data=self.get_copy_data(cr,uid,rec[3],rec[5],rec[6])
|
||||
copy_rec=(rec[0],rec[1],rec[2],rec[3],rec[4],rec[5],data,rec[7])
|
||||
rec=copy_rec
|
||||
rec_data=[(self.recording_data[0][0],rec,self.recording_data[0][2],self.recording_data[0][3])]
|
||||
self.recording_data=rec_data
|
||||
id = self._create_id(cr, uid, rec[3],rec[6])
|
||||
record,noupdate = self._create_record(cr, uid, doc, rec[3], rec[6], id)
|
||||
self.ids[(rec[3],result)] = id
|
||||
record_list += record
|
||||
|
||||
return record_list,noupdate
|
||||
|
||||
def _generate_assert_xml(self, rec, doc):
|
||||
pass
|
||||
def generate_xml(self, cr, uid):
|
||||
# Create the minidom document
|
||||
self.ids = {}
|
||||
doc = minidom.Document()
|
||||
terp = doc.createElement("openerp")
|
||||
doc.appendChild(terp)
|
||||
for rec in self.recording_data:
|
||||
if rec[0]=='workflow':
|
||||
rec_id,noupdate = self._get_id(cr, uid, rec[1][3], rec[1][5])
|
||||
if not rec_id:
|
||||
continue
|
||||
data = doc.createElement("data")
|
||||
terp.appendChild(data)
|
||||
wkf = doc.createElement('workflow')
|
||||
data.appendChild(wkf)
|
||||
wkf.setAttribute("model", rec[1][3])
|
||||
wkf.setAttribute("action", rec[1][4])
|
||||
if noupdate:
|
||||
data.setAttribute("noupdate", "1")
|
||||
wkf.setAttribute("ref", rec_id)
|
||||
if rec[0]=='query':
|
||||
res_list,noupdate = self._generate_object_xml(cr, uid, rec[1], rec[2], doc, rec[3])
|
||||
data = doc.createElement("data")
|
||||
if noupdate:
|
||||
data.setAttribute("noupdate", "1")
|
||||
if res_list:
|
||||
if len(self.recording_data):
|
||||
self.ids = {}
|
||||
doc = minidom.Document()
|
||||
terp = doc.createElement("openerp")
|
||||
doc.appendChild(terp)
|
||||
for rec in self.recording_data:
|
||||
if rec[0]=='workflow':
|
||||
rec_id,noupdate = self._get_id(cr, uid, rec[1][3], rec[1][5])
|
||||
if not rec_id:
|
||||
continue
|
||||
data = doc.createElement("data")
|
||||
terp.appendChild(data)
|
||||
for res in res_list:
|
||||
data.appendChild(res)
|
||||
elif rec[0]=='assert':
|
||||
pass
|
||||
res = doc.toprettyxml(indent="\t")
|
||||
return doc.toprettyxml(indent="\t").encode('utf8')
|
||||
wkf = doc.createElement('workflow')
|
||||
data.appendChild(wkf)
|
||||
wkf.setAttribute("model", rec[1][3])
|
||||
wkf.setAttribute("action", rec[1][4])
|
||||
if noupdate:
|
||||
data.setAttribute("noupdate", "1")
|
||||
wkf.setAttribute("ref", rec_id)
|
||||
if rec[0]=='query':
|
||||
res_list,noupdate = self._generate_object_xml(cr, uid, rec[1], rec[2], doc, rec[3])
|
||||
data = doc.createElement("data")
|
||||
if noupdate:
|
||||
data.setAttribute("noupdate", "1")
|
||||
if res_list:
|
||||
terp.appendChild(data)
|
||||
for res in res_list:
|
||||
data.appendChild(res)
|
||||
elif rec[0]=='assert':
|
||||
pass
|
||||
res = doc.toprettyxml(indent="\t")
|
||||
return doc.toprettyxml(indent="\t").encode('utf8')
|
||||
base_module_record()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -41,5 +41,18 @@
|
||||
action="wizard_base_module_save"
|
||||
id="menu_wizard_base_module_save"/>
|
||||
|
||||
<wizard
|
||||
id="wizard_base_module_record_objects"
|
||||
string="Record Objects"
|
||||
model="ir.module.module"
|
||||
multi="True"
|
||||
name="base_module_record.module_record_objects"/>
|
||||
<menuitem
|
||||
parent="menu_wizard_base_mod_rec"
|
||||
name="Record Objects of your choice"
|
||||
type="wizard"
|
||||
action="wizard_base_module_record_objects"
|
||||
id="menu_wizard_base_module_record_objects"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:34+0000\n"
|
||||
"PO-Revision-Date: 2008-10-14 13:08+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -22,5 +22,6 @@
|
||||
|
||||
import base_module_record
|
||||
import base_module_save
|
||||
import base_module_record_objects
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import osv
|
||||
import pooler
|
||||
import time
|
||||
import base_module_save
|
||||
info = '''<?xml version="1.0"?>
|
||||
<form string="Module Recording">
|
||||
<label string="Thanks For using Module Recorder" colspan="4" align="0.0"/>
|
||||
</form>'''
|
||||
|
||||
intro_start_form = '''<?xml version="1.0"?>
|
||||
<form string="Objects Recording">
|
||||
<field name="check_date"/>
|
||||
<newline/>
|
||||
<field name="filter_cond"/>
|
||||
<separator string="Choose objects to record" colspan="4"/>
|
||||
<field name="objects" colspan="4" nolabel="1"/>
|
||||
|
||||
</form>'''
|
||||
|
||||
intro_start_fields = {
|
||||
'check_date': {'string':"Record from Date",'type':'datetime','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S')},
|
||||
'objects':{'string': 'Objects', 'type': 'many2many', 'relation': 'ir.model', 'help': 'List of objects to be recorded'},
|
||||
'filter_cond':{'string':'Records only', 'type':'selection','selection':[('created','Created'),('modified','Modified'),('created_modified','Created & Modified')], 'required':True, 'default': lambda *args:'created'},
|
||||
|
||||
}
|
||||
|
||||
def _info_default(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
mod = pool.get('ir.model')
|
||||
list=('ir.ui.view','ir.ui.menu','ir.model','ir.model.fields','ir.model.access',\
|
||||
'res.partner','res.partner.address','res.partner.category','workflow',\
|
||||
'workflow.activity','workflow.transition','ir.actions.server','ir.server.object.lines')
|
||||
data['form']['objects']=mod.search(cr,uid,[('model','in',list)])
|
||||
cr.execute('select max(create_date) from ir_model_data')
|
||||
c=(cr.fetchone())[0].split('.')[0]
|
||||
c = time.strptime(c,"%Y-%m-%d %H:%M:%S")
|
||||
sec=c.tm_sec + 1
|
||||
c=(c[0],c[1],c[2],c[3],c[4],sec,c[6],c[7],c[8])
|
||||
data['form']['check_date']=time.strftime("%Y-%m-%d %H:%M:%S",c)
|
||||
return data['form']
|
||||
|
||||
def _record_objects(self, cr, uid, data, context):
|
||||
check_date=data['form']['check_date']
|
||||
filter=data['form']['filter_cond']
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
user=(pool.get('res.users').browse(cr,uid,uid)).login
|
||||
mod = pool.get('ir.module.record')
|
||||
mod_obj = pool.get('ir.model')
|
||||
|
||||
for id in data['form']['objects'][0][2]:
|
||||
obj_name=(mod_obj.browse(cr,uid,id)).model
|
||||
obj_pool=pool.get(obj_name)
|
||||
if filter =='created':
|
||||
search_condition =[('create_date','>',check_date)]
|
||||
elif filter =='modified':
|
||||
search_condition =[('write_date','>',check_date)]
|
||||
elif filter =='created_modified':
|
||||
search_condition =[('create_date','>',check_date),('write_date','>',check_date)]
|
||||
if '_log_access' in dir(obj_pool):
|
||||
if not (obj_pool._log_access):
|
||||
search_condition=[]
|
||||
if '_auto' in dir(obj_pool):
|
||||
if not obj_pool._auto:
|
||||
continue
|
||||
search_ids=obj_pool.search(cr,uid,search_condition)
|
||||
for s_id in search_ids:
|
||||
args=(cr.dbname,uid,user,obj_name,'copy',s_id,{},context)
|
||||
mod.recording_data.append(('query',args, {},s_id))
|
||||
return {}
|
||||
|
||||
def inter_call(self,cr,uid,data,context):
|
||||
res=base_module_save._create_module(self,cr, uid, data, context)
|
||||
return res
|
||||
|
||||
class base_module_record_objects(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_info_default],
|
||||
'result': {
|
||||
'type':'form',
|
||||
'arch':intro_start_form,
|
||||
'fields': intro_start_fields,
|
||||
'state':[
|
||||
('end', 'Cancel', 'gtk-cancel'),
|
||||
('record', 'Record', 'gtk-ok'),
|
||||
]
|
||||
}
|
||||
},
|
||||
'record': {
|
||||
'actions': [],
|
||||
'result': {'type':'action','action':_record_objects,'state':'intro'}
|
||||
},
|
||||
'intro': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type':'form',
|
||||
'arch':base_module_save.intro_start_form,
|
||||
'fields':base_module_save.intro_start_fields,
|
||||
'state':[
|
||||
('end', 'Cancel', 'gtk-cancel'),
|
||||
('save', 'Continue', 'gtk-ok'),
|
||||
]
|
||||
},
|
||||
},
|
||||
'save': {
|
||||
'actions': [inter_call],
|
||||
'result': {
|
||||
'type':'form',
|
||||
'arch':base_module_save.intro_save_form,
|
||||
'fields': base_module_save.intro_save_fields,
|
||||
'state':[('end', 'Close', 'gtk-ok'),]
|
||||
},
|
||||
},
|
||||
'end': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
|
||||
},
|
||||
}
|
||||
base_module_record_objects('base_module_record.module_record_objects')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -24,6 +24,11 @@ import wizard
|
||||
import osv
|
||||
import pooler
|
||||
|
||||
info = '''<?xml version="1.0"?>
|
||||
<form string="Module Recording">
|
||||
<label string="Thanks For using Module Recorder" colspan="4" align="0.0"/>
|
||||
</form>'''
|
||||
|
||||
info_start_form = '''<?xml version="1.0"?>
|
||||
<form string="Module Recording">
|
||||
<separator string="Recording Information" colspan="4"/>
|
||||
@@ -88,6 +93,7 @@ def _info_default(self, cr, uid, data, context):
|
||||
mod = pool.get('ir.module.record')
|
||||
result = {}
|
||||
info = "Details of "+str(len(mod.recording_data))+" Operation(s):\n\n"
|
||||
|
||||
for line in mod.recording_data:
|
||||
result.setdefault(line[0],{})
|
||||
result[line[0]].setdefault(line[1][3], {})
|
||||
@@ -144,6 +150,13 @@ def _create_module(self, cr, uid, data, context):
|
||||
'module_file': base64.encodestring(s.getvalue()),
|
||||
'module_filename': data['form']['directory_name']+'-'+data['form']['version']+'.zip'
|
||||
}
|
||||
def _check(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
mod = pool.get('ir.module.record')
|
||||
if len(mod.recording_data):
|
||||
return 'info'
|
||||
else:
|
||||
return 'end'
|
||||
|
||||
class base_module_publish(wizard.interface):
|
||||
states = {
|
||||
@@ -155,10 +168,14 @@ class base_module_publish(wizard.interface):
|
||||
'fields': info_start_fields,
|
||||
'state':[
|
||||
('end', 'Cancel', 'gtk-cancel'),
|
||||
('info', 'Continue', 'gtk-ok'),
|
||||
('check', 'Continue', 'gtk-ok'),
|
||||
]
|
||||
}
|
||||
},
|
||||
'check': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check}
|
||||
},
|
||||
'info': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
@@ -181,7 +198,11 @@ class base_module_publish(wizard.interface):
|
||||
('end', 'Close', 'gtk-ok'),
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
'end': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
|
||||
},
|
||||
}
|
||||
base_module_publish('base_module_record.module_save')
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<field name="field_ids" nolabel="1" colspan="4">
|
||||
<form string="Fields">
|
||||
<field name="sequence"/>
|
||||
<field name="field_id" domain="parent.model_ids and [('model_id','in',parent.model_ids[0][2])] or []">
|
||||
<field name="field_id" domain="parent.model_ids and [('model_id','in',parent.model_ids[0][2]),('ttype','<>','many2many'),('ttype','<>','one2many')] or []">
|
||||
<tree string="Field List">
|
||||
<field name="model_id"/>
|
||||
<field name="name"/>
|
||||
@@ -67,7 +67,7 @@
|
||||
</form>
|
||||
<tree editable="bottom" string="Fields to Display">
|
||||
<field name="sequence"/>
|
||||
<field name="field_id" domain="parent.model_ids and [('model_id','in',parent.model_ids[0][2])] or []"/>
|
||||
<field name="field_id" domain="parent.model_ids and [('model_id','in',parent.model_ids[0][2]),('ttype','<>','many2many'),('ttype','<>','one2many')] or []"/>
|
||||
<field name="group_method"/>
|
||||
<field name="graph_mode"/>
|
||||
<field name="calendar_mode"/>
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:30+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 17:15+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:24+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 17:20+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * base_vat
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:34+0000\n"
|
||||
"PO-Revision-Date: 2008-09-10 15:05:35+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * board_account
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-10 15:05:35+0000\n"
|
||||
"PO-Revision-Date: 2008-09-10 15:05:35+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * board_association
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-10 15:05:35+0000\n"
|
||||
"PO-Revision-Date: 2008-09-10 15:05:35+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * board_auction
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:23+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 08:03+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-10-28 11:31:29+0000\n"
|
||||
"PO-Revision-Date: 2008-10-28 11:31:29+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Translation of OpenERP Server.
|
||||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * board_project
|
||||
#
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:28+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 08:15+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:28+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 08:53+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ class crm_case_section(osv.osv):
|
||||
_name = "crm.case.section"
|
||||
_description = "Case Section"
|
||||
_columns = {
|
||||
'name': fields.char('Case Section',size=64, required=True),
|
||||
'name': fields.char('Case Section',size=64, required=True, translate=True),
|
||||
'code': fields.char('Section Code',size=8),
|
||||
'active': fields.boolean('Active'),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
@@ -198,7 +198,7 @@ class crm_case_categ(osv.osv):
|
||||
_name = "crm.case.categ"
|
||||
_description = "Category of case"
|
||||
_columns = {
|
||||
'name': fields.char('Case Category Name', size=64, required=True),
|
||||
'name': fields.char('Case Category Name', size=64, required=True, translate=True),
|
||||
'probability': fields.float('Probability (%)', required=True),
|
||||
'section_id': fields.many2one('crm.case.section', 'Case Section'),
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<field name="partner_address_id" string="Contact"/>
|
||||
<field name="date" string="Date"/>
|
||||
<field name="user_id" string="Assigned to"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:30+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 10:18+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -125,7 +125,8 @@
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<separator string="Notes" position="before">
|
||||
<field name="carrier_id" context="{'order_id':active_id}"/>
|
||||
<field name="id" invisible="True"/>
|
||||
<field name="carrier_id" context="{'order_id':id}"/>
|
||||
</separator>
|
||||
</field>
|
||||
</record>
|
||||
@@ -136,7 +137,7 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_out_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="address_id" position="after">
|
||||
<field name="address_id" position="after">
|
||||
<field name="carrier_id"/>
|
||||
<field name="weight"/>
|
||||
</field>
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -30,6 +30,7 @@ class sale_order(osv.osv):
|
||||
_description = "Sale Order"
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True,invisible=True),
|
||||
'carrier_id':fields.many2one("delivery.carrier","Delivery method", help="Complete this field if you plan to invoice the shipping based on packings made."),
|
||||
}
|
||||
|
||||
|
||||
+87
-47
@@ -95,8 +95,7 @@ class node_class(object):
|
||||
where.append( ('parent_id','=',self.object.id) )
|
||||
where.append( ('res_id','=',False) )
|
||||
if nodename:
|
||||
where.append( (fobj._rec_name,'=',nodename) )
|
||||
print where+[ ('parent_id','=',self.object and self.object.id or False) ]
|
||||
where.append( (fobj._rec_name,'=',nodename) )
|
||||
ids = fobj.search(self.cr, self.uid, where+[ ('parent_id','=',self.object and self.object.id or False) ], context=self.context)
|
||||
if self.object and self.root and (self.object.type=='ressource'):
|
||||
ids += fobj.search(self.cr, self.uid, where+[ ('parent_id','=',False) ], context=self.context)
|
||||
@@ -248,27 +247,7 @@ class document_directory(osv.osv):
|
||||
path.append(self.pool.get(directory.ressource_type_id.model).browse(cr,uid,res_id).name)
|
||||
user=self.pool.get('res.users').browse(cr,uid,uid)
|
||||
return "ftp://%s:%s@localhost:8021/%s/%s"%(user.login,user.password,cr.dbname,'/'.join(path))
|
||||
return False
|
||||
def _check_duplication(self, cr, uid,vals):
|
||||
if 'name' in vals:
|
||||
where=" name='%s'"% (vals['name'])
|
||||
if not 'parent_id' in vals or not vals['parent_id']:
|
||||
where+=' and parent_id is null'
|
||||
else:
|
||||
where+=' and parent_id=%d'%(vals['parent_id'])
|
||||
if not 'ressource_parent_type_id' in vals or not vals['ressource_parent_type_id']:
|
||||
where+= ' and ressource_parent_type_id is null'
|
||||
else:
|
||||
where+=" and ressource_parent_type_id='%s'"%(vals['ressource_parent_type_id'])
|
||||
# if not 'ressource_id' in vals or not vals['ressource_id']:
|
||||
# where+= ' and ressource_id is null'
|
||||
# else:
|
||||
# where+=" and ressource_id=%d"%(vals['ressource_id'])
|
||||
cr.execute("select id from document_directory where" + where)
|
||||
res = cr.fetchall()
|
||||
if len(res):
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
level = 100
|
||||
while len(ids):
|
||||
@@ -344,13 +323,7 @@ class document_directory(osv.osv):
|
||||
result = map(lambda node: node.path_get(), children)
|
||||
#childs,object2 = self._get_childs(cr, uid, object, False, context)
|
||||
#result = map(lambda x: urlparse.urljoin(path+'/',x.name), childs)
|
||||
return result
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
# need to make constraints to checking duplicate
|
||||
#if not self._check_duplication(cr,uid,vals):
|
||||
# raise except_orm('ValidateError', 'Directory name must be unique!')
|
||||
return super(document_directory,self).write(cr,uid,ids,vals,context=context)
|
||||
return result
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not default:
|
||||
@@ -359,9 +332,37 @@ class document_directory(osv.osv):
|
||||
default.update({'name': name+ " (copy)"})
|
||||
return super(document_directory,self).copy(cr,uid,id,default,context)
|
||||
|
||||
def _check_duplication(self, cr, uid,vals,ids=[],op='create'):
|
||||
name=vals.get('name',False)
|
||||
parent_id=vals.get('parent_id',False)
|
||||
ressource_parent_type_id=vals.get('ressource_parent_type_id',False)
|
||||
ressource_id=vals.get('ressource_id',0)
|
||||
if op=='write':
|
||||
for directory in self.browse(cr,uid,ids):
|
||||
if not name:
|
||||
name=directory.name
|
||||
if not parent_id:
|
||||
parent_id=directory.parent_id and directory.parent_id.id or False
|
||||
if not ressource_parent_type_id:
|
||||
ressource_parent_type_id=directory.ressource_parent_type_id and directory.ressource_parent_type_id.id or False
|
||||
if not ressource_id:
|
||||
ressource_id=directory.ressource_id and directory.ressource_id.id or 0
|
||||
res=self.search(cr,uid,[('id','<>',directory.id),('name','=',name),('parent_id','=',parent_id),('ressource_parent_type_id','=',ressource_parent_type_id),('ressource_id','=',ressource_id)])
|
||||
if len(res):
|
||||
return False
|
||||
if op=='create':
|
||||
res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('ressource_parent_type_id','=',ressource_parent_type_id),('ressource_id','=',ressource_id)])
|
||||
if len(res):
|
||||
return False
|
||||
return True
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if not self._check_duplication(cr,uid,vals,ids,op='write'):
|
||||
raise except_orm('ValidateError', 'Directory name must be unique!')
|
||||
return super(document_directory,self).write(cr,uid,ids,vals,context=context)
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if not self._check_duplication(cr,uid,vals):
|
||||
raise except_orm('ValidateError', 'Directory name must be unique!')
|
||||
raise except_orm('ValidateError', 'Directory name must be unique!')
|
||||
if vals.get('name',False) and (vals.get('name').find('/')+1 or vals.get('name').find('@')+1 or vals.get('name').find('$')+1 or vals.get('name').find('#')+1) :
|
||||
raise 'Error'
|
||||
return super(document_directory,self).create(cr, uid, vals, context)
|
||||
@@ -548,18 +549,39 @@ class document_file(osv.osv):
|
||||
}
|
||||
_sql_constraints = [
|
||||
('filename_uniq', 'unique (name,parent_id,res_id,res_model)', 'The file name must be unique !')
|
||||
]
|
||||
|
||||
def _check_duplication(self, cr, uid,vals):
|
||||
if 'name' in vals:
|
||||
res=self.search(cr,uid,[('name','=',vals['name']),('parent_id','=','parent_id' in vals and vals['parent_id'] or False),('res_id','=','res_id' in vals and vals['res_id'] or False),('res_model','=','res_model' in vals and vals['res_model']) or False])
|
||||
]
|
||||
def _check_duplication(self, cr, uid,vals,ids=[],op='create'):
|
||||
name=vals.get('name',False)
|
||||
parent_id=vals.get('parent_id',False)
|
||||
res_model=vals.get('res_model',False)
|
||||
res_id=vals.get('res_id',0)
|
||||
if op=='write':
|
||||
for file in self.browse(cr,uid,ids):
|
||||
if not name:
|
||||
name=file.name
|
||||
if not parent_id:
|
||||
parent_id=file.parent_id and file.parent_id.id or False
|
||||
if not res_model:
|
||||
res_model=file.res_model and file.res_model or False
|
||||
if not res_id:
|
||||
res_id=file.res_id and file.res_id or 0
|
||||
res=self.search(cr,uid,[('id','<>',file.id),('name','=',name),('parent_id','=',parent_id),('res_model','=',res_model),('res_id','=',res_id)])
|
||||
if len(res):
|
||||
return False
|
||||
if op=='create':
|
||||
res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('res_id','=',res_id),('res_model','=',res_model)])
|
||||
if len(res):
|
||||
return False
|
||||
return True
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if not self._check_duplication(cr,uid,vals):
|
||||
raise except_orm('ValidateError', 'File name must be unique!')
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not default:
|
||||
default ={}
|
||||
name = self.read(cr, uid, [id])[0]['name']
|
||||
default.update({'name': name+ " (copy)"})
|
||||
return super(document_file,self).copy(cr,uid,id,default,context)
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if not self._check_duplication(cr,uid,vals,ids,'write'):
|
||||
raise except_orm('ValidateError', 'File name must be unique!')
|
||||
result = super(document_file,self).write(cr,uid,ids,vals,context=context)
|
||||
cr.commit()
|
||||
try:
|
||||
@@ -575,8 +597,12 @@ class document_file(osv.osv):
|
||||
pass
|
||||
return result
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
vals['title']=vals['name']
|
||||
if not vals.get('res_id', False) and context.get('default_res_id',False):
|
||||
vals['res_id']=context.get('default_res_id',False)
|
||||
if not vals.get('res_model', False) and context.get('default_res_model',False):
|
||||
vals['res_model']=context.get('default_res_model',False)
|
||||
if vals.get('res_id', False) and vals.get('res_model',False):
|
||||
obj_model=self.pool.get(vals['res_model'])
|
||||
result = obj_model.read(cr, uid, [vals['res_id']], context=context)
|
||||
@@ -585,18 +611,22 @@ class document_file(osv.osv):
|
||||
vals['title'] = (obj['name'] or '')[:60]
|
||||
if obj_model._name=='res.partner':
|
||||
vals['partner_id']=obj['id']
|
||||
elif 'address_id' in obj:
|
||||
address=self.pool.get('res.partner.address').read(cr,uid,[obj['address_id']],context=context)
|
||||
elif obj.get('address_id',False):
|
||||
if isinstance(obj['address_id'],tuple) or isinstance(obj['address_id'],list):
|
||||
address_id=obj['address_id'][0]
|
||||
else:
|
||||
address_id=obj['address_id']
|
||||
address=self.pool.get('res.partner.address').read(cr,uid,[address_id],context=context)
|
||||
if len(address):
|
||||
vals['partner_id']=address[0]['partner_id'] or False
|
||||
elif 'partner_id' in obj:
|
||||
vals['partner_id']=address[0]['partner_id'][0] or False
|
||||
elif obj.get('partner_id',False):
|
||||
if isinstance(obj['partner_id'],tuple) or isinstance(obj['partner_id'],list):
|
||||
vals['partner_id']=obj['partner_id'][0]
|
||||
else:
|
||||
vals['partner_id']=obj['partner_id']
|
||||
|
||||
datas=None
|
||||
if 'datas' not in vals:
|
||||
if vals.get('datas',False) and vals.get('link',False) :
|
||||
import urllib
|
||||
datas=base64.encodestring(urllib.urlopen(vals['link']).read())
|
||||
else:
|
||||
@@ -631,7 +661,12 @@ class document_configuration_wizard(osv.osv_memory):
|
||||
_name='document.configuration.wizard'
|
||||
_rec_name = 'Auto Directory configuration'
|
||||
_columns = {
|
||||
}
|
||||
'host': fields.char('Server Address', size=64, help="Put here the server address or IP. " \
|
||||
"Keep localhost if you don't know what to write.", required=True)
|
||||
}
|
||||
_defaults = {
|
||||
'host': lambda *args: 'localhost'
|
||||
}
|
||||
def action_cancel(self,cr,uid,ids,conect=None):
|
||||
return {
|
||||
'view_type': 'form',
|
||||
@@ -642,6 +677,7 @@ class document_configuration_wizard(osv.osv_memory):
|
||||
}
|
||||
|
||||
def action_config(self, cr, uid, ids, context=None):
|
||||
conf = self.browse(cr, uid, ids[0], context)
|
||||
obj=self.pool.get('document.directory')
|
||||
objid=self.pool.get('ir.model.data')
|
||||
|
||||
@@ -706,6 +742,10 @@ class document_configuration_wizard(osv.osv_memory):
|
||||
'ressource_tree': 1
|
||||
})
|
||||
|
||||
aid = objid._get_id(cr, uid, 'document', 'action_document_browse')
|
||||
aid = objid.browse(cr, uid, aid, context=context).res_id
|
||||
self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost')+':8021/'})
|
||||
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
|
||||
@@ -251,6 +251,7 @@
|
||||
<form string="Auto Configure">
|
||||
<separator string="Document Management System." colspan="4"/>
|
||||
<label string="This wizard will automatically configure the document management system according to modules installed on your system." align="0.0" colspan="4"/>
|
||||
<field name="host" colspan="4"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<label string="" colspan="2"/>
|
||||
<group col="4" colspan="2">
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-10-28 10:07:49+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 17:56+0100\n"
|
||||
"Last-Translator: Christophe Chauvet <christophe.chauvet@syleam.fr>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -237,7 +237,8 @@ class event_registration(osv.osv):
|
||||
_defaults = {
|
||||
'nb_register': lambda *a: 1,
|
||||
'tobe_invoiced' : lambda *a: True,
|
||||
'name': lambda *a: 'Registration'
|
||||
'name': lambda *a: 'Registration',
|
||||
'state': lambda *b: 'draft'
|
||||
}
|
||||
|
||||
def onchange_badge_name(self, cr, uid, ids, badge_name):
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:31+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 11:02+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 13:23+0000\n"
|
||||
"PO-Revision-Date: 2008-10-11 07:06+0000\n"
|
||||
"Last-Translator: Christophe Chauvet <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ class hr_timesheet_group(osv.osv):
|
||||
cycle = 0
|
||||
result = []
|
||||
while todo>0:
|
||||
cr.execute('select hour_from,hour_to from hr_timesheet where dayofweek=%d and tgroup_id=%d order by hour_from', (dt_from.day_of_week,id))
|
||||
cr.execute("select hour_from,hour_to from hr_timesheet where dayofweek='%s' and tgroup_id=%d order by hour_from", (dt_from.day_of_week,id))
|
||||
for (hour_from,hour_to) in cr.fetchall():
|
||||
h1,m1 = map(int,hour_from.split(':'))
|
||||
h2,m2 = map(int,hour_to.split(':'))
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"PO-Revision-Date: 2008-11-02 20:23:25+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -94,14 +94,14 @@ class report_custom(report_rml):
|
||||
inner join (hr_timesheet_group as g inner join hr_timesheet_employee_rel as rel
|
||||
on rel.tgroup_id = g.id and rel.emp_id = %s)
|
||||
on t.tgroup_id = g.id
|
||||
where dayofweek = %s
|
||||
where dayofweek = '%s'
|
||||
and date_from = (select max(date_from)
|
||||
from hr_timesheet inner join (hr_timesheet_employee_rel
|
||||
inner join hr_timesheet_group
|
||||
on hr_timesheet_group.id = hr_timesheet_employee_rel.tgroup_id
|
||||
and hr_timesheet_employee_rel.emp_id = %s)
|
||||
on hr_timesheet.tgroup_id = hr_timesheet_group.id
|
||||
where dayofweek = %s and date_from <= '%s')
|
||||
where dayofweek = '%s' and date_from <= '%s')
|
||||
order by date_from desc
|
||||
'''
|
||||
isPH = False
|
||||
|
||||
@@ -39,7 +39,7 @@ si_so_fields = {
|
||||
|
||||
si_form = '''<?xml version="1.0" ?>
|
||||
<form string="Sign in status">
|
||||
<seperator string="This is the status of your sign in request. Check it out maybe you were already signed in." colspan="4" />
|
||||
<separator string="This is the status of your sign in request. Check it out maybe you were already signed in." colspan="4" />
|
||||
<field name="success" readonly="True" />
|
||||
</form>'''
|
||||
|
||||
@@ -49,7 +49,7 @@ si_fields = {
|
||||
|
||||
so_form = '''<?xml version="1.0" ?>
|
||||
<form string="Sign in status">
|
||||
<seperator string="This is the status of your sign out request. Check it out maybe you were already signed out." colspan="4" />
|
||||
<separator string="This is the status of your sign out request. Check it out maybe you were already signed out." colspan="4" />
|
||||
<field name="success" readonly="True" />
|
||||
</for>'''
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-10-28 09:40:44+0000\n"
|
||||
"PO-Revision-Date: 2008-10-28 09:40:44+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:25+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 11:14+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:25+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 11:30+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
+30
-19
@@ -48,7 +48,6 @@ def strToDate(dt):
|
||||
|
||||
class hr_holidays_status(osv.osv):
|
||||
_name = "hr.holidays.status"
|
||||
# _inherit = 'hr.holidays.status'
|
||||
_description = "Holidays Status"
|
||||
_columns = {
|
||||
'name' : fields.char('Holiday Status', size=64, required=True, translate=True),
|
||||
@@ -65,22 +64,8 @@ hr_holidays_status()
|
||||
|
||||
class hr_holidays(osv.osv):
|
||||
_name = "hr.holidays"
|
||||
# _inherit = 'hr.holidays'
|
||||
_description = "Holidays"
|
||||
|
||||
def _get_days(self,cr, uid,ids, name, *args):
|
||||
res = {}
|
||||
for val in self.browse(cr, uid, ids):
|
||||
date_from = val.date_from
|
||||
date_to = val.date_to
|
||||
if date_from:
|
||||
if date_to:
|
||||
from_dt = time.mktime(time.strptime(date_from,'%Y-%m-%d %H:%M:%S'))
|
||||
to_dt = time.mktime(time.strptime(date_to,'%Y-%m-%d %H:%M:%S'))
|
||||
diff_day = (to_dt-from_dt)/(3600*24)
|
||||
res[val.id] = round(diff_day)+1
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Description', required=True, readonly=True, size=64, states={'draft':[('readonly',False)]}),
|
||||
'state': fields.selection([('draft', 'draft'), ('confirm', 'Confirmed'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'Status', readonly=True),
|
||||
@@ -91,15 +76,33 @@ class hr_holidays(osv.osv):
|
||||
'user_id':fields.many2one('res.users', 'Employee_id', states={'draft':[('readonly',False)]}, select=True, readonly=True),
|
||||
'manager_id' : fields.many2one('hr.employee', 'Holiday manager', invisible=False, readonly=True),
|
||||
'notes' : fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'number_of_days': fields.function(_get_days, method=True,store=True, type='float', string='Number of Days in this Holiday Request'),
|
||||
'number_of_days': fields.float('Number of Days in this Holiday Request',required=True),
|
||||
'case_id':fields.many2one('crm.case', 'Case'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'employee_id' : _employee_get ,
|
||||
'state' : lambda *a: 'draft',
|
||||
'user_id': lambda obj, cr, uid, context: uid
|
||||
'user_id': lambda obj, cr, uid, context: uid,
|
||||
}
|
||||
_order = 'date_from desc'
|
||||
|
||||
def onchange_date_to(self, cr, uid, ids, date_from, date_to):
|
||||
result = {}
|
||||
if date_from:
|
||||
if date_to:
|
||||
from_dt = time.mktime(time.strptime(date_from,'%Y-%m-%d %H:%M:%S'))
|
||||
to_dt = time.mktime(time.strptime(date_to,'%Y-%m-%d %H:%M:%S'))
|
||||
diff_day = (to_dt-from_dt)/(3600*24)
|
||||
result['value'] = {
|
||||
'number_of_days': round(diff_day)+1
|
||||
}
|
||||
return result
|
||||
result['value'] = {
|
||||
'number_of_days': 0
|
||||
}
|
||||
return result
|
||||
|
||||
def set_to_draft(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {
|
||||
'state':'draft',
|
||||
@@ -207,6 +210,13 @@ hr_holidays()
|
||||
class hr_holidays_per_user(osv.osv):
|
||||
_name = "hr.holidays.per.user"
|
||||
_description = "Holidays Per User"
|
||||
|
||||
def _get_remaining_leaves(self, cr, uid, ids, field_name, arg=None, context={}):
|
||||
result = {}
|
||||
for r in self.read(cr, uid, ids, ['max_leaves','leaves_taken']):
|
||||
result[r['id']] = r['max_leaves'] - r['leaves_taken']
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
'employee_id' : fields.many2one('hr.employee', 'Employee',required=True),
|
||||
'user_id' : fields.many2one('res.users','User'),
|
||||
@@ -215,12 +225,13 @@ class hr_holidays_per_user(osv.osv):
|
||||
'leaves_taken' : fields.float('Leaves Already Taken',readonly=True),
|
||||
'active' : fields.boolean('Active'),
|
||||
'notes' : fields.text('Notes'),
|
||||
'remaining_leaves': fields.function(_get_remaining_leaves, method=True, string='Remaining Leaves', type='float'),
|
||||
}
|
||||
_defaults = {
|
||||
'active' : lambda *a: True,
|
||||
}
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
if vals['employee_id']:
|
||||
obj_emp=self.pool.get('hr.employee').browse(cr,uid,vals['employee_id'])
|
||||
vals.update({'user_id': obj_emp.user_id.id})
|
||||
|
||||
@@ -3,45 +3,46 @@
|
||||
<data>
|
||||
|
||||
<!-- Holidays -->
|
||||
<record model="ir.ui.view" id="edit_holiday_inherit_new">
|
||||
<field name="name">hr.holidays.form.inherit</field>
|
||||
<record model="ir.ui.view" id="edit_holiday_new">
|
||||
<field name="name">hr.holidays.form</field>
|
||||
<field name="model">hr.holidays</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" eval="False"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Employee holidays">
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field name="date_from" select="1"/>
|
||||
<field name="date_to" select="1"/>
|
||||
<newline/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="holiday_status" select="1"/>
|
||||
<group col="12" colspan="2">
|
||||
<button string="Confirm" name="confirm" states="draft" type="workflow"/>
|
||||
<button string="Validate" name="validate" states="confirm" type="workflow"/>
|
||||
<button string="Refuse" name="refuse" states="confirm" type="workflow"/>
|
||||
<button string="Cancel" name="cancel" states="validate,refuse" type="workflow"/>
|
||||
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object"/>
|
||||
</group>
|
||||
<field name="state" select="1" colspan="2"/>
|
||||
<newline />
|
||||
<field name="notes" col="12" colspan="4"/>
|
||||
<newline />
|
||||
<field name="manager_id" colspan="2"/>
|
||||
<field name="employee_id" select="1" />
|
||||
<newline />
|
||||
<field name="number_of_days" colspan="2"/>
|
||||
<field name="date_from" select="1"/>
|
||||
<field name="date_to" select="1" on_change="onchange_date_to(date_from, date_to)"/>
|
||||
<notebook colspan="4">
|
||||
<page string="General">
|
||||
<field name="employee_id" select="1" />
|
||||
<field name="number_of_days"/>
|
||||
<field name="notes" col="12" colspan="4"/>
|
||||
<field name="manager_id"/>
|
||||
<newline/>
|
||||
<field name="state" select="1" colspan="2"/>
|
||||
<group colspan="2">
|
||||
<button string="Confirm" name="confirm" states="draft" type="workflow"/>
|
||||
<button string="Validate" name="validate" states="confirm" type="workflow"/>
|
||||
<button string="Refuse" name="refuse" states="confirm" type="workflow"/>
|
||||
<button string="Cancel" name="cancel" states="validate,refuse" type="workflow"/>
|
||||
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_holiday">
|
||||
<field name="name">hr.holidays.tree</field>
|
||||
<field name="model">hr.holidays</field>
|
||||
<field name="inherit_id" eval="False"/>
|
||||
<field name="model">hr.holidays</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Employee holidays">
|
||||
<field name="name"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="number_of_days" string="Number of Days"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<field name="holiday_status"/>
|
||||
@@ -50,24 +51,10 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_holiday_2">
|
||||
<field name="name">hr.holidays.tree</field>
|
||||
<field name="model">hr.holidays</field>
|
||||
<field name="inherit_id" ref="view_holiday"/>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="employee_id"/>
|
||||
<field name="number_of_days" string="Number of Days"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- holidays status -->
|
||||
<record model="ir.ui.view" id="edit_holiday_status_form">
|
||||
<field name="name">hr.holidays.status.form</field>
|
||||
<field name="model">hr.holidays.status</field>
|
||||
<field name="inherit_id" eval="False"/>
|
||||
<field name="model">hr.holidays.status</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Define holiday status">
|
||||
@@ -81,8 +68,7 @@
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_holiday_status_tree">
|
||||
<field name="name">hr.holidays.status.tree</field>
|
||||
<field name="model">hr.holidays.status</field>
|
||||
<field name="inherit_id" eval="False"/>
|
||||
<field name="model">hr.holidays.status</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Holiday status">
|
||||
@@ -117,11 +103,12 @@
|
||||
<field name="holiday_status" select="1" />
|
||||
<newline/>
|
||||
<field name="max_leaves" select="2" colspan="2" />
|
||||
<newline/>
|
||||
<field name="leaves_taken" select="2" colspan="2" />
|
||||
<newline/>
|
||||
<field name="remaining_leaves" select="2" colspan="2" />
|
||||
<field name="active" select="2"/>
|
||||
<newline/>
|
||||
<field name="notes" colspan="4" />
|
||||
<field name="notes" colspan="4" select="2"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -134,7 +121,7 @@
|
||||
<field name="employee_id"/>
|
||||
<field name="holiday_status"/>
|
||||
<field name="max_leaves"/>
|
||||
<field name="leaves_taken"/>
|
||||
<field name="remaining_leaves"/>
|
||||
<field name="active" select="2"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -157,7 +144,7 @@
|
||||
<record model="ir.actions.act_window" id="open_ask_holidays">
|
||||
<field name="res_model">hr.holidays</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="edit_holiday_inherit_new" />
|
||||
<field name="view_id" ref="edit_holiday_new" />
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:30+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 11:55+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -109,6 +109,9 @@ class hr_analytic_timesheet(osv.osv):
|
||||
'date' : lambda self,cr,uid,ctx: ctx.get('date', time.strftime('%Y-%m-%d')),
|
||||
'user_id' : lambda obj, cr, uid, ctx : ctx.get('user_id', uid),
|
||||
}
|
||||
def on_change_account_id(self, cr, uid, ids, account_id):
|
||||
return {'value':{}}
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
try:
|
||||
res = super(hr_analytic_timesheet, self).create(cr, uid, vals, context)
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:28+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 15:49+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<xsl:attribute name="style">esclave</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="format-number(//employee[@id=$id]/time-element[@date=$today], '##.##')" />
|
||||
<xsl:value-of select="format-number(sum(//employee[@id=$id]/time-element[@date=$today]), '##.##')" />
|
||||
</para>
|
||||
</td>
|
||||
</xsl:for-each>
|
||||
@@ -121,4 +121,4 @@
|
||||
</tr>
|
||||
</blockTable>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
</xsl:stylesheet>
|
||||
|
||||
@@ -112,6 +112,8 @@ def _write(self, cr, uid, data, emp_id, context):
|
||||
res['account_id'] = data['form']['account_id']
|
||||
res['unit_amount'] = hour
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
return timesheet_obj.create(cr, uid, res, context)
|
||||
|
||||
def _sign_out_result_end(self, cr, uid, data, context):
|
||||
|
||||
@@ -114,9 +114,14 @@ class hr_analytic_timesheet(osv.osv):
|
||||
if not account_id:
|
||||
return res
|
||||
res.setdefault('value',{})
|
||||
st = self.pool.get('account.analytic.account').browse(cr, uid,
|
||||
account_id).to_invoice.id
|
||||
acc = self.pool.get('account.analytic.account').browse(cr, uid, account_id)
|
||||
st = acc.to_invoice.id
|
||||
res['value']['to_invoice'] = st or False
|
||||
if acc.state=='pending':
|
||||
res['warning'] = {
|
||||
'title': 'Warning',
|
||||
'message': 'The analytic account is in pending state.\nYou should not work on this account !'
|
||||
}
|
||||
return res
|
||||
|
||||
def copy(self, cursor, user, obj_id, default=None, context=None):
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:22+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 12:01+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:09+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 12:02+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -51,7 +51,7 @@ def _action_line_create(self, cr, uid, data, context):
|
||||
'product_uom_id': unit_id,
|
||||
'product_id': product_id,
|
||||
'amount': work.hours or 0.0,
|
||||
'account_id': aa.id
|
||||
'account_id': aa.id,
|
||||
}
|
||||
res2 = ts.on_change_unit_amount(cr, uid, False, product_id, work.hours or 0.0,unit_id, context)
|
||||
if res2:
|
||||
|
||||
@@ -9,7 +9,7 @@ msgstr ""
|
||||
"POT-Creation-Date: 2008-09-05 16:25+0000\n"
|
||||
"PO-Revision-Date: 2008-10-13 12:10+0000\n"
|
||||
"Last-Translator: Olivier Laurent <Unknown>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language-Team: OpenERP Language Team <support@openerp.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user