"version":"1.0",
"author":"Tiny",
"category":"Board",
- "depends":["account","hr_timesheet_invoice","board"],
+ "depends":["account","hr_timesheet_invoice","board","report_account","report_analytic","report_analytic_line"],
"demo_xml":[],
"update_xml":["board_account_view.xml"],
"active":False,
<field name="name">Accountants</field>
</record>
- <record model="ir.ui.view" id="view_task_tree">
- <field name="name">project.task.tree</field>
- <field name="model">project.task</field>
- <field name="type">tree</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>
+
+ <record model="ir.actions.act_window" id="action_account_analytic_line_to_invoice">
+ <field name="name">report.account.analytic.line.tree</field>
+ <field name="res_model">report.account.analytic.line.to.invoice</field>
<field name="view_type">form</field>
- <field name="view_mode">tree,graph</field>
- <field name="domain">[('user_id','=',uid),('state','=','open')]</field>
- <field name="view_id" ref="view_task_tree" />
+ <field name="view_mode">graph,tree</field>
</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>
+
+ <record model="ir.actions.act_window" id="action_aged_receivable">
+ <field name="name">report.account.receivable.graph</field>
+ <field name="res_model">report.account.receivable</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" />
+ <field name="view_mode">graph,tree</field>
+ <field name="domain">[('type','=','receivable')]</field>
</record>
-
- <record model="ir.actions.act_window" id="action_view_board_note_tree">
- <field name="name">Public notes</field>
- <field name="res_model">board.note</field>
+ <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">tree</field>
- <field name="domain">[('type','=','Project')]</field>
+ <field name="view_mode">graph,tree</field>
+ <field name="domain">[('type','=','income')]</field>
</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="type">form</field>
<field name="arch" type="xml">
- <form string="Project">
+ <form string="Account Board">
<hpaned>
<child1>
<action
- string="My open tasks"
- name="%(action_view_task_tree)d"
+ string="Analytic accounts to close"
+ name="%(report_analytic.action_analytic_account_tree)d"
colspan="4"
- height="220"
+ height="160"
width="510"/>
<action
- string="My deadlines"
- name="%(action_view_task_tree_deadline)d"
- height="150"
+ string="Uninvoiced quotations"
+ name="%(sale.action_order_tree3)d"
+ height="160"
colspan="4"/>
<action
- string="Public notes"
- name="%(action_view_board_note_tree)d"
- colspan="2"
- height="150"/>
- <action
- string="Public notes"
- name="%(action_view_board_note_tree)d"
- colspan="2"
- height="150"/>
-
-
+ string="Draft invoices"
+ name="%(account.action_invoice_tree5)d"
+ colspan="4"
+ height="160"/>
</child1>
<child2>
colspan="4"/>
<action
- string="My timesheet"
- name="%(report_timesheet.action_timesheet_user_stat)d"
+ string="Costs to invoice"
+ name="%(action_account_analytic_line_to_invoice)d"
+ height="220"
colspan="4"/>
<action
- string="My work"
- name="%(report_analytic_line.action_account_analytic_planning_stat_my_form)d"
+ string="Aged receivables"
+ name="%(action_aged_receivable)d"
+ height="220"
colspan="4"/>
+ <action
+ string="Aged income"
+ name="%(action_aged_income)d"
+ height="220"
+ colspan="4"/>
</child2>
</hpaned>
</field>
</record>
- <record model="ir.actions.act_window" id="open_board_sales_manager">
- <field name="name">Dashboard project member</field>
+ <record model="ir.actions.act_window" id="open_board_account">
+ <field name="name">Dashboard accountant</field>
<field name="res_model">board.board</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="usage">menu</field>
- <field name="view_id" ref="board_project_form"/>
+ <field name="view_id" ref="board_account_form"/>
</record>
<menuitem
- name="Dashboards/Project member"
- action="open_board_sales_manager"
+ name="Dashboards/Accountant"
+ action="open_board_account"
sequence="1"
- id="menu_board_sales_manager"/>
+ id="menu_board_account"/>
</data>
</terp>
#
##############################################################################
-import report_account
+import report_receivable
"description": "A module that adds new reports based on the account module.",
"init_xml" : [],
"demo_xml" : [],
- "update_xml" : ["report_account_view.xml"],
+ "update_xml" : ["report_receivable_view.xml"],
"active": False,
"installable": True
}
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):
_name = "report.account.receivable"
_description = "Receivable accounts"
_auto = False
_columns = {
- 'name': fields.date('Month', readonly=True),
- 'user_id':fields.many2one('res.users', 'User', readonly=True, relate=True),
- 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True, relate=True),
- 'amount_revenue': fields.float('Est.Revenue', readonly=True),
- 'amount_costs': fields.float('Est.Cost', 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),
+ 'name': fields.char('Week of Year', size=7, readonly=True),
+ 'type': fields.selection(_code_get, 'Account Type', required=True),
+ 'balance':fields.float('Balance', readonly=True),
+ 'debit':fields.float('Debit', readonly=True),
+ 'credit':fields.float('Credit', readonly=True),
}
- _order = 'name desc, user_id, section_id'
+ _order = 'name desc'
def init(self, cr):
cr.execute("""
- create or replace view report_crm_case_user as (
+ create or replace view report_account_receivable as (
select
- min(c.id) as id,
- substring(c.create_date for 7)||'-01' as name,
- c.state,
- c.user_id,
- c.section_id,
- count(*) as nbr,
- 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
+ min(l.id) as id,
+ to_char(date,'YYYY:IW') as name,
+ sum(l.debit-l.credit) as balance,
+ sum(l.debit) as debit,
+ sum(l.credit) as credit,
+ a.type
from
- crm_case c
- group by substring(c.create_date for 7), c.state, c.user_id, c.section_id
+ account_move_line l
+ 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')
+
<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">
- <field name="name">report.crm.case.user.tree</field>
- <field name="model">report.crm.case.user</field>
+ <field name="name">report.account.receivable.tree</field>
+ <field name="model">report.account.receivable</field>
<field name="type">tree</field>
<field name="arch" type="xml">
- <tree string="Cases by User and Section">
+ <tree string="Accounts by type">
<field name="name"/>
- <field name="user_id"/>
- <field name="section_id"/>
- <field name="nbr"/>
- <field name="delay_close"/>
- <field name="amount_revenue"/>
- <field name="amount_costs"/>
- <field name="amount_revenue_prob"/>
- <field name="probability"/>
- <field name="state"/>
+ <field name="type"/>
+ <field name="balance"/>
+ <field name="credit"/>
+ <field name="debit"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_crm_case_user_form">
- <field name="name">report.crm.case.user.form</field>
- <field name="model">report.crm.case.user</field>
+ <field name="name">report.account.receivable.form</field>
+ <field name="model">report.account.receivable</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Cases by User and Section">
+ <form string="Accounts by type">
<field name="name" select="1"/>
- <field name="user_id" select="1"/>
- <field name="section_id" select="1"/>
- <field name="nbr" select="1"/>
- <field name="state" select="1"/>
+ <field name="type" select="1"/>
</form>
</field>
</record>
- <record model="ir.ui.view" id="view_crm_case_user_graph">
- <field name="name">report.crm.case.user.graph</field>
- <field name="model">report.crm.case.user</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>
+ <record model="ir.actions.act_window" id="action_account_receivable_graph">
+ <field name="name">report.account.receivable.graph</field>
+ <field name="res_model">report.account.receivable</field>
<field name="view_type">form</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>
- <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>
</terp>
_auto = False
_columns = {
'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),
'quantity': fields.float('Quantity', readonly=True),
'quantity_max': fields.float('Max. Quantity', readonly=True),
select
a.id as id,
a.id as name,
+ a.state as state,
sum(l.unit_amount) as quantity,
sum(l.amount) as balance,
a.partner_id as partner_id,
right join
account_analytic_account a on (l.account_id=a.id)
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
(a.quantity_max>0 and (sum(l.unit_amount)>=a.quantity_max)) or
a.date <= current_date
<field name="name" select="1"/>
<field name="partner_id" select="1"/>
<field name="quantity" select="1"/>
+ <field name="state" select="1"/>
<field name="quantity_max"/>
<field name="date_deadline" select="1"/>
<field name="balance" select="1"/>
<tree string="Expirated analytic accounts">
<field name="name"/>
<field name="partner_id"/>
+ <field name="state"/>
<field name="quantity"/>
<field name="quantity_max"/>
<field name="date_deadline"/>
<field name="res_model">report.analytic.account.close</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
+ <field name="domain">[('state','=','open')]</field>
</record>
<menuitem name="Financial Management/Reporting/All Months/Analytic accounts to close"
action="action_analytic_account_tree"
from osv import fields,osv
class report_account_analytic_line_to_invoice(osv.osv):
- _name = "report.account.analytic.line.to.invoice"
- _description = "Analytic lines to invoice report"
- _auto = False
- _columns = {
- 'name': fields.date('Month', readonly=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),
- 'product_uom_id':fields.many2one('product.uom', 'UoM', readonly=True),
- 'unit_amount': fields.float('Units', readonly=True),
- 'amount': fields.float('Amount', readonly=True),
- }
- _order = 'name desc, product_id asc, account_id asc'
+ _name = "report.account.analytic.line.to.invoice"
+ _description = "Analytic lines to invoice report"
+ _auto = False
+ _columns = {
+ 'name': fields.date('Month', readonly=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),
+ 'product_uom_id':fields.many2one('product.uom', 'UoM', readonly=True),
+ 'unit_amount': fields.float('Units', 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'
- def init(self, cr):
- cr.execute("""
- CREATE OR REPLACE VIEW report_account_analytic_line_to_invoice AS (
- SELECT
- DISTINCT(SUBSTRING(date for 7))||'-'||'01' AS name,
- MIN(id) AS id,
- product_id,
- account_id,
- SUM(amount) AS amount,
- SUM(unit_amount) AS unit_amount,
- product_uom_id
- FROM account_analytic_line
- 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()
+ def init(self, cr):
+ cr.execute("""
+ CREATE OR REPLACE VIEW report_account_analytic_line_to_invoice AS (
+ SELECT
+ DISTINCT(SUBSTRING(l.date for 7))||'-'||'01' AS name,
+ MIN(l.id) AS id,
+ l.product_id,
+ l.account_id,
+ SUM(l.amount) AS amount,
+ SUM(l.unit_amount*t.list_price) AS sale_price,
+ SUM(l.unit_amount) AS unit_amount,
+ l.product_uom_id
+ FROM
+ account_analytic_line l
+ left join
+ product_product p on (l.product_id=p.id)
+ 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()
<field name="model">report.account.analytic.line.to.invoice</field>
<field name="type">form</field>
<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="account_id" select="1"/>
<newline/>
<field name="model">report.account.analytic.line.to.invoice</field>
<field name="type">tree</field>
<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="product_id"/>
<field name="account_id"/>
<field name="amount"/>
+ <field name="sale_price"/>
<field name="unit_amount"/>
<field name="product_uom_id"/>
</tree>
</field>
</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">
<field name="name">report.account.analytic.line.tree</field>
<field name="res_model">report.account.analytic.line.to.invoice</field>
<field name="view_type">form</field>
- <field name="view_mode">tree</field>
+ <field name="view_mode">tree,graph</field>
</record>
<menuitem name="Financial Management/Entries/Analytic lines to invoice" id="account_analytic_lines_to_invoice_report" action="action_account_analytic_line_to_invoice" />