[REM] point_of_sale: removed by margin analysis that doesn't sound interestigng at all for a point of sale and that is not compliant with the new type of standard price (fields.property)

bzr revid: qdp-launchpad@openerp.com-20130528095822-xxnubsv1mkgg78vu
This commit is contained in:
Quentin (OpenERP)
2013-05-28 11:58:22 +02:00
parent 7701138c02
commit 9c8d2f1ea9
3 changed files with 0 additions and 226 deletions
-130
View File
@@ -479,137 +479,7 @@
<field name="domain">[('date_order','like',time.strftime('%Y-%m'))]</field>
</record>
<!-- Sales by margin -->
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_form">
<field name="name">report.sales.by.margin.pos.form</field>
<field name="model">report.sales.by.margin.pos</field>
<field name="arch" type="xml">
<form string="POS " version="7.0">
<group col="4">
<field name="user_id"/>
<field name="product_name"/>
<field name="date_order" widget="date"/>
<field name="qty"/>
<field name="net_margin_per_qty"/>
<field name="total"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_tree">
<field name="name">report.sales.by.margin.pos.tree</field>
<field name="model">report.sales.by.margin.pos</field>
<field name="arch" type="xml">
<tree string="POS">
<field name="user_id"/>
<field name="product_name"/>
<field name="date_order" widget="date"/>
<field name="qty"/>
<field name="net_margin_per_qty"/>
<field name="total"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_calendar">
<field name="name">report.sales.by.margin.pos.calendar</field>
<field name="model">report.sales.by.margin.pos</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<calendar color="user_id" date_start="date_order" string="Sales by User Margin">
<field name="product_name"/>
<field name="total" />
</calendar>
</field>
</record>
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_graph">
<field name="name">report.sales.by.margin.pos.graph</field>
<field name="model">report.sales.by.margin.pos</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<graph type="bar" string="Sales by User Margin" orientation="horizontal">
<field name="product_name" />
<field name="total" operator="+"/>
</graph>
</field>
</record>
<record model="ir.actions.act_window" id="action_report_sales_by_margin_pos_today">
<field name="name">Sales by User Daily margin</field>
<field name="res_model">report.sales.by.margin.pos</field>
<field name="view_type">form</field>
<field name="view_mode">tree,calendar,form,graph</field>
<field name="domain">[('date_order','=',time.strftime('%Y-%m-%d'))]</field>
</record>
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_form">
<field name="name">report.sales.by.margin.pos.month.form</field>
<field name="model">report.sales.by.margin.pos.month</field>
<field name="arch" type="xml">
<form string="POS " version="7.0">
<group col="4">
<field name="user_id"/>
<field name="product_name"/>
<field name="date_order" widget="date"/>
<field name="qty"/>
<field name="net_margin_per_qty"/>
<field name="total"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_tree">
<field name="name">report.sales.by.margin.pos.month.tree</field>
<field name="model">report.sales.by.margin.pos.month</field>
<field name="arch" type="xml">
<tree string="POS">
<field name="user_id"/>
<field name="product_name"/>
<field name="date_order" widget="date"/>
<field name="qty"/>
<field name="net_margin_per_qty"/>
<field name="total"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_calendar">
<field name="name">report.sales.by.margin.pos.month.calendar</field>
<field name="model">report.sales.by.margin.pos.month</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<calendar color="user_id" date_start="date_order" string="Sales by User Margin">
<field name="product_name"/>
<field name="total" />
</calendar>
</field>
</record>
<record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_graph">
<field name="name">report.sales.by.margin.pos.month.graph</field>
<field name="model">report.sales.by.margin.pos.month</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<graph type="bar" string="Sales by User Margin" orientation="horizontal">
<field name="product_name" />
<field name="total" operator="+"/>
</graph>
</field>
</record>
<record model="ir.actions.act_window" id="action_report_sales_by_margin_pos_month">
<field name="name">Sales by User Monthly margin</field>
<field name="res_model">report.sales.by.margin.pos.month</field>
<field name="view_type">form</field>
<field name="view_mode">tree,calendar,form,graph</field>
<field name="domain">[('date_order','like',time.strftime('%Y-%m'))]</field>
</record>
<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form.inherit</field>
-94
View File
@@ -139,99 +139,5 @@ class report_sales_by_user_pos_month(osv.osv):
)
""")
class report_sales_by_margin_pos(osv.osv):
_name = "report.sales.by.margin.pos"
_description = "Sales by margin"
_auto = False
_columns = {
'product_name':fields.char('Product Name', size=64, readonly=True),
'date_order': fields.date('Order Date',required=True, select=True),
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
'qty': fields.float('Qty', readonly=True, select=True),
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
'total':fields.float('Margin', readonly=True, select=True),
}
#TODO: i don't think your join condition is correct, in all your reports because the company_id field on ir.property may be emtpy (not required)
#so you should take that into account in your query :-s
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos')
cr.execute("""
create or replace view report_sales_by_margin_pos as (
select
min(pol.id) as id,
po.user_id as user_id,
pt.name as product_name,
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text as date_order,
sum(pol.qty) as qty,
pt.list_price-ip.value_float as net_margin_per_qty,
(pt.list_price-ip.value_float) *sum(pol.qty) as total
from
product_template as pt,
product_product as pp,
ir_property as ip,
pos_order_line as pol,
pos_order as po
where
pol.product_id = pp.product_tmpl_id and
pp.product_tmpl_id = pt.id and
po.id = pol.order_id and
ip.name='standard_price' AND ip.res_id=CONCAT('product.template,',pt.id) AND ip.company_id=po.company_id
group by
pt.name,
pt.list_price,
ip.value_float,
po.user_id,
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text
)
""")
class report_sales_by_margin_pos_month(osv.osv):
_name = "report.sales.by.margin.pos.month"
_description = "Sales by margin monthly"
_auto = False
_columns = {
'product_name':fields.char('Product Name', size=64, readonly=True),
'date_order': fields.date('Order Date',required=True, select=True),
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
'qty': fields.float('Qty', readonly=True, select=True),
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
'total':fields.float('Margin', readonly=True, select=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos_month')
cr.execute("""
create or replace view report_sales_by_margin_pos_month as (
select
min(pol.id) as id,
po.user_id as user_id,
pt.name as product_name,
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text as date_order,
sum(pol.qty) as qty,
pt.list_price-ip.value_float as net_margin_per_qty,
(pt.list_price-ip.value_float) *sum(pol.qty) as total
from
product_template as pt,
ir_property as ip,
product_product as pp,
pos_order_line as pol,
pos_order as po
where
pol.product_id = pp.product_tmpl_id and
pp.product_tmpl_id = pt.id and
po.id = pol.order_id and
ip.name='standard_price' AND ip.res_id=CONCAT('product.template,',pt.id) AND ip.company_id=po.company_id
group by
pt.name,
pt.list_price,
ip.value_float,
po.user_id,
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text
)
""")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -13,8 +13,6 @@ access_pos_order_stock_worker,pos.order stock_worker,model_pos_order,stock.group
access_stock_move_pos_user,stock.move pos_user,stock.model_stock_move,group_pos_user,1,1,1,1
access_report_sales_by_user_pos,report.sales.by.user.pos,model_report_sales_by_user_pos,group_pos_user,1,0,0,0
access_report_sales_by_user_pos_month,report.sales.by.user.pos.month,model_report_sales_by_user_pos_month,group_pos_user,1,0,0,0
access_report_sales_by_margin_pos,report.sales.by.margin.pos,model_report_sales_by_margin_pos,group_pos_user,1,0,0,0
access_report_sales_by_margin_pos_month,report.sales.by.margin.pos.month,model_report_sales_by_margin_pos_month,group_pos_user,1,0,0,0
access_report_pos_order,report.pos.order,model_report_pos_order,group_pos_user,1,1,1,1
access_account_bank_statement,account.bank.statement,account.model_account_bank_statement,group_pos_user,1,1,1,0
access_account_bank_statement_manager,account.bank.statement manager,account.model_account_bank_statement,group_pos_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
13 access_stock_move_pos_user stock.move pos_user stock.model_stock_move group_pos_user 1 1 1 1
14 access_report_sales_by_user_pos report.sales.by.user.pos model_report_sales_by_user_pos group_pos_user 1 0 0 0
15 access_report_sales_by_user_pos_month report.sales.by.user.pos.month model_report_sales_by_user_pos_month group_pos_user 1 0 0 0
access_report_sales_by_margin_pos report.sales.by.margin.pos model_report_sales_by_margin_pos group_pos_user 1 0 0 0
access_report_sales_by_margin_pos_month report.sales.by.margin.pos.month model_report_sales_by_margin_pos_month group_pos_user 1 0 0 0
16 access_report_pos_order report.pos.order model_report_pos_order group_pos_user 1 1 1 1
17 access_account_bank_statement account.bank.statement account.model_account_bank_statement group_pos_user 1 1 1 0
18 access_account_bank_statement_manager account.bank.statement manager account.model_account_bank_statement group_pos_manager 1 1 1 1