@@ -109,10 +109,10 @@
|
||||
<wizard id="wizard_print_journal" menu="False" model="account.journal.period" name="account.print.journal.report" string="Print Journal" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_print_journal" id="menu_print_journal" parent="account.menu_generic_report" type="wizard" />
|
||||
|
||||
<wizard id="wizard_central_journal" menu="False" model="account.journal.period" name="account.central.journal.report" string="Print Central journal" />
|
||||
<wizard id="wizard_central_journal" menu="False" model="account.journal.period" name="account.central.journal.report" string="Print Central Journal" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_central_journal" id="menu_central_journal" parent="account.menu_generic_report" type="wizard" />
|
||||
|
||||
<wizard id="wizard_general_journal" menu="False" model="account.journal.period" name="account.general.journal.report" string="Print General journal" />
|
||||
<wizard id="wizard_general_journal" menu="False" model="account.journal.period" name="account.general.journal.report" string="Print General Journal" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_general_journal" id="menu_general_journal" parent="account.menu_generic_report" type="wizard" />
|
||||
|
||||
</data>
|
||||
|
||||
@@ -35,6 +35,26 @@ fields = {
|
||||
}
|
||||
|
||||
|
||||
def _check_data(self, cr, uid, data, *args):
|
||||
period_id = data['form']['period_id'][0][2]
|
||||
journal_id=data['form']['journal_id'][0][2]
|
||||
|
||||
if type(period_id)==type([]):
|
||||
|
||||
ids_final = []
|
||||
|
||||
for journal in journal_id:
|
||||
for period in period_id:
|
||||
ids_journal_period = pooler.get_pool(cr.dbname).get('account.journal.period').search(cr,uid, [('journal_id','=',journal),('period_id','=',period)])
|
||||
|
||||
if ids_journal_period:
|
||||
ids_final.append(ids_journal_period)
|
||||
|
||||
if not ids_final:
|
||||
raise wizard.except_wizard(_('No Data Available'), _('No records found for your selection!'))
|
||||
return data['form']
|
||||
|
||||
|
||||
class wizard_print_journal(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
@@ -42,7 +62,7 @@ class wizard_print_journal(wizard.interface):
|
||||
'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('print', 'Print'))},
|
||||
},
|
||||
'print': {
|
||||
'actions': [],
|
||||
'actions': [_check_data],
|
||||
'result': {'type':'print', 'report':'account.central.journal.wiz', 'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -34,6 +34,24 @@ fields = {
|
||||
'period_id': {'string': 'Period', 'type': 'many2many', 'relation': 'account.period', 'required': True},
|
||||
}
|
||||
|
||||
def _check_data(self, cr, uid, data, *args):
|
||||
period_id = data['form']['period_id'][0][2]
|
||||
journal_id=data['form']['journal_id'][0][2]
|
||||
|
||||
if type(period_id)==type([]):
|
||||
|
||||
ids_final = []
|
||||
|
||||
for journal in journal_id:
|
||||
for period in period_id:
|
||||
ids_journal_period = pooler.get_pool(cr.dbname).get('account.journal.period').search(cr,uid, [('journal_id','=',journal),('period_id','=',period)])
|
||||
|
||||
if ids_journal_period:
|
||||
ids_final.append(ids_journal_period)
|
||||
|
||||
if not ids_final:
|
||||
raise wizard.except_wizard(_('No Data Available'), _('No records found for your selection!'))
|
||||
return data['form']
|
||||
|
||||
class wizard_print_journal(wizard.interface):
|
||||
states = {
|
||||
@@ -42,7 +60,7 @@ class wizard_print_journal(wizard.interface):
|
||||
'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('print', 'Print'))},
|
||||
},
|
||||
'print': {
|
||||
'actions': [],
|
||||
'actions': [_check_data],
|
||||
'result': {'type':'print', 'report':'account.general.journal.wiz', 'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -43,6 +43,25 @@ fields = {
|
||||
|
||||
}
|
||||
|
||||
def _check_data(self, cr, uid, data, *args):
|
||||
period_id = data['form']['period_id'][0][2]
|
||||
journal_id=data['form']['journal_id'][0][2]
|
||||
|
||||
if type(period_id)==type([]):
|
||||
|
||||
ids_final = []
|
||||
|
||||
for journal in journal_id:
|
||||
for period in period_id:
|
||||
ids_journal_period = pooler.get_pool(cr.dbname).get('account.journal.period').search(cr,uid, [('journal_id','=',journal),('period_id','=',period)])
|
||||
|
||||
if ids_journal_period:
|
||||
ids_final.append(ids_journal_period)
|
||||
|
||||
if not ids_final:
|
||||
raise wizard.except_wizard(_('No Data Available'), _('No records found for your selection!'))
|
||||
return data['form']
|
||||
|
||||
class wizard_print_journal(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
@@ -50,7 +69,7 @@ class wizard_print_journal(wizard.interface):
|
||||
'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('print', 'Print'))},
|
||||
},
|
||||
'print': {
|
||||
'actions': [],
|
||||
'actions': [_check_data],
|
||||
'result': {'type':'print', 'report':'account.journal.period.print.wiz', 'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
+1
-1
@@ -327,7 +327,7 @@ class crm_case(osv.osv):
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'name': fields.char('Description',size=64, required=True),
|
||||
'name': fields.char('Description',size=64),
|
||||
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'active': fields.boolean('Active'),
|
||||
'description': fields.text('Your action'),
|
||||
|
||||
@@ -20,8 +20,14 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import datetime
|
||||
import mx.DateTime
|
||||
|
||||
import pooler
|
||||
from osv import fields,osv
|
||||
|
||||
|
||||
def _code_get(self, cr, uid, context={}):
|
||||
acc_type_obj = self.pool.get('account.account.type')
|
||||
ids = acc_type_obj.search(cr, uid, [])
|
||||
@@ -41,6 +47,7 @@ class report_account_receivable(osv.osv):
|
||||
'credit':fields.float('Credit', readonly=True),
|
||||
}
|
||||
_order = 'name desc'
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_account_receivable as (
|
||||
@@ -63,7 +70,85 @@ class report_account_receivable(osv.osv):
|
||||
report_account_receivable()
|
||||
|
||||
#a.type in ('receivable','payable')
|
||||
|
||||
class temp_range(osv.osv):
|
||||
_name = 'temp.range'
|
||||
_description = 'A Temporary table used for Dashboard view'
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Range',size=64)
|
||||
}
|
||||
|
||||
temp_range()
|
||||
|
||||
class report_aged_receivable(osv.osv):
|
||||
_name = "report.aged.receivable"
|
||||
_description = "Aged Receivable Till Today"
|
||||
_auto = False
|
||||
|
||||
def __init__(self, pool, cr):
|
||||
super(report_aged_receivable, self).__init__(pool, cr)
|
||||
self.called = False
|
||||
|
||||
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False):
|
||||
""" To call the init() method timely
|
||||
"""
|
||||
if not self.called:
|
||||
self.init(cr, user)
|
||||
self.called = True # To make sure that init doesn't get called multiple times
|
||||
|
||||
res = super(report_aged_receivable, self).fields_view_get(cr, user, view_id, view_type, context, toolbar)
|
||||
return res
|
||||
|
||||
def _calc_bal(self, cr, uid, ids, name, args, context):
|
||||
res = {}
|
||||
for period in self.read(cr,uid,ids,['name']):
|
||||
date1,date2 = period['name'].split(' to ')
|
||||
se = "SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
|
||||
WHERE (line.account_id=ac.id) AND ac.type='receivable' \
|
||||
AND (COALESCE(line.date,date) BETWEEN '%s' AND '%s') \
|
||||
AND (reconcile_id IS NULL) AND ac.active"%(str(date2),str(date1))
|
||||
cr.execute(se)
|
||||
amount = cr.fetchone()
|
||||
amount = amount[0] or 0.00
|
||||
res[period['id']] = amount
|
||||
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Month Range', size=7, readonly=True),
|
||||
'balance': fields.function(_calc_bal, method=True, string='Balance', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr, uid=1):
|
||||
""" This view will be used in dashboard
|
||||
"""
|
||||
# ranges = _get_ranges(cr) # Gets the ranges for the x axis of the graph (name column values)
|
||||
pool_obj_fy = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
today = mx.DateTime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') - mx.DateTime.RelativeDateTime(days=1)
|
||||
today = today.strftime('%Y-%m-%d')
|
||||
fy_id = pool_obj_fy.find(cr,uid)
|
||||
LIST_RANGES = []
|
||||
if fy_id:
|
||||
fy_start_date = pool_obj_fy.read(cr, uid, fy_id, ['date_start'])['date_start']
|
||||
fy_start_date = mx.DateTime.strptime(fy_start_date, '%Y-%m-%d')
|
||||
last_month = mx.DateTime.strptime(today, '%Y-%m-%d') - mx.DateTime.RelativeDateTime(months=1)
|
||||
|
||||
while (last_month > fy_start_date):
|
||||
LIST_RANGES.append(today + " to " + last_month.strftime('%Y-%m-%d'))
|
||||
today = last_month.strftime('%Y-%m-%d')
|
||||
last_month = mx.DateTime.strptime(today, '%Y-%m-%d') - mx.DateTime.RelativeDateTime(months=1)
|
||||
|
||||
LIST_RANGES.append(today +" to " + fy_start_date.strftime('%Y-%m-%d'))
|
||||
cr.execute('delete from temp_range')
|
||||
for range in LIST_RANGES:
|
||||
pooler.get_pool(cr.dbname).get('temp.range').create(cr, uid, {'name':range})
|
||||
|
||||
cr.execute("""
|
||||
create or replace view report_aged_receivable as (
|
||||
select id,name from temp_range
|
||||
)""")
|
||||
|
||||
report_aged_receivable()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -49,5 +49,37 @@
|
||||
</record>
|
||||
<menuitem action="action_account_receivable_graph" id="menu_account_receivable_graph" parent="account.menu_finance_reporting"/>
|
||||
|
||||
<!-- Report for Aged Receivable -->
|
||||
|
||||
<record id="view_aged_recv_graph" model="ir.ui.view">
|
||||
<field name="name">report.aged.receivable.graph</field>
|
||||
<field name="model">report.aged.receivable</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Aged Receivable" type="bar">
|
||||
<field name="name"/>
|
||||
<field name="balance" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_aged_recv_tree" model="ir.ui.view">
|
||||
<field name="name">report.aged.receivable.tree</field>
|
||||
<field name="model">report.aged.receivable</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Aged Receivable">
|
||||
<field name="name"/>
|
||||
<field name="balance"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_aged_receivable_graph" model="ir.actions.act_window">
|
||||
<field name="name">Aged Receivable</field>
|
||||
<field name="res_model">report.aged.receivable</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -94,6 +94,7 @@ class report_timesheet_account_date(osv.osv):
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
}
|
||||
_order = 'name desc,account_id desc,user_id desc'
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_timesheet_account_date as (
|
||||
@@ -152,5 +153,46 @@ class report_timesheet_invoice(osv.osv):
|
||||
""")
|
||||
report_timesheet_invoice()
|
||||
|
||||
class report_random_timsheet(osv.osv):
|
||||
_name = "report.random.timesheet"
|
||||
_description = "Random Timesheet Report"
|
||||
_auto = False
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=64, readonly=True),
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True),
|
||||
'quantity' : fields.float('Quantity', readonly=True),
|
||||
'product_id' : fields.many2one('product.product','Product', readonly=True),
|
||||
'amount' : fields.float('Amount', readonly=True),
|
||||
'uom_id' : fields.many2one('product.uom','UOM', readonly=True)
|
||||
}
|
||||
_order = "date desc"
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute("""create or replace view report_random_timesheet as (
|
||||
|
||||
select line.id as id, line.name as name, line.date as date,
|
||||
act.id as analytic_account_id, line.unit_amount as quantity,
|
||||
prod.id as product_id, line.amount as amount, uom_uom.id as uom_id
|
||||
|
||||
from account_analytic_line line
|
||||
|
||||
left join account_analytic_account act on (line.account_id = act.id)
|
||||
left join hr_employee emp on (line.user_id = emp.id)
|
||||
left join hr_department dept on (dept.manager_id = emp.parent_id)
|
||||
left join hr_department_user_rel dept_user on (line.user_id = dept_user.user_id)
|
||||
left join product_template prod on (line.product_id = prod.id)
|
||||
left join product_uom uom_uom on (line.product_uom_id = uom_uom.id)
|
||||
|
||||
where (line.date < CURRENT_DATE AND line.date >= (CURRENT_DATE-3))
|
||||
|
||||
ORDER BY line.name LIMIT 10
|
||||
)
|
||||
""")
|
||||
|
||||
report_random_timsheet()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -278,5 +278,33 @@
|
||||
|
||||
<act_window domain="[('manager_id', '=', active_id)]" id="act_res_users_2_report_timesheet_invoice" name="Costs to invoice" res_model="report_timesheet.invoice" src_model="res.users"/>
|
||||
|
||||
|
||||
<!-- Random Timesheet -->
|
||||
|
||||
<record model="ir.ui.view" id="view_random_timesheet_tree">
|
||||
<field name="name">report.random.timesheet.tree</field>
|
||||
<field name="model">report.random.timesheet</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Random Timesheets">
|
||||
<field name="analytic_account_id" />
|
||||
<field name="name" />
|
||||
<field name="quantity" />
|
||||
<field name="product_id" />
|
||||
<field name="amount" />
|
||||
<field name="uom_id" />
|
||||
<field name="date" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_random_timesheet_board">
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="name">Random Timesheet</field>
|
||||
<field name="res_model">report.random.timesheet</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_random_timesheet_tree"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user