Accounting board
bzr revid: pinky-3012f9f7496ad67e41980d4d7e7b9014b4a79ec3
This commit is contained in:
parent
e0707d560b
commit
0f70f78093
|
@ -3,7 +3,7 @@
|
||||||
"version":"1.0",
|
"version":"1.0",
|
||||||
"author":"Tiny",
|
"author":"Tiny",
|
||||||
"category":"Board",
|
"category":"Board",
|
||||||
"depends":["account","hr_timesheet_invoice","board"],
|
"depends":["account","hr_timesheet_invoice","board","report_account","report_analytic","report_analytic_line"],
|
||||||
"demo_xml":[],
|
"demo_xml":[],
|
||||||
"update_xml":["board_account_view.xml"],
|
"update_xml":["board_account_view.xml"],
|
||||||
"active":False,
|
"active":False,
|
||||||
|
|
|
@ -6,82 +6,58 @@
|
||||||
<field name="name">Accountants</field>
|
<field name="name">Accountants</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.ui.view" id="view_task_tree">
|
|
||||||
<field name="name">project.task.tree</field>
|
<record model="ir.actions.act_window" id="action_account_analytic_line_to_invoice">
|
||||||
<field name="model">project.task</field>
|
<field name="name">report.account.analytic.line.tree</field>
|
||||||
<field name="type">tree</field>
|
<field name="res_model">report.account.analytic.line.to.invoice</field>
|
||||||
<field name="priority" eval="99"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<tree string="My tasks" colors="red:date_deadline<current_date;blue:date_deadline==current_date">
|
|
||||||
<field name="name"/>
|
|
||||||
<field name="project_id"/>
|
|
||||||
<field name="date_deadline"/>
|
|
||||||
<field name="planned_hours"/>
|
|
||||||
<field name="effective_hours"/>
|
|
||||||
<field name="priority"/>
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
<record model="ir.actions.act_window" id="action_view_task_tree">
|
|
||||||
<field name="name">My open tasks</field>
|
|
||||||
<field name="res_model">project.task</field>
|
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree,graph</field>
|
<field name="view_mode">graph,tree</field>
|
||||||
<field name="domain">[('user_id','=',uid),('state','=','open')]</field>
|
|
||||||
<field name="view_id" ref="view_task_tree" />
|
|
||||||
</record>
|
|
||||||
<record model="ir.actions.act_window" id="action_view_task_tree_deadline">
|
|
||||||
<field name="name">My task's deadlines</field>
|
|
||||||
<field name="res_model">project.task</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,graph</field>
|
|
||||||
<field name="domain">[('user_id','=',uid),('state','=','open'),('date_deadline','<>',False)]</field>
|
|
||||||
<field name="view_id" ref="view_task_tree" />
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.actions.act_window" id="action_view_board_note_tree">
|
<record model="ir.actions.act_window" id="action_aged_receivable">
|
||||||
<field name="name">Public notes</field>
|
<field name="name">report.account.receivable.graph</field>
|
||||||
<field name="res_model">board.note</field>
|
<field name="res_model">report.account.receivable</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">graph,tree</field>
|
||||||
<field name="domain">[('type','=','Project')]</field>
|
<field name="domain">[('type','=','receivable')]</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window" id="action_aged_income">
|
||||||
|
<field name="name">report.account.income.graph</field>
|
||||||
|
<field name="res_model">report.account.receivable</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">graph,tree</field>
|
||||||
|
<field name="domain">[('type','=','income')]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.ui.view" id="board_project_form">
|
|
||||||
<field name="name">board.project.form</field>
|
<record model="ir.ui.view" id="board_account_form">
|
||||||
|
<field name="name">board.account.form</field>
|
||||||
<field name="model">board.board</field>
|
<field name="model">board.board</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Project">
|
<form string="Account Board">
|
||||||
<hpaned>
|
<hpaned>
|
||||||
|
|
||||||
<child1>
|
<child1>
|
||||||
|
|
||||||
<action
|
<action
|
||||||
string="My open tasks"
|
string="Analytic accounts to close"
|
||||||
name="%(action_view_task_tree)d"
|
name="%(report_analytic.action_analytic_account_tree)d"
|
||||||
colspan="4"
|
colspan="4"
|
||||||
height="220"
|
height="160"
|
||||||
width="510"/>
|
width="510"/>
|
||||||
|
|
||||||
<action
|
<action
|
||||||
string="My deadlines"
|
string="Uninvoiced quotations"
|
||||||
name="%(action_view_task_tree_deadline)d"
|
name="%(sale.action_order_tree3)d"
|
||||||
height="150"
|
height="160"
|
||||||
colspan="4"/>
|
colspan="4"/>
|
||||||
|
|
||||||
<action
|
<action
|
||||||
string="Public notes"
|
string="Draft invoices"
|
||||||
name="%(action_view_board_note_tree)d"
|
name="%(account.action_invoice_tree5)d"
|
||||||
colspan="2"
|
colspan="4"
|
||||||
height="150"/>
|
height="160"/>
|
||||||
<action
|
|
||||||
string="Public notes"
|
|
||||||
name="%(action_view_board_note_tree)d"
|
|
||||||
colspan="2"
|
|
||||||
height="150"/>
|
|
||||||
|
|
||||||
|
|
||||||
</child1>
|
</child1>
|
||||||
|
|
||||||
<child2>
|
<child2>
|
||||||
|
@ -93,15 +69,22 @@
|
||||||
colspan="4"/>
|
colspan="4"/>
|
||||||
|
|
||||||
<action
|
<action
|
||||||
string="My timesheet"
|
string="Costs to invoice"
|
||||||
name="%(report_timesheet.action_timesheet_user_stat)d"
|
name="%(action_account_analytic_line_to_invoice)d"
|
||||||
|
height="220"
|
||||||
colspan="4"/>
|
colspan="4"/>
|
||||||
|
|
||||||
<action
|
<action
|
||||||
string="My work"
|
string="Aged receivables"
|
||||||
name="%(report_analytic_line.action_account_analytic_planning_stat_my_form)d"
|
name="%(action_aged_receivable)d"
|
||||||
|
height="220"
|
||||||
colspan="4"/>
|
colspan="4"/>
|
||||||
|
|
||||||
|
<action
|
||||||
|
string="Aged income"
|
||||||
|
name="%(action_aged_income)d"
|
||||||
|
height="220"
|
||||||
|
colspan="4"/>
|
||||||
|
|
||||||
</child2>
|
</child2>
|
||||||
</hpaned>
|
</hpaned>
|
||||||
|
@ -109,19 +92,19 @@
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.actions.act_window" id="open_board_sales_manager">
|
<record model="ir.actions.act_window" id="open_board_account">
|
||||||
<field name="name">Dashboard project member</field>
|
<field name="name">Dashboard accountant</field>
|
||||||
<field name="res_model">board.board</field>
|
<field name="res_model">board.board</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
<field name="usage">menu</field>
|
<field name="usage">menu</field>
|
||||||
<field name="view_id" ref="board_project_form"/>
|
<field name="view_id" ref="board_account_form"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
name="Dashboards/Project member"
|
name="Dashboards/Accountant"
|
||||||
action="open_board_sales_manager"
|
action="open_board_account"
|
||||||
sequence="1"
|
sequence="1"
|
||||||
id="menu_board_sales_manager"/>
|
id="menu_board_account"/>
|
||||||
</data>
|
</data>
|
||||||
</terp>
|
</terp>
|
||||||
|
|
|
@ -27,4 +27,4 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import report_account
|
import report_receivable
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"description": "A module that adds new reports based on the account module.",
|
"description": "A module that adds new reports based on the account module.",
|
||||||
"init_xml" : [],
|
"init_xml" : [],
|
||||||
"demo_xml" : [],
|
"demo_xml" : [],
|
||||||
"update_xml" : ["report_account_view.xml"],
|
"update_xml" : ["report_receivable_view.xml"],
|
||||||
"active": False,
|
"active": False,
|
||||||
"installable": True
|
"installable": True
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,40 +29,45 @@
|
||||||
|
|
||||||
from osv import fields,osv
|
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, [])
|
||||||
|
res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
|
||||||
|
return [(r['code'], r['name']) for r in res]
|
||||||
|
|
||||||
|
|
||||||
class report_account_receivable(osv.osv):
|
class report_account_receivable(osv.osv):
|
||||||
_name = "report.account.receivable"
|
_name = "report.account.receivable"
|
||||||
_description = "Receivable accounts"
|
_description = "Receivable accounts"
|
||||||
_auto = False
|
_auto = False
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.date('Month', readonly=True),
|
'name': fields.char('Week of Year', size=7, readonly=True),
|
||||||
'user_id':fields.many2one('res.users', 'User', readonly=True, relate=True),
|
'type': fields.selection(_code_get, 'Account Type', required=True),
|
||||||
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True, relate=True),
|
'balance':fields.float('Balance', readonly=True),
|
||||||
'amount_revenue': fields.float('Est.Revenue', readonly=True),
|
'debit':fields.float('Debit', readonly=True),
|
||||||
'amount_costs': fields.float('Est.Cost', readonly=True),
|
'credit':fields.float('Credit', readonly=True),
|
||||||
'amount_revenue_prob': fields.float('Est. Rev*Prob.', readonly=True),
|
|
||||||
'nbr': fields.integer('# of Cases', readonly=True),
|
|
||||||
'probability': fields.float('Avg. Probability', readonly=True),
|
|
||||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
|
|
||||||
'delay_close': fields.integer('Delay to close', readonly=True),
|
|
||||||
}
|
}
|
||||||
_order = 'name desc, user_id, section_id'
|
_order = 'name desc'
|
||||||
def init(self, cr):
|
def init(self, cr):
|
||||||
cr.execute("""
|
cr.execute("""
|
||||||
create or replace view report_crm_case_user as (
|
create or replace view report_account_receivable as (
|
||||||
select
|
select
|
||||||
min(c.id) as id,
|
min(l.id) as id,
|
||||||
substring(c.create_date for 7)||'-01' as name,
|
to_char(date,'YYYY:IW') as name,
|
||||||
c.state,
|
sum(l.debit-l.credit) as balance,
|
||||||
c.user_id,
|
sum(l.debit) as debit,
|
||||||
c.section_id,
|
sum(l.credit) as credit,
|
||||||
count(*) as nbr,
|
a.type
|
||||||
sum(planned_revenue) as amount_revenue,
|
|
||||||
sum(planned_cost) as amount_costs,
|
|
||||||
sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob,
|
|
||||||
avg(probability)::decimal(16,2) as probability,
|
|
||||||
to_char(avg(date_closed-c.create_date), 'DD"d" HH12:MI:SS') as delay_close
|
|
||||||
from
|
from
|
||||||
crm_case c
|
account_move_line l
|
||||||
group by substring(c.create_date for 7), c.state, c.user_id, c.section_id
|
left join
|
||||||
|
account_account a on (l.account_id=a.id)
|
||||||
|
where
|
||||||
|
l.state <> 'draft'
|
||||||
|
group by
|
||||||
|
to_char(date,'YYYY:IW'), a.type
|
||||||
)""")
|
)""")
|
||||||
report_crm_case_user()
|
report_account_receivable()
|
||||||
|
|
||||||
|
#a.type in ('receivable','payable')
|
||||||
|
|
||||||
|
|
|
@ -3,64 +3,57 @@
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cases by user and section
|
# Balance by account type
|
||||||
#
|
#
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_crm_case_user_graph">
|
||||||
|
<field name="name">report.account.receivable.graph</field>
|
||||||
|
<field name="model">report.account.receivable</field>
|
||||||
|
<field name="type">graph</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<graph string="Accounts by type" type="bar">
|
||||||
|
<field name="name" group="True"/>
|
||||||
|
<field name="balance" operator="+"/>
|
||||||
|
</graph>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
<record model="ir.ui.view" id="view_crm_case_user_tree">
|
<record model="ir.ui.view" id="view_crm_case_user_tree">
|
||||||
<field name="name">report.crm.case.user.tree</field>
|
<field name="name">report.account.receivable.tree</field>
|
||||||
<field name="model">report.crm.case.user</field>
|
<field name="model">report.account.receivable</field>
|
||||||
<field name="type">tree</field>
|
<field name="type">tree</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Cases by User and Section">
|
<tree string="Accounts by type">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="user_id"/>
|
<field name="type"/>
|
||||||
<field name="section_id"/>
|
<field name="balance"/>
|
||||||
<field name="nbr"/>
|
<field name="credit"/>
|
||||||
<field name="delay_close"/>
|
<field name="debit"/>
|
||||||
<field name="amount_revenue"/>
|
|
||||||
<field name="amount_costs"/>
|
|
||||||
<field name="amount_revenue_prob"/>
|
|
||||||
<field name="probability"/>
|
|
||||||
<field name="state"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.ui.view" id="view_crm_case_user_form">
|
<record model="ir.ui.view" id="view_crm_case_user_form">
|
||||||
<field name="name">report.crm.case.user.form</field>
|
<field name="name">report.account.receivable.form</field>
|
||||||
<field name="model">report.crm.case.user</field>
|
<field name="model">report.account.receivable</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Cases by User and Section">
|
<form string="Accounts by type">
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="user_id" select="1"/>
|
<field name="type" select="1"/>
|
||||||
<field name="section_id" select="1"/>
|
|
||||||
<field name="nbr" select="1"/>
|
|
||||||
<field name="state" select="1"/>
|
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.ui.view" id="view_crm_case_user_graph">
|
<record model="ir.actions.act_window" id="action_account_receivable_graph">
|
||||||
<field name="name">report.crm.case.user.graph</field>
|
<field name="name">report.account.receivable.graph</field>
|
||||||
<field name="model">report.crm.case.user</field>
|
<field name="res_model">report.account.receivable</field>
|
||||||
<field name="type">graph</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<graph string="Cases by User and Section" type="bar">
|
|
||||||
<field name="user_id" group="True"/>
|
|
||||||
<field name="nbr" operator="+"/>
|
|
||||||
</graph>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
|
|
||||||
<record model="ir.actions.act_window" id="action_report_crm_case_user_tree_month">
|
|
||||||
<field name="name">report.crm.case.user.tree</field>
|
|
||||||
<field name="res_model">report.crm.case.user</field>
|
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree,graph</field>
|
<field name="view_mode">tree,graph</field>
|
||||||
<field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
|
<!-- <field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field> -->
|
||||||
</record>
|
</record>
|
||||||
<menuitem name="CRM & SRM/Reporting/This Month/Cases by user and section" action="action_report_crm_case_user_tree_month" id="menu_crm_case_user_tree_month"/>
|
<menuitem
|
||||||
|
name="Financial Management/Reporting/This Month/Balance by type of account"
|
||||||
|
action="action_account_receivable_graph"
|
||||||
|
id="menu_account_receivable_graph"/>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</terp>
|
</terp>
|
||||||
|
|
|
@ -35,6 +35,7 @@ class report_analytic_account_close(osv.osv):
|
||||||
_auto = False
|
_auto = False
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.many2one('account.analytic.account', 'Analytic account', readonly=True),
|
'name': fields.many2one('account.analytic.account', 'Analytic account', readonly=True),
|
||||||
|
'state': fields.char('State', size=32, readonly=True),
|
||||||
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
|
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
|
||||||
'quantity': fields.float('Quantity', readonly=True),
|
'quantity': fields.float('Quantity', readonly=True),
|
||||||
'quantity_max': fields.float('Max. Quantity', readonly=True),
|
'quantity_max': fields.float('Max. Quantity', readonly=True),
|
||||||
|
@ -47,6 +48,7 @@ class report_analytic_account_close(osv.osv):
|
||||||
select
|
select
|
||||||
a.id as id,
|
a.id as id,
|
||||||
a.id as name,
|
a.id as name,
|
||||||
|
a.state as state,
|
||||||
sum(l.unit_amount) as quantity,
|
sum(l.unit_amount) as quantity,
|
||||||
sum(l.amount) as balance,
|
sum(l.amount) as balance,
|
||||||
a.partner_id as partner_id,
|
a.partner_id as partner_id,
|
||||||
|
@ -57,7 +59,7 @@ class report_analytic_account_close(osv.osv):
|
||||||
right join
|
right join
|
||||||
account_analytic_account a on (l.account_id=a.id)
|
account_analytic_account a on (l.account_id=a.id)
|
||||||
group by
|
group by
|
||||||
a.id,a.quantity_max,a.date,a.partner_id
|
a.id,a.state, a.quantity_max,a.date,a.partner_id
|
||||||
having
|
having
|
||||||
(a.quantity_max>0 and (sum(l.unit_amount)>=a.quantity_max)) or
|
(a.quantity_max>0 and (sum(l.unit_amount)>=a.quantity_max)) or
|
||||||
a.date <= current_date
|
a.date <= current_date
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="partner_id" select="1"/>
|
<field name="partner_id" select="1"/>
|
||||||
<field name="quantity" select="1"/>
|
<field name="quantity" select="1"/>
|
||||||
|
<field name="state" select="1"/>
|
||||||
<field name="quantity_max"/>
|
<field name="quantity_max"/>
|
||||||
<field name="date_deadline" select="1"/>
|
<field name="date_deadline" select="1"/>
|
||||||
<field name="balance" select="1"/>
|
<field name="balance" select="1"/>
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
<tree string="Expirated analytic accounts">
|
<tree string="Expirated analytic accounts">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="partner_id"/>
|
<field name="partner_id"/>
|
||||||
|
<field name="state"/>
|
||||||
<field name="quantity"/>
|
<field name="quantity"/>
|
||||||
<field name="quantity_max"/>
|
<field name="quantity_max"/>
|
||||||
<field name="date_deadline"/>
|
<field name="date_deadline"/>
|
||||||
|
@ -57,6 +59,7 @@
|
||||||
<field name="res_model">report.analytic.account.close</field>
|
<field name="res_model">report.analytic.account.close</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree,graph</field>
|
<field name="view_mode">tree,graph</field>
|
||||||
|
<field name="domain">[('state','=','open')]</field>
|
||||||
</record>
|
</record>
|
||||||
<menuitem name="Financial Management/Reporting/All Months/Analytic accounts to close"
|
<menuitem name="Financial Management/Reporting/All Months/Analytic accounts to close"
|
||||||
action="action_analytic_account_tree"
|
action="action_analytic_account_tree"
|
||||||
|
|
|
@ -30,33 +30,42 @@
|
||||||
from osv import fields,osv
|
from osv import fields,osv
|
||||||
|
|
||||||
class report_account_analytic_line_to_invoice(osv.osv):
|
class report_account_analytic_line_to_invoice(osv.osv):
|
||||||
_name = "report.account.analytic.line.to.invoice"
|
_name = "report.account.analytic.line.to.invoice"
|
||||||
_description = "Analytic lines to invoice report"
|
_description = "Analytic lines to invoice report"
|
||||||
_auto = False
|
_auto = False
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.date('Month', readonly=True),
|
'name': fields.date('Month', readonly=True),
|
||||||
'product_id':fields.many2one('product.product', 'Product', readonly=True, relate=True),
|
'product_id':fields.many2one('product.product', 'Product', readonly=True, relate=True),
|
||||||
'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True, relate=True),
|
'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True, relate=True),
|
||||||
'product_uom_id':fields.many2one('product.uom', 'UoM', readonly=True),
|
'product_uom_id':fields.many2one('product.uom', 'UoM', readonly=True),
|
||||||
'unit_amount': fields.float('Units', readonly=True),
|
'unit_amount': fields.float('Units', readonly=True),
|
||||||
'amount': fields.float('Amount', readonly=True),
|
'sale_price': fields.float('Sale price', readonly=True),
|
||||||
}
|
'amount': fields.float('Amount', readonly=True),
|
||||||
_order = 'name desc, product_id asc, account_id asc'
|
}
|
||||||
|
_order = 'name desc, product_id asc, account_id asc'
|
||||||
|
|
||||||
def init(self, cr):
|
def init(self, cr):
|
||||||
cr.execute("""
|
cr.execute("""
|
||||||
CREATE OR REPLACE VIEW report_account_analytic_line_to_invoice AS (
|
CREATE OR REPLACE VIEW report_account_analytic_line_to_invoice AS (
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT(SUBSTRING(date for 7))||'-'||'01' AS name,
|
DISTINCT(SUBSTRING(l.date for 7))||'-'||'01' AS name,
|
||||||
MIN(id) AS id,
|
MIN(l.id) AS id,
|
||||||
product_id,
|
l.product_id,
|
||||||
account_id,
|
l.account_id,
|
||||||
SUM(amount) AS amount,
|
SUM(l.amount) AS amount,
|
||||||
SUM(unit_amount) AS unit_amount,
|
SUM(l.unit_amount*t.list_price) AS sale_price,
|
||||||
product_uom_id
|
SUM(l.unit_amount) AS unit_amount,
|
||||||
FROM account_analytic_line
|
l.product_uom_id
|
||||||
WHERE (invoice_id IS NULL) and (to_invoice IS NOT NULL)
|
FROM
|
||||||
GROUP BY SUBSTRING(date for 7), product_id, product_uom_id, account_id
|
account_analytic_line l
|
||||||
)
|
left join
|
||||||
""")
|
product_product p on (l.product_id=p.id)
|
||||||
#report_account_analytic_line_to_invoice()
|
left join
|
||||||
|
product_template t on (p.product_tmpl_id=t.id)
|
||||||
|
WHERE
|
||||||
|
(invoice_id IS NULL) and (to_invoice IS NOT NULL)
|
||||||
|
GROUP BY
|
||||||
|
SUBSTRING(date for 7), product_id, product_uom_id, account_id
|
||||||
|
)
|
||||||
|
""")
|
||||||
|
report_account_analytic_line_to_invoice()
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<field name="model">report.account.analytic.line.to.invoice</field>
|
<field name="model">report.account.analytic.line.to.invoice</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Analytic lines to invoice per month, product and analytic account">
|
<tree string="Costs to invoice">
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="account_id" select="1"/>
|
<field name="account_id" select="1"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
@ -25,22 +25,36 @@
|
||||||
<field name="model">report.account.analytic.line.to.invoice</field>
|
<field name="model">report.account.analytic.line.to.invoice</field>
|
||||||
<field name="type">tree</field>
|
<field name="type">tree</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Analytic lines to invoice per month, product and analytic account">
|
<tree string="Costs to invoice">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="product_id"/>
|
<field name="product_id"/>
|
||||||
<field name="account_id"/>
|
<field name="account_id"/>
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
|
<field name="sale_price"/>
|
||||||
<field name="unit_amount"/>
|
<field name="unit_amount"/>
|
||||||
<field name="product_uom_id"/>
|
<field name="product_uom_id"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_line_to_invoice_view_graph">
|
||||||
|
<field name="name">report.account.analytic.line.to.invoice.graph</field>
|
||||||
|
<field name="model">report.account.analytic.line.to.invoice</field>
|
||||||
|
<field name="type">graph</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<graph type="bar" string="Costs to invoice">
|
||||||
|
<field name="name" group="True"/>
|
||||||
|
<field name="sale_price" operator="+"/>
|
||||||
|
</graph>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<record model="ir.actions.act_window" id="action_account_analytic_line_to_invoice">
|
<record model="ir.actions.act_window" id="action_account_analytic_line_to_invoice">
|
||||||
<field name="name">report.account.analytic.line.tree</field>
|
<field name="name">report.account.analytic.line.tree</field>
|
||||||
<field name="res_model">report.account.analytic.line.to.invoice</field>
|
<field name="res_model">report.account.analytic.line.to.invoice</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">tree,graph</field>
|
||||||
</record>
|
</record>
|
||||||
<menuitem name="Financial Management/Entries/Analytic lines to invoice" id="account_analytic_lines_to_invoice_report" action="action_account_analytic_line_to_invoice" />
|
<menuitem name="Financial Management/Entries/Analytic lines to invoice" id="account_analytic_lines_to_invoice_report" action="action_account_analytic_line_to_invoice" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue