bzr revid: fp@tinyerp.com-20090312153141-vsli98m4ehz7mpax
This commit is contained in:
Fabien Pinckaers
2009-03-12 16:31:41 +01:00
9 changed files with 99 additions and 11 deletions
+2 -1
View File
@@ -470,7 +470,7 @@ class account_journal(osv.osv):
'user_id': lambda self,cr,uid,context: uid,
}
def create(self, cr, uid, vals, context={}):
journal_id = super(osv.osv, self).create(cr, uid, vals, context)
journal_id = super(account_journal, self).create(cr, uid, vals, context)
# journal_name = self.browse(cr, uid, [journal_id])[0].code
# periods = self.pool.get('account.period')
# ids = periods.search(cr, uid, [('date_stop','>=',time.strftime('%Y-%m-%d'))])
@@ -481,6 +481,7 @@ class account_journal(osv.osv):
# 'period_id': period.id
# })
return journal_id
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if not args:
args=[]
+1
View File
@@ -390,6 +390,7 @@ class crm_case(osv.osv):
'email_from': _get_default_email,
'state': lambda *a: 'open',
'priority': lambda *a: AVAILABLE_PRIORITIES[2][0],
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
_order = 'priority, date_deadline desc, date desc,id desc'
+1 -1
View File
@@ -141,7 +141,7 @@ def _state_check(self, cr, uid, data, context):
class wiz_si_so(wizard.interface):
states = {
'init' : {
'actions' : [],
'actions' : [_get_empid],
'result' : {'type' : 'choice', 'next_state': _state_check}
},
'sign_out' : { # this means sign_in...
@@ -51,12 +51,12 @@ class invoice_create(wizard.interface):
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
if (not partner) or not (account.pricelist_id):
raise wizard.except_wizard(_('Analytic account incomplete'),
_('Please fill in the partner and pricelist field in the analytic account:\n%s') % (account.name,))
raise wizard.except_wizard(_('Analytic Account incomplete'),
_('Please fill in the Associate Partner and Sale Pricelist fields in the Analytic Account:\n%s') % (account.name,))
if not partner.address:
raise wizard.except_wizard(_('Partner incomplete'),
_('Please fill in the address field in the partner: %s.') % (partner.name,))
_('Please fill in the Address field in the Partner: %s.') % (partner.name,))
date_due = False
if partner.property_payment_term:
+1 -2
View File
@@ -362,7 +362,7 @@ class Partner(osv.osv):
selection = STATE ,store = {
'account.invoice':(_get_invoice_partner,['state'], 10),
'membership.membership_line':(_get_partner_id,['state'], 10),
'res.partner':(_get_partners, ['free_member','membership_state'], 10)
'res.partner':(_get_partners, ['free_member', 'membership_state'], 10)
}
),
'membership_start': fields.function(
@@ -756,5 +756,4 @@ class account_invoice_line(osv.osv):
return result
account_invoice_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -28,7 +28,6 @@ def _invoice_membership(self, cr, uid, data, context):
partner_ids = data['ids']
product_id = data['form']['product']
pool = pooler.get_pool(cr.dbname)
cr.execute('''
SELECT partner_id, id, type
FROM res_partner_address
@@ -43,7 +42,6 @@ def _invoice_membership(self, cr, uid, data, context):
pid = fetchal[x][0]
id = fetchal[x][1]
type = fetchal[x][2]
if partner_address_ids.has_key(pid) and partner_address_ids[pid]['type'] == 'invoice':
continue
partner_address_ids[pid] = {'id': id, 'type': type}
@@ -95,7 +93,6 @@ def _invoice_membership(self, cr, uid, data, context):
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
}
return value
wizard_arch= """<?xml version="1.0"?>
@@ -110,7 +107,6 @@ wizard_arch= """<?xml version="1.0"?>
class wizard_invoice_membership(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {
+21
View File
@@ -110,5 +110,26 @@ class report_sale_order_category(osv.osv):
""")
report_sale_order_category()
class report_turnover_per_month(osv.osv):
_name = "report.turnover.per.month"
_description = "Turnover Per Month"
_auto = False
_columns = {
'name': fields.date('Month', readonly=True),
'turnover': fields.float('Total Turnover', readonly=True),
}
def init(self, cr):
cr.execute("""
create or replace view report_turnover_per_month as (
select min(am.id) as id, sum(credit) as turnover,to_char(am.date, 'YYYY-MM-01') as name from account_move_line am
where am.account_id in (select distinct(account_id) from account_invoice_line)
and
am.move_id in(select distinct(aw.move_id) from account_invoice aw,account_invoice_line l where l.invoice_id=aw.id)
group by to_char(am.date, 'YYYY-MM-01')
)
""")
report_turnover_per_month()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+32
View File
@@ -171,6 +171,38 @@
<field name="domain">[('state','&lt;&gt;','done')]</field>
</record>
<record model="ir.ui.view" id="view_turnover_month_tree">
<field name="name">report.turnover.per.month.tree</field>
<field name="model">report.turnover.per.month</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Turnover Per Month">
<field name="name" select="1"/>
<field name="turnover" select="2"/>
</tree>
</field>
</record>
<record id="view_turnover_month_graph" model="ir.ui.view">
<field name="name">report.turnover.per.month.graph</field>
<field name="model">report.turnover.per.month</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Turnover Per Month" type="bar">
<field name="name" />
<field name="turnover" />
</graph>
</field>
</record>
<record model="ir.actions.act_window" id="action_turnover_month_tree">
<field name="type">ir.actions.act_window</field>
<field name="name">Turnover Per Month</field>
<field name="res_model">report.turnover.per.month</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_turnover_month_tree"/>
</record>
</data>
</openerp>
+38
View File
@@ -59,6 +59,44 @@ class report_task_user_pipeline_open (osv.osv):
report_task_user_pipeline_open()
#class report_timesheet_task(osv.osv):
# _name = "report.timesheet.task"
# _description = "Report on Timesheets and Tasks per User Per Month"
# _auto = False
#
# def get_hrs_timesheet(self, cr, uid, ids, name,args,context):
# result = {}
#
# for record in self.browse(cr, uid, ids, context):
# last_date = mx.DateTime.strptime(record.month, '%Y-%m-%d') + mx.DateTime.RelativeDateTime(months=1) - 1
# obj=self.pool.get('hr_timesheet_sheet.sheet')
# sheet_ids = obj.search(cr,uid,[('user_id','=',record.user_id.id),('date_current','>=',record.month),('date_current','<=',last_date.strftime('%Y-%m-%d'))])
# data_days = obj.read(cr,uid,sheet_ids,['total_attendance_day','date_current','user_id'])
# total = 0.0
# for day_attendance in data_days:
# total += day_attendance['total_attendance_day']
# result[record.id] = total
#
# return result
#
# _columns = {
# 'month': fields.date('Month', required=True,readonly=True),
# 'user_id': fields.many2one('res.users', 'User' ,readonly=True, required=True),
# 'timesheet_hrs': fields.function(get_hrs_timesheet,method=True, string="Timesheet Hrs" ),
# 'task_hrs': fields.float('Task Hrs', readonly=True, required=True),
# }
#
#
# def init(self, cr):
# cr.execute("""create or replace view report_timesheet_task as (
# select min(p.id) as id, to_char(p.date, 'YYYY-MM-01') as month, min(r.id) as user_id, sum(p.hours) as task_hrs,0.0 as timesheet_hrs
# from project_task_work p,res_users r
# where (r.id=p.user_id)
# group by to_char(p.date, 'YYYY-MM-01'))""")
#
#
#
#report_timesheet_task()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: