bzr revid: fp@tinyerp.com-20090505203051-kze0qxeqcv72v3y6
This commit is contained in:
Fabien Pinckaers
2009-05-05 22:30:51 +02:00
12 changed files with 72 additions and 51 deletions
@@ -37,7 +37,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
_name = 'report.account.general.ledger_landscape'
def preprocess(self, objects, data, ids):
def set_context(self, objects, data, ids, report_type = None):
##
self.borne_date = self.get_min_date(data['form'])
##
@@ -49,7 +49,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
super(general_ledger_landscape, self).preprocess(objects, data, new_ids)
super(general_ledger_landscape, self).set_context(objects, data, new_ids,report_type)
def __init__(self, cr, uid, name, context):
super(general_ledger_landscape, self).__init__(cr, uid, name, context)
@@ -180,7 +180,6 @@ class general_ledger_landscape(rml_parse.rml_parse):
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)])
#
@@ -146,7 +146,7 @@
<font color="white"> </font>
</para>
<para style="terp_default_8">[[ repeatIn(objects, 'o') ]]</para>
<para style="terp_default_8">[[ repeatIn(lines(data['form']['period_id'][0][2],data['form']['journal_id'][0][2]), 'line') ]]</para>
<para style="terp_default_8">[[ repeatIn(lines(data['form']['period_id'][0][2],data['form']['journal_id'][0][2]), 'line') ]]</para>
<blockTable colWidths="180.0,180.0,180.0" style="Table_Sub_Header_Content">
<tr>
<td>
@@ -47,6 +47,32 @@ from tools.translate import _
# return super(ir_model_fields, self).search(cr, uid, args, offset, limit, order, context)
#ir_model_fields()
class ir_model(osv.osv):
_inherit = 'ir.model'
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
res_model_ids = super(ir_model,self).search(cr, uid, args, offset, limit, order, context=context, count=count)
try:
if 'model_ids' in context and context['model_ids'][0][2]:
model_ids = context['model_ids'][0][2]
result = []
name_list = []
if model_ids:
obj = self.read(cr, uid, model_ids,['model'])
for name in obj:
name_list.append(name['model'])
cr.execute("SELECT model_id, relation FROM ir_model_fields WHERE relation in (%s)" % (','.join(map(lambda x: "'"+str(x)+"'",name_list))))
for r in cr.fetchall():
result.append(r[0])
return result
return res_model_ids
except Exception,e:
pass
ir_model()
class report_creator(osv.osv):
_name = "base_report_creator.report"
_description = "Report"
@@ -354,8 +380,8 @@ class report_creator(osv.osv):
_constraints = [
(_function_field, 'You can not display field which are not stored in Database.', ['field_ids']),
(_aggregation_error, 'You can apply agregate function to the non calculated field.', ['field_ids']),
(_calander_view_error, "You must have to give calander view's color,start date and delay.", ['field_ids']),
(_aggregation_error, 'You can apply aggregate function to the non calculated field.', ['field_ids']),
(_calander_view_error, "You must have to give calendar view's color,start date and delay.", ['field_ids']),
]
report_creator()
@@ -38,7 +38,7 @@
<field name="active" select="2"/>
<notebook colspan="4">
<page string="General Configuration">
<field name="model_ids" colspan="4"/>
<field name="model_ids" colspan="4" context="{'model_ids':model_ids}"/>
<separator string="State" colspan="4"/>
<field name="state"/>
<button string="Create Menu" name="%(wizard_menu_create)d" type="action" colspan="2"/>
@@ -72,7 +72,7 @@ def set_field_operator(self,field_name,field_type,search_operator,search_value):
field_search[1]='in'
field_search[2] = "("+','.join([str(x) for x in search_value])+")"
elif field_type in char_type or field_type in date_type:
field_search[2] = "'"+field_search[2]+"'"
field_search[2] = field_search[2] and "'"+field_search[2]+"'" or False
elif search_operator == '<>':
if field_type=='many2one':
field_search[1]='not in'
@@ -123,18 +123,17 @@ def _set_filter_value(self, cr, uid, data, context):
table_name = model_pool._table
model_name = model_pool._description
if field_type == 'boolean' and value_data == 1:
value_data = 'true'
else:
value_data = 'false'
if field_type:
if field_type == 'boolean':
if value_data == 1:
value_data = 'true'
else:
value_data = 'false'
if field_type == 'many2many' and value_data and len(value_data):
fields_list = set_field_operator(self,table_name+"."+field_data['name'],field_data['ttype'],form_data['operator'],value_data[0][2])
else:
fields_list = set_field_operator(self,table_name+"."+field_data['name'],field_data['ttype'],form_data['operator'],value_data)
if fields_list and value_data:
if fields_list:
create_dict = {
'name':model_name + "/" +field_data['field_description'] +" "+ mapping_fields[form_data['operator']] + " " + str(fields_list[2]) + " ",
'expression':' '.join(fields_list),
+9 -1
View File
@@ -111,7 +111,15 @@ class hr_analytic_timesheet(osv.osv):
}
def on_change_account_id(self, cr, uid, ids, account_id):
return {'value':{}}
def on_change_date(self, cr, uid, ids, date):
if ids:
new_date = self.read(cr,uid,ids[0],['date'])['date']
if date != new_date:
warning = {'title':'User Alert!','message':'Changing the date will let this entry appear in the timesheet of the new date.'}
return {'value':{},'warning':warning}
return {'value':{}}
def create(self, cr, uid, vals, context={}):
try:
res = super(hr_analytic_timesheet, self).create(cr, uid, vals, context)
+3 -3
View File
@@ -8,7 +8,7 @@
<field name="arch" type="xml">
<tree editable="bottom" string="Timesheet Line">
<field name="user_id" on_change="on_change_user_id(user_id)" required="1"/>
<field name="date"/>
<field name="date" on_change="on_change_date(date)"/>
<field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" name="account_id"/>
<field name="name"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" sum="Total time"/>
@@ -25,9 +25,9 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Timesheet Lines">
<field colspan="4" name="name"/>
<field colspan="4" name="name" select="2"/>
<field name="user_id" on_change="on_change_user_id(user_id)" required="1" select="1"/>
<field name="date" select="1"/>
<field name="date" select="1" on_change="on_change_date(date)"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
<newline/>
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" required="1" domain="[('type','=','service')]"/>
@@ -369,7 +369,7 @@ class hr_timesheet_line(osv.osv):
elif (x[2] is False) and (x[1] == '<>' or x[1] == '!='):
qu1.append('(s.id IS NOT NULL)')
else:
qu1.append('(s.id %s %s)' % (x[1], '%d'))
qu1.append('(s.id %s %s)' % (x[1], '%s'))
qu2.append(x[2])
elif x[1] == 'in':
if len(x[2]) > 0:
@@ -486,7 +486,7 @@ class hr_attendance(osv.osv):
elif (x[2] is False) and (x[1] == '<>' or x[1] == '!='):
qu1.append('(s.id IS NOT NULL)')
else:
qu1.append('(s.id %s %s)' % (x[1], '%d'))
qu1.append('(s.id %s %s)' % (x[1], '%s'))
qu2.append(x[2])
elif x[1] == 'in':
if len(x[2]) > 0:
+5 -24
View File
@@ -98,26 +98,6 @@
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table8">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
@@ -168,7 +148,6 @@
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<images/>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]] </para>
<para style="terp_default_8">
@@ -219,6 +198,9 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="118.0,147.0,132.0,131.0" repeatRows="1" style="Table1">
<tr>
<td>
@@ -236,7 +218,7 @@
</tr>
</blockTable>
<section>
<blockTable colWidths="118.0,147.0,132.0,132.0" style="Table2">
<blockTable colWidths="118.0,147.0,132.0,131.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
@@ -275,8 +257,6 @@
<para style="terp_tblheader_General_Centre">No. Of Hours</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="81.0,155.0,125.0,84.0,83.0" style="Table7">
<tr>
<td>
<para style="terp_default_Centre_8">[[ repeatIn(o.workcenter_lines,'line2') ]]</para>
@@ -340,3 +320,4 @@
</section>
</story>
</document>
+10 -1
View File
@@ -135,6 +135,15 @@ class purchase_order(osv.osv):
result[line.order_id.id] = True
return result.keys()
def _invoiced(self, cursor, user, ids, name, arg, context=None):
res = {}
for purchase in self.browse(cursor, user, ids, context=context):
if purchase.invoice_id.reconciled:
res[purchase.id] = purchase.invoice_id.reconciled
else:
res[purchase.id] = False
return res
_columns = {
'name': fields.char('Order Reference', size=64, required=True, select=True),
'origin': fields.char('Origin', size=64,
@@ -163,7 +172,7 @@ class purchase_order(osv.osv):
'picking_ids': fields.one2many('stock.picking', 'purchase_id', 'Picking List', readonly=True, help="This is the list of picking list that have been generated for this purchase"),
'shipped':fields.boolean('Received', readonly=True, select=True),
'shipped_rate': fields.function(_shipped_rate, method=True, string='Received', type='float'),
'invoiced':fields.boolean('Invoiced & Paid', readonly=True, select=True),
'invoiced': fields.function(_invoiced, method=True, string='Invoiced & Paid', type='boolean'),
'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'),
'invoice_method': fields.selection([('manual','Manual'),('order','From Order'),('picking','From Picking')], 'Invoicing Control', required=True,
help="From Order: a draft invoice will be pre-generated based on the purchase order. The accountant " \
+1 -1
View File
@@ -55,7 +55,7 @@
<record id="act_invoice_done" model="workflow.activity">
<field name="wkf_id" ref="purchase_order"/>
<field name="name">invoice_done</field>
<field name="action">write({'invoiced':1,'state':'approved'})</field>
<field name="action">write({'state':'approved'})</field>
<field name="kind">function</field>
</record>
<record id="act_invoice_end" model="workflow.activity">
+3 -4
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -46,7 +46,7 @@ class stock_picking(osv.osv):
_defaults = {
'purchase_id': lambda *a: False,
}
def get_currency_id(self, cursor, user, picking):
if picking.purchase_id:
return picking.purchase_id.pricelist_id.currency_id.id
@@ -93,8 +93,7 @@ class stock_picking(osv.osv):
def _invoice_hook(self, cursor, user, picking, invoice_id):
purchase_obj = self.pool.get('purchase.order')
if picking.purchase_id:
purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoiced':True,
'invoice_id': invoice_id,
purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoice_id': invoice_id,
})
return super(stock_picking, self)._invoice_hook(cursor, user,
picking, invoice_id)