diff --git a/addons/sale_journal/__init__.py b/addons/sale_journal/__init__.py
index 4cb6588ed18..6f89ea7e4a2 100644
--- a/addons/sale_journal/__init__.py
+++ b/addons/sale_journal/__init__.py
@@ -20,8 +20,7 @@
##############################################################################
import sale_journal
-import sale_journal_inherit
-import sale_journal_report
-import sale_journal_picking_report
+import report
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale_journal/__openerp__.py b/addons/sale_journal/__openerp__.py
index b7c5f4fd512..94d343debb9 100644
--- a/addons/sale_journal/__openerp__.py
+++ b/addons/sale_journal/__openerp__.py
@@ -54,8 +54,7 @@
'update_xml': [
'security/ir.model.access.csv',
'sale_journal_view.xml',
- 'picking_journal_view.xml',
- 'picking_journal_view_report.xml'
+ 'report/sale_journal_report_view.xml',
],
'demo_xml': ['sale_journal_demo.xml'],
'installable': True,
diff --git a/addons/sale_journal/picking_journal_view.xml b/addons/sale_journal/picking_journal_view.xml
deleted file mode 100644
index 7d2d657b7de..00000000000
--- a/addons/sale_journal/picking_journal_view.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
- sale_journal.picking.journal.form
- sale_journal.picking.journal
- form
-
-
-
-
-
- sale_journal.picking.journal.tree
- sale_journal.picking.journal
- tree
-
-
-
-
-
-
-
-
-
-
-
-
- sale_journal.picking.journal.search
- sale_journal.picking.journal
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Picking journals
- sale_journal.picking.journal
- form
- tree,form
-
-
-
-
-
-
- Picking by invoice_method
- sale_journal.invoice.type.tree
- sale_journal.invoice.type
- ir.actions.act_window
- tree
-
-
-
-
-
-
-
- Picking to invoice
- stock.picking
- ir.actions.act_window
- form
- tree,form
- [('state','=','done'),('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]
-
-
- tree_but_open
- sale_journal.invoice.type
- Picking to invoice
-
-
-
-
-
-
diff --git a/addons/sale_journal/picking_journal_view_report.xml b/addons/sale_journal/picking_journal_view_report.xml
deleted file mode 100644
index d2940fa3d2b..00000000000
--- a/addons/sale_journal/picking_journal_view_report.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
- #
- # Pickings by invoice type
- #
-
-
- sale_journal.invoice.type.stats.form
- sale_journal.invoice.type.stats
- form
-
-
-
-
-
- sale_journal.invoice.type.stats.tree
- sale_journal.invoice.type.stats
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- sale_journal.invoice.type.stats.search
- sale_journal.invoice.type.stats
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Statistics on picking to invoice
- sale_journal.invoice.type.stats
- ir.actions.act_window
- form
- tree,form
- [('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]
-
-
-
-
-
-
-
-
- #
- # Packing by journal
- #
-
-
- sale_journal.picking.stats.form
- sale_journal.picking.stats
- form
-
-
-
-
-
- sale_journal.picking.stats.tree
- sale_journal.picking.stats
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
- sale_journal.picking.stats.search
- sale_journal.picking.stats
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/sale_journal/report/__init__.py b/addons/sale_journal/report/__init__.py
new file mode 100644
index 00000000000..0f9b6da35da
--- /dev/null
+++ b/addons/sale_journal/report/__init__.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import sale_journal_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/sale_journal/report/sale_journal_report.py b/addons/sale_journal/report/sale_journal_report.py
new file mode 100644
index 00000000000..0607f3be607
--- /dev/null
+++ b/addons/sale_journal/report/sale_journal_report.py
@@ -0,0 +1,141 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields, osv
+import tools
+
+class sale_journal_report(osv.osv):
+ _name = "sale.journal.report"
+ _description = "Sales Orders by Journal"
+ _auto = False
+ _columns = {
+ 'name': fields.char('Year', size=64, required=False, readonly=True),
+ 'month':fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'),
+ ('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), ('09', 'September'),
+ ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
+ 'state': fields.selection([
+ ('draft', 'Quotation'),
+ ('waiting_date', 'Waiting Schedule'),
+ ('manual', 'Manual in progress'),
+ ('progress', 'In progress'),
+ ('shipping_except', 'Shipping Exception'),
+ ('invoice_except', 'Invoice Exception'),
+ ('done', 'Done'),
+ ('cancel', 'Cancel')
+ ], 'Order State', readonly=True),
+ 'journal_id':fields.many2one('sale_journal.sale.journal', 'Journal', readonly=True),
+ 'quantity': fields.float('Quantities', readonly=True),
+ 'price_total': fields.float('Total Price', readonly=True),
+ 'price_average': fields.float('Average Price', readonly=True),
+ 'count': fields.integer('# of Lines', readonly=True),
+ }
+
+ _order = 'journal_id, name desc,price_total desc'
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'sale_journal_report')
+ cr.execute("""
+ create or replace view sale_journal_report as (
+ select
+ min(l.id) as id,
+ to_char(s.date_order, 'YYYY') as name,
+ to_char(s.date_order,'MM') as month,
+ s.state,
+ s.journal_id,
+ sum(l.product_uom_qty) as quantity,
+ count(*),
+ sum(l.product_uom_qty*l.price_unit) as price_total,
+ (sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average
+ from sale_order s
+ right join sale_order_line l on (s.id=l.order_id)
+ group by s.journal_id , to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'), s.state
+ )
+ """)
+
+sale_journal_report()
+
+#==========================================
+#picking report
+#==========================================
+
+
+class sale_journal_picking_report(osv.osv):
+ """
+ Picking list by journal and by invoice
+ """
+ _name = "sale.journal.picking.report"
+ _description = "Picking lists"
+ _auto = False
+ _columns = {
+ 'name': fields.char('Year', size=64, required=False, readonly=True),
+ 'month':fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'), ('05', 'May'), ('06', 'June'),
+ ('07', 'July'), ('08', 'August'), ('09', 'September'), ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
+
+ 'invoice_state':fields.selection([
+ ("invoiced", "invoiced"),
+ ("2binvoiced", "to be invoiced"),
+ ("none", "None")
+ ], "Invoice state", readonly=True),
+ 'state': fields.selection([
+ ('draft', 'draft'),
+ ('auto', 'waiting'),
+ ('confirmed', 'confirmed'),
+ ('assigned', 'assigned'),
+ ('done', 'done'),
+ ('cancel', 'cancel'),
+ ], 'State', readonly=True),
+ 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
+ 'journal_id':fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
+ 'quantity': fields.float('Quantities', readonly=True),
+ 'price_total': fields.float('Total Price', readonly=True),
+ 'price_average': fields.float('Average Price', readonly=True),
+ 'count': fields.integer('# of Lines', readonly=True),
+ }
+ _order = 'journal_id, name desc, price_total desc'
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'sale_journal_picking_report')
+
+ cr.execute("""
+ create or replace view sale_journal_picking_report as (
+ select
+ min(l.id) as id,
+ to_char(s.date, 'YYYY') as name,
+ to_char(s.date, 'MM') as month,
+ s.state,
+ s.invoice_state,
+ s.invoice_type_id,
+ s.journal_id,
+ sum(l.product_qty) as quantity,
+ count(*) as count,
+ sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
+ (sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
+ from stock_picking s
+ right join stock_move l on (s.id=l.picking_id)
+ left join sale_order_line ol on (l.sale_line_id=ol.id)
+ group by s.journal_id, s.invoice_type_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state, s.invoice_state
+ order by s.invoice_type_id, s.invoice_state, s.state
+ )
+ """)
+
+sale_journal_picking_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale_journal/report/sale_journal_report_view.xml b/addons/sale_journal/report/sale_journal_report_view.xml
new file mode 100644
index 00000000000..f77a8dda152
--- /dev/null
+++ b/addons/sale_journal/report/sale_journal_report_view.xml
@@ -0,0 +1,146 @@
+
+
+
+ sale.journal.report.tree
+ sale.journal.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sale.journal.report.graph
+ sale.journal.report
+ graph
+
+
+
+
+
+
+
+
+
+ sale.journal.report.search
+ sale.journal.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sale.journal.picking.report.tree
+ sale.journal.picking.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sale.journal.picking.report.graph
+ sale.journal.picking.report
+ graph
+
+
+
+
+
+
+
+
+
+
+
+ sale.journal.picking.report.search
+ sale.journal.picking.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Statistics on picking to invoice
+ sale.journal.picking.report
+ ir.actions.act_window
+ form
+ tree,form
+ [('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/sale_journal/sale_journal.py b/addons/sale_journal/sale_journal.py
index c041a934274..ad9b0e656c4 100644
--- a/addons/sale_journal/sale_journal.py
+++ b/addons/sale_journal/sale_journal.py
@@ -48,7 +48,7 @@ class sale_journal(osv.osv):
'date': fields.date('Journal date', required=True),
'date_created': fields.date('Creation date', readonly=True, required=True),
'date_validation': fields.date('Validation date', readonly=True),
- 'sale_stats_ids': fields.one2many("sale_journal.sale.stats", "journal_id", 'Sale Stats', readonly=True),
+ 'sale_stats_ids': fields.one2many("sale.journal.report", "journal_id", 'Sale Stats', readonly=True),
'state': fields.selection([
('draft','Draft'),
('open','Open'),
@@ -98,7 +98,7 @@ class picking_journal(osv.osv):
'date': fields.date('Journal date', required=True),
'date_created': fields.date('Creation date', readonly=True, required=True),
'date_validation': fields.date('Validation date', readonly=True),
- 'picking_stats_ids': fields.one2many("sale_journal.picking.stats", "journal_id", 'Journal Stats', readonly=True),
+ 'picking_stats_ids': fields.one2many("sale.journal.picking.report", "journal_id", 'Journal Stats', readonly=True),
'state': fields.selection([
('draft','Draft'),
('open','Open'),
@@ -130,5 +130,55 @@ class picking_journal(osv.osv):
return True
picking_journal()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+#==============================================
+# sale journal inherit
+#==============================================
+class res_partner(osv.osv):
+ _inherit = 'res.partner'
+ _columns = {
+ 'property_invoice_type': fields.property(
+ 'sale_journal.invoice.type',
+ type='many2one',
+ relation='sale_journal.invoice.type',
+ string="Invoicing Method",
+ method=True,
+ view_load=True,
+ group_name="Accounting Properties",
+ help="The type of journal used for sales and picking."),
+ }
+res_partner()
+
+class picking(osv.osv):
+ _inherit="stock.picking"
+ _columns = {
+ 'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal'),
+ 'sale_journal_id': fields.many2one('sale_journal.sale.journal', 'Sale Journal'),
+ 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
+ }
+picking()
+
+class sale(osv.osv):
+ _inherit="sale.order"
+ _columns = {
+ 'journal_id': fields.many2one('sale_journal.sale.journal', 'Journal'),
+ 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type')
+ }
+ def action_ship_create(self, cr, uid, ids, *args):
+ result = super(sale, self).action_ship_create(cr, uid, ids, *args)
+ for order in self.browse(cr, uid, ids, context={}):
+ pids = [ x.id for x in order.picking_ids]
+ self.pool.get('stock.picking').write(cr, uid, pids, {
+ 'invoice_type_id': order.invoice_type_id.id,
+ 'sale_journal_id': order.journal_id.id
+ })
+ return result
+
+ def onchange_partner_id(self, cr, uid, ids, part):
+ result = super(sale, self).onchange_partner_id(cr, uid, ids, part)
+ if part:
+ itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type.id
+ result['value']['invoice_type_id'] = itype
+ return result
+sale()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale_journal/sale_journal_inherit.py b/addons/sale_journal/sale_journal_inherit.py
deleted file mode 100644
index f9834862aa7..00000000000
--- a/addons/sale_journal/sale_journal_inherit.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import osv, fields
-
-
-class res_partner(osv.osv):
- _inherit = 'res.partner'
- _columns = {
- 'property_invoice_type': fields.property(
- 'sale_journal.invoice.type',
- type='many2one',
- relation='sale_journal.invoice.type',
- string="Invoicing Method",
- method=True,
- view_load=True,
- group_name="Accounting Properties",
- help="The type of journal used for sales and picking."),
- }
-res_partner()
-
-class picking(osv.osv):
- _inherit="stock.picking"
- _columns = {
- 'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal'),
- 'sale_journal_id': fields.many2one('sale_journal.sale.journal', 'Sale Journal'),
- 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
- }
-picking()
-
-class sale(osv.osv):
- _inherit="sale.order"
- _columns = {
- 'journal_id': fields.many2one('sale_journal.sale.journal', 'Journal'),
- 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type')
- }
- def action_ship_create(self, cr, uid, ids, *args):
- result = super(sale, self).action_ship_create(cr, uid, ids, *args)
- for order in self.browse(cr, uid, ids, context={}):
- pids = [ x.id for x in order.picking_ids]
- self.pool.get('stock.picking').write(cr, uid, pids, {
- 'invoice_type_id': order.invoice_type_id.id,
- 'sale_journal_id': order.journal_id.id
- })
- return result
-
- def onchange_partner_id(self, cr, uid, ids, part):
- result = super(sale, self).onchange_partner_id(cr, uid, ids, part)
- if part:
- itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type.id
- result['value']['invoice_type_id'] = itype
- return result
-sale()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/sale_journal/sale_journal_picking_report.py b/addons/sale_journal/sale_journal_picking_report.py
deleted file mode 100644
index e13b64cc4d6..00000000000
--- a/addons/sale_journal/sale_journal_picking_report.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields,osv
-import tools
-
-class report_sale_journal_invoice_type_stats(osv.osv):
- _name = "sale_journal.invoice.type.stats"
- _description = "Stats on picking by invoice method"
- _auto = False
- _columns = {
- 'name': fields.char('Year',size=64,required=False, readonly=True),
- 'invoice_state':fields.selection([
- ("invoiced","invoiced"),
- ("2binvoiced","to be invoiced"),
- ("none","None")
- ], "Invoice state", readonly=True),
- 'state': fields.selection([
- ('draft','draft'),
- ('auto','waiting'),
- ('confirmed','confirmed'),
- ('assigned','assigned'),
- ('done','done'),
- ('cancel','cancel'),
- ], 'State', readonly=True),
- 'invoice_type_id':fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
- 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
- ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
-
- }
- _order = 'state,invoice_state,name desc'
- def init(self, cr):
- tools.drop_view_if_exists(cr, 'sale_journal_invoice_type_stats')
- cr.execute("""
- create or replace view sale_journal_invoice_type_stats as (
- select
- min(l.id) as id,
- to_char(s.date, 'YYYY') as name,
- to_char(s.date, 'MM') as month,
- s.state,
- s.invoice_state,
- s.invoice_type_id,
- sum(l.product_qty) as quantity,
- count(*) as count,
- sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
- (sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
- from stock_picking s
- left join stock_move l on (s.id=l.picking_id)
- left join sale_order_line ol on (l.sale_line_id=ol.id)
- group by s.invoice_type_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state, s.invoice_state
- order by s.invoice_type_id, s.invoice_state, s.state
- )
- """)
-report_sale_journal_invoice_type_stats()
-
-class report_sale_journal_picking(osv.osv):
- _name = "sale_journal.picking.stats"
- _description = "Picking lists by Journal"
- _auto = False
- _columns = {
- 'name': fields.char('Year',size=64,required=False, readonly=True),
- 'state': fields.selection([
- ('draft','draft'),
- ('auto','waiting'),
- ('confirmed','confirmed'),
- ('assigned','assigned'),
- ('done','done'),
- ('cancel','cancel'),
- ], 'State', readonly=True),
- 'journal_id':fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
- 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
- ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
-
- }
- _order = 'journal_id,name desc,price_total desc'
- def init(self, cr):
- tools.drop_view_if_exists(cr, 'sale_journal_picking_stats')
- cr.execute("""
- create or replace view sale_journal_picking_stats as (
- select
- min(l.id) as id,
- to_char(s.date, 'YYYY') as name,
- to_char(s.date, 'MM') as month,
- s.state,
- s.journal_id,
- sum(l.product_qty) as quantity,
- count(*) as count,
- sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
- (sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
- from stock_picking s
- right join stock_move l on (s.id=l.picking_id)
- right join sale_order_line ol on (l.sale_line_id=ol.id)
- group by s.journal_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state
- )
- """)
-report_sale_journal_picking()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/sale_journal/sale_journal_report.py b/addons/sale_journal/sale_journal_report.py
deleted file mode 100644
index e77d7569004..00000000000
--- a/addons/sale_journal/sale_journal_report.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields,osv
-import tools
-
-class report_sale_journal_sale(osv.osv):
- _name = "sale_journal.sale.stats"
- _description = "Sales Orders by Journal"
- _auto = False
- _columns = {
- 'name': fields.char('Year',size=64,required=False, readonly=True),
- 'state': fields.selection([
- ('draft','Quotation'),
- ('waiting_date','Waiting Schedule'),
- ('manual','Manual in progress'),
- ('progress','In progress'),
- ('shipping_except','Shipping Exception'),
- ('invoice_except','Invoice Exception'),
- ('done','Done'),
- ('cancel','Cancel')
- ], 'Order State', readonly=True),
- 'journal_id':fields.many2one('sale_journal.sale.journal', 'Journal', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
- 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
- ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
- }
- _order = 'journal_id,name desc,price_total desc'
- def init(self, cr):
- tools.drop_view_if_exists(cr, 'sale_journal_sale_stats')
- cr.execute("""
- create or replace view sale_journal_sale_stats as (
- select
- min(l.id) as id,
- to_char(s.date_order, 'YYYY') as name,
- to_char(s.date_order,'MM') as month,
- s.state,
- s.journal_id,
- sum(l.product_uom_qty) as quantity,
- count(*),
- sum(l.product_uom_qty*l.price_unit) as price_total,
- (sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average
- from sale_order s
- right join sale_order_line l on (s.id=l.order_id)
- group by s.journal_id, to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),s.state
- )
- """)
-report_sale_journal_sale()
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml
index 7783f646292..b38f8f7f772 100644
--- a/addons/sale_journal/sale_journal_view.xml
+++ b/addons/sale_journal/sale_journal_view.xml
@@ -1,385 +1,449 @@
-
-
- sale_journal.invoice.type.form
- sale_journal.invoice.type
- form
-
-
-
-
-
- sale_journal.invoice.type.tree
- sale_journal.invoice.type
- tree
-
-
-
-
-
-
-
-
- sale_journal.invoice.type
- form
- tree,form
-
-
-
-
-
- sale_journal.sale.journal.form
- sale_journal.sale.journal
- form
-
-
-
-
-
- sale_journal.sale.journal.tree
- sale_journal.sale.journal
- tree
-
-
-
-
-
-
-
-
-
-
-
-
- sale_journal.sale.journal.search
- sale_journal.sale.journal
- search
-
-
-
-
-
-
+
+
+
+
+
+ sale_journal.invoice.type.form
+ sale_journal.invoice.type
+ form
+
+
+
+
+
+
+
+
+ sale_journal.invoice.type.tree
+ sale_journal.invoice.type
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ sale_journal.invoice.type
+ form
+ tree,form
+
+
+
+
+
+
+
+ sale_journal.sale.journal.form
+ sale_journal.sale.journal
+ form
+
+
+
+
+
+
+
+
+ sale_journal.sale.journal.tree
+ sale_journal.sale.journal
+ tree
+
+
-
-
-
-
-
-
- sale_journal.sale.journal
- form
- tree,form
-
-
-
-
-
-
-
-
- sale.order.journal.view.form
- form
- sale.order
-
-
-
-
-
-
-
-
-
- sale.order.journal.view.tree
- tree
- sale.order
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.form
- form
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.tree
- tree
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.form
- form
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.tree
- tree
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.form
- form
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.tree
- tree
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.form
- form
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
- stock.picking.journal.view.tree
- tree
- stock.picking
-
-
-
-
-
-
-
-
-
-
-
-
-
- sale_journal.sale.stats.tree
- sale_journal.sale.stats
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
- sale_journal.sale.stats.form
- sale_journal.sale.stats
- form
-
-
-
-
-
-
- sale_journal.sale.stats.search
- sale_journal.sale.stats
- search
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ sale_journal.sale.journal.search
+ sale_journal.sale.journal
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sale_journal.sale.journal
+ form
+ tree,form
+
+
+
+
+
+
+
+
+ sale.order.journal.view.form
+ form
+ sale.order
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+ sale.order.journal.view.tree
+ tree
+ sale.order
+
+
+
+
+
+
+
+
-
+
+
+
+ stock.picking.journal.view.form
+ form
+ stock.picking
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+ stock.picking.journal.view.tree
+ tree
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+
+ stock.picking.journal.view.form
+ form
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+
+
+ stock.picking.journal.view.tree
+ tree
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+ stock.picking.journal.view.form
+ form
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+ stock.picking.journal.view.tree
+ tree
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+ stock.picking.journal.view.form
+ form
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+ stock.picking.journal.view.tree
+ tree
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+ res.partner.journal.property.form.inherit
+ res.partner
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sale_journal.picking.journal.form
+ sale_journal.picking.journal
+ form
+
+
+
+
+
+
+ sale_journal.picking.journal.tree
+ sale_journal.picking.journal
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+ sale_journal.picking.journal.search
+ sale_journal.picking.journal
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Picking journals
+ sale_journal.picking.journal
+ form
+ tree,form
+
+
+
+
+
+
+ Picking by invoice_method
+ sale_journal.invoice.type.tree
+ sale_journal.invoice.type
+ ir.actions.act_window
+ tree
+
+
+
+ Picking to invoice
+ stock.picking
+ ir.actions.act_window
+ form
+ tree,form
+ [('state','=','done'),('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]
+
+
+
+ tree_but_open
+ sale_journal.invoice.type
+ Picking to invoice
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- res.partner.journal.property.form.inherit
- res.partner
- form
-
-
-
-
-
-
-
-
-
-
+
diff --git a/addons/sale_journal/security/ir.model.access.csv b/addons/sale_journal/security/ir.model.access.csv
index f958ecb8420..0a7ed3742ab 100644
--- a/addons/sale_journal/security/ir.model.access.csv
+++ b/addons/sale_journal/security/ir.model.access.csv
@@ -1,12 +1,7 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_sale_journal_invoice_type_stats","sale_journal.invoice.type.stats","model_sale_journal_invoice_type_stats","sale.group_sale_user",1,0,0,0
-"access_sale_journal_picking_stats","sale_journal.picking.stats","model_sale_journal_picking_stats","sale.group_sale_user",1,0,0,0
-"access_sale_journal_invoice_type","sale_journal.invoice.type","model_sale_journal_invoice_type","sale.group_sale_user",1,0,0,0
"access_sale_journal_invoice_type_finance_invoice","sale_journal.invoice.type invoice","model_sale_journal_invoice_type","account.group_account_invoice",1,0,0,0
"access_sale_journal_invoice_type_partner_manager","sale_journal.invoice.type partner manager","model_sale_journal_invoice_type","base.group_partner_manager",1,0,0,0
"access_sale_journal_sale_journal","sale_journal.sale.journal","model_sale_journal_sale_journal","sale.group_sale_user",1,0,0,0
-"access_sale_journal_picking_journal","sale_journal.picking.journal","model_sale_journal_picking_journal","sale.group_sale_user",1,0,0,0
-"access_sale_journal_sale_stats","sale_journal.sale.stats","model_sale_journal_sale_stats","sale.group_sale_user",1,0,0,0
"access_sale_journal_invoice_type_manager","sale_journal.invoice.type.manager","model_sale_journal_invoice_type","sale.group_sale_manager",1,1,1,1
"access_sale_journal_sale_journal_manager","sale_journal.sale.journal.manager","model_sale_journal_sale_journal","sale.group_sale_manager",1,1,1,1
"access_sale_journal_picking_journal_manager","sale_journal.picking.journal.manager","model_sale_journal_picking_journal","sale.group_sale_manager",1,1,1,1