Port to v10

This commit is contained in:
Alexis de Lattre
2016-12-08 15:10:33 +01:00
parent 23cadc403c
commit 985a894866
5 changed files with 31 additions and 72 deletions

View File

@@ -1,35 +1,19 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# POS Sale Report module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'POS Sale Report',
'version': '0.1',
'version': '10.0.1.0.0',
'category': 'Point Of Sale',
'license': 'AGPL-3',
'summary': 'Add a graph via on that aggregate sale orders and pos orders',
'description': """
In the *Reporting* menu, add a new entry *POS + Sale Orders Analysis* that show sale statistics per products that aggregate sale orders and pos orders.
In the *Point of sales > Reporting* menu, add a new entry *POS + Sale Orders Analysis* that show sale statistics per products that aggregate sale orders and pos orders.
Also add direct access to Sales statistics on the Product form view and Product Variants form view (Menu entry *Sales Statistics* in the *More* drop down list).
Also add direct access to Sales statistics on the Product form view and Product Variants form view (Menu entry *Sales Statistics* in the *Action* drop down list).
This module has been written by Alexis de Lattre
<alexis.delattre@akretion.com>.
@@ -42,5 +26,5 @@ This module has been written by Alexis de Lattre
'product_view.xml',
'security/ir.model.access.csv',
],
'installable': False,
'installable': True,
}

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<!-- Add entry in the "More" drop down list in form view -->
<act_window id="product_product_pos_sale_report_action"
@@ -9,7 +8,7 @@
name="Sales Statistics"
res_model="pos.sale.report"
src_model="product.product"
view_mode="graph"
view_mode="pivot"
domain="[('product_id', 'in', active_ids)]"
context="{'search_default_product_groupby': 1}"
/>
@@ -19,11 +18,10 @@
name="Sales Statistics"
res_model="pos.sale.report"
src_model="product.template"
view_mode="graph"
view_mode="pivot"
domain="[('product_tmpl_id', 'in', active_ids)]"
context="{'search_default_product_tmpl_groupby': 1}"
/>
</data>
</openerp>
</odoo>

View File

@@ -1,30 +1,12 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# POS Sale Report module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields
from openerp import tools
from odoo import models, fields, tools, api
class pos_sale_report(models.Model):
class PosSaleReport(models.Model):
_name = 'pos.sale.report'
_description = 'POS orders and Sale orders aggregated report'
_auto = False
@@ -76,7 +58,7 @@ class pos_sale_report(models.Model):
"""
return select
def init(self, cr):
tools.drop_view_if_exists(cr, self._table)
cr.execute("CREATE OR REPLACE VIEW %s AS (%s UNION %s)" % (
def init(self):
tools.drop_view_if_exists(self._cr, self._table)
self._cr.execute("CREATE OR REPLACE VIEW %s AS (%s UNION %s)" % (
self._table, self._sale_order_select(), self._pos_order_select()))

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record id="pos_sale_report_search" model="ir.ui.view">
<field name="name">pos.sale.report.search</field>
@@ -25,29 +24,25 @@
</field>
</record>
<record id="pos_sale_report_graph" model="ir.ui.view">
<field name="name">pos.sale.report.graph</field>
<record id="pos_sale_report_pivot" model="ir.ui.view">
<field name="name">pos.sale.report.pivot</field>
<field name="model">pos.sale.report</field>
<field name="arch" type="xml">
<graph string="POS orders and Sale Orders aggregated report" type="pivot">
<pivot string="POS orders and Sale Orders aggregated report" type="pivot">
<field name="origin" type="col"/>
<field name="date" type="row" interval="month"/>
<field name="qty" type="measure"/>
</graph>
</pivot>
</field>
</record>
<record id="pos_sale_report_action" model="ir.actions.act_window">
<field name="name">POS + Sale Orders Analysis</field>
<field name="res_model">pos.sale.report</field>
<field name="view_mode">graph</field>
<field name="view_mode">pivot</field>
</record>
<menuitem id="pos_sale_report_title_menu" parent="base.menu_reporting"
name="POS + Sales" sequence="9"/>
<menuitem id="pos_sale_report_menu" action="pos_sale_report_action"
parent="pos_sale_report_title_menu" sequence="10"/>
parent="point_of_sale.menu_point_rep" sequence="100"/>
</data>
</openerp>
</odoo>

View File

@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_pos_sale_report_pos_user,Full access on pos.sale.report to POS User,model_pos_sale_report,point_of_sale.group_pos_user,1,1,1,1
access_pos_sale_report_sale_user,Full access on pos.sale.report to Sale User,model_pos_sale_report,base.group_sale_salesman,1,1,1,1
access_pos_sale_report_sale_user,Full access on pos.sale.report to Sale User,model_pos_sale_report,sales_team.group_sale_salesman,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_pos_sale_report_pos_user Full access on pos.sale.report to POS User model_pos_sale_report point_of_sale.group_pos_user 1 1 1 1
3 access_pos_sale_report_sale_user Full access on pos.sale.report to Sale User model_pos_sale_report base.group_sale_salesman sales_team.group_sale_salesman 1 1 1 1