[MERGE] merged with main trunk (revision 9186)
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 28 Feb 2014 13:15:16 +0000 (14:15 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 28 Feb 2014 13:15:16 +0000 (14:15 +0100)
bzr revid: qdp-launchpad@openerp.com-20140228131516-ihigousbe5p1nt68

22 files changed:
1  2 
addons/mrp/__openerp__.py
addons/mrp/procurement.py
addons/mrp/test/order_process.yml
addons/point_of_sale/point_of_sale.py
addons/point_of_sale/point_of_sale_view.xml
addons/purchase/__openerp__.py
addons/purchase/purchase_view.xml
addons/purchase/report/__init__.py
addons/purchase/report/purchase_report.py
addons/purchase/report/purchase_report_view.xml
addons/purchase/views/report_purchaseorder.xml
addons/purchase/views/report_purchasequotation.xml
addons/purchase_requisition/__openerp__.py
addons/purchase_requisition/purchase_requisition_report.xml
addons/purchase_requisition/test/purchase_requisition.yml
addons/purchase_requisition/views/report_purchaserequisition.xml
addons/sale/__openerp__.py
addons/sale/sale.py
addons/sale/sale_view.xml
addons/sale_stock/sale_stock_view.xml
addons/sale_stock/test/picking_order_policy.yml
addons/stock/product.py

@@@ -68,14 -66,18 +68,16 @@@ Dashboard / Reports for MRP will includ
          'mrp_report.xml',
          'company_view.xml',
          'process/stockable_product_process.xml',
 -        'process/service_product_process.xml',
 -        'process/procurement_process.xml',
 +        #'process/service_product_process.xml',
 +        #'process/procurement_process.xml',
          'report/mrp_report_view.xml',
-         'report/mrp_production_order_view.xml',
          'board_manufacturing_view.xml',
          'res_config_view.xml',
+         'views/report_mrporder.xml',
+         'views/report_mrpbomstructure.xml',
      ],
      'demo': ['mrp_demo.xml'],
 -    #TODO: This yml tests are needed to be completely reviewed again because the product wood panel is removed in product demo as it does not suit for new demo context of computer and consultant company
 -    # so the ymls are too complex to change at this stage
      'test': [
           'test/bom_with_service_type_product.yml',
           'test/mrp_users.yml',
@@@ -78,52 -88,33 +78,49 @@@ class procurement_order(osv.osv)
          move_obj = self.pool.get('stock.move')
          procurement_obj = self.pool.get('procurement.order')
          for procurement in procurement_obj.browse(cr, uid, ids, context=context):
 -            res_id = procurement.move_id.id
 -            newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.produce_delay or 0.0)
 -            newdate = newdate - relativedelta(days=company.manufacturing_lead)
 -            produce_id = production_obj.create(cr, uid, {
 -                'origin': procurement.origin,
 -                'product_id': procurement.product_id.id,
 -                'product_qty': procurement.product_qty,
 -                'product_uom': procurement.product_uom.id,
 -                'product_uos_qty': procurement.product_uos and procurement.product_uos_qty or False,
 -                'product_uos': procurement.product_uos and procurement.product_uos.id or False,
 -                'location_src_id': procurement.location_id.id,
 -                'location_dest_id': procurement.location_id.id,
 -                'bom_id': procurement.bom_id and procurement.bom_id.id or False,
 -                'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
 -                'move_prod_id': res_id,
 -                'company_id': procurement.company_id.id,
 -            })
 -            
 -            res[procurement.id] = produce_id
 -            self.write(cr, uid, [procurement.id], {'state': 'running', 'production_id': produce_id})   
 -            bom_result = production_obj.action_compute(cr, uid,
 -                    [produce_id], properties=[x.id for x in procurement.property_ids])
 -            production_obj.signal_button_confirm(cr, uid, [produce_id])
 -        self.production_order_create_note(cr, uid, ids, context=context)
 +            if self.check_bom_exists(cr, uid, [procurement.id], context=context):
 +                if procurement.bom_id:
 +                    bom_id = procurement.bom_id.id
 +                    routing_id = procurement.bom_id.routing_id.id
 +                else:
 +                    properties = [x.id for x in procurement.property_ids]
 +                    bom_id = bom_obj._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties)
 +                    bom = bom_obj.browse(cr, uid, bom_id, context=context)
 +                    routing_id = bom.routing_id.id
 +
 +                res_id = procurement.move_dest_id and procurement.move_dest_id.id or False
 +                newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.produce_delay or 0.0)
 +                newdate = newdate - relativedelta(days=company.manufacturing_lead)
 +                produce_id = production_obj.create(cr, uid, {
 +                    'origin': procurement.origin,
 +                    'product_id': procurement.product_id.id,
 +                    'product_qty': procurement.product_qty,
 +                    'product_uom': procurement.product_uom.id,
 +                    'product_uos_qty': procurement.product_uos and procurement.product_uos_qty or False,
 +                    'product_uos': procurement.product_uos and procurement.product_uos.id or False,
 +                    'location_src_id': procurement.location_id.id,
 +                    'location_dest_id': procurement.location_id.id,
 +                    'bom_id': bom_id,
 +                    'routing_id': routing_id,
 +                    'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
 +                    'move_prod_id': res_id,
 +                    'company_id': procurement.company_id.id,
 +                })
 +
 +                res[procurement.id] = produce_id
 +                self.write(cr, uid, [procurement.id], {'production_id': produce_id})
 +                procurement.refresh()
 +                self.production_order_create_note(cr, uid, procurement, context=context)
 +                production_obj.action_compute(cr, uid, [produce_id], properties=[x.id for x in procurement.property_ids])
 +                production_obj.signal_button_confirm(cr, uid, [produce_id])
-                 if res_id:
-                     move_obj.write(cr, uid, [res_id],
-                             {'location_id': procurement.location_id.id})
 +            else:
 +                res[procurement.id] = False
 +                self.message_post(cr, uid, [procurement.id], body=_("No BoM exists for this product!"), context=context)
          return res
  
 -    def production_order_create_note(self, cr, uid, ids, context=None):
 -        for procurement in self.browse(cr, uid, ids, context=context):
 -            body = _("Manufacturing Order <em>%s</em> created.") % ( procurement.production_id.name,)
 -            self.message_post(cr, uid, [procurement.id], body=body, context=context)
 +    def production_order_create_note(self, cr, uid, procurement, context=None):
 +        body = _("Manufacturing Order <em>%s</em> created.") % (procurement.production_id.name,)
 +        self.message_post(cr, uid, [procurement.id], body=body, context=context)
 +
 +
 +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
                      raise AssertionError('unknown cost line: %s' % line)
                  assert line.general_account_id.id == wc.costs_general_account_id.id, "General Account is not correspond."
                  assert line.journal_id.id == wc.costs_journal_id.id, "Account Journal is not correspond."
 -                assert line.product_id.id == wc.product_id.id, "Product is not correspond."
 -                assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond."
 +                assert line.product_id.id == wc.product_id.id, "Product does not correspond."
 +                assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM does not correspond."
  -
-   I print a "BOM Structure".
- -
-   !context
-     uid: 'res_users_mrp_user'
- -
-   !python {model: mrp.production}: |
-     import os
-     import openerp.report
-     from openerp import tools
-     order = self.browse(cr, uid, ref("mrp_production_test1"))
-     data, format = openerp.report.render_report(cr, uid, [order.bom_id.id], 'bom.structure', {}, {})
-     if tools.config['test_report_directory']:
-         file(os.path.join(tools.config['test_report_directory'], 'mrp-bom_structure_report.'+format), 'wb+').write(data)
- -
-   I print "Production Order".
- -
-   !python {model: mrp.production}: |
-     import os
-     import openerp.report
-     from openerp import tools
-     data, format = openerp.report.render_report(cr, uid, [ref("mrp_production_test1")], 'mrp.production.order', {}, {})
-     if tools.config['test_report_directory']:
-         file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data)
- -
    I print "Work Center Load Report".
  -
    !python {model: mrp.workcenter}: |
Simple merge
@@@ -79,10 -77,9 +82,9 @@@ Dashboard / Reports for Purchase Manage
          'test/process/merge_order.yml',
          'test/process/edi_purchase_order.yml',
          'test/process/invoice_on_poline.yml',
-         'test/ui/print_report.yml',
          'test/ui/duplicate_order.yml',
          'test/ui/delete_order.yml',
 +        'test/average_price.yml',
      ],
      'demo': [
          'purchase_order_demo.yml',
                      <button name="picking_ok" states="except_picking" string="Manually Corrected"/>
                      <button name="invoice_ok" states="except_invoice" string="Manually Corrected"/>
                      <button name="purchase_approve" states="confirmed" string="Approve Order" class="oe_highlight" groups="purchase.group_purchase_manager"/>
 +                    <button name="wkf_send_rfq" states="approved" string="Send PO by Email" type="object" context="{'send_rfq':False}"/>
                      <button name="view_picking" string="Receive Products" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}" class="oe_highlight"/>
-                     <button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','=','picking'), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/>
+                     <button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','in', ['picking', 'manual']), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/>
 -                    <button name="action_cancel_draft" states="cancel,confirmed" string="Set to Draft" type="object" />
 -                    <button name="purchase_cancel" states="draft,confirmed,sent" string="Cancel"/>
 -                    <field name="state" widget="statusbar" statusbar_visible="draft,sent,approved,done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue"}' readonly="1"/>
 +                    <button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" />
 +                    <button name="purchase_cancel" states="draft,confirmed,sent,bid" string="Cancel"/>
 +                    <button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel" type="object" />
 +                    <field name="state" widget="statusbar" statusbar_visible="draft,sent,bid,approved,done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue"}' readonly="1"/>
                  </header>
                  <sheet>
                      <div class="oe_title">
diff --cc addons/purchase/report/__init__.py
index 65d4fb0,0ec2c3c..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,27 -1,25 +1,0 @@@
--# -*- coding: utf-8 -*-
--##############################################################################
--#
--#    OpenERP, Open Source Management Solution
--#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
--#
--#    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/>.
--#
--##############################################################################
--
- import order
- import request_quotation
--import purchase_report
--
--# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--
diff --cc addons/purchase/report/purchase_report.py
index 2483f79,ada1d83..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,129 -1,128 +1,0 @@@
--# -*- coding: utf-8 -*-
--##############################################################################
--#
--#    OpenERP, Open Source Management Solution
--#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
--#
--#    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/>.
--#
--##############################################################################
--
--#
--# Please note that these reports are not multi-currency !!!
--#
--
--from openerp.osv import fields,osv
--from openerp import tools
--
--class purchase_report(osv.osv):
--    _name = "purchase.report"
--    _description = "Purchases Orders"
--    _auto = False
--    _columns = {
--        'date': fields.date('Order Date', readonly=True, help="Date on which this document has been created"),
--        'state': fields.selection([('draft', 'Request for Quotation'),
--                                     ('confirmed', 'Waiting Supplier Ack'),
--                                      ('approved', 'Approved'),
--                                      ('except_picking', 'Shipping Exception'),
--                                      ('except_invoice', 'Invoice Exception'),
--                                      ('done', 'Done'),
--                                      ('cancel', 'Cancelled')],'Order Status', readonly=True),
--        'product_id':fields.many2one('product.product', 'Product', readonly=True),
-         'picking_type_id': fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
-         'location_id': fields.many2one('stock.location', 'Destination', readonly=True),
-         'partner_id':fields.many2one('res.partner', 'Supplier', readonly=True),
-         'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', readonly=True),
-         'date_approve':fields.date('Date Approved', readonly=True),
-         'expected_date':fields.date('Expected Date', readonly=True),
-         'validator' : fields.many2one('res.users', 'Validated By', readonly=True),
-         'product_uom' : fields.many2one('product.uom', 'Reference Unit of Measure', required=True),
-         'company_id':fields.many2one('res.company', 'Company', readonly=True),
-         'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
-         'delay':fields.float('Days to Validate', digits=(16,2), readonly=True),
-         'delay_pass':fields.float('Days to Deliver', digits=(16,2), readonly=True),
-         'quantity': fields.float('Quantity', readonly=True),
-         'price_total': fields.float('Total Price', readonly=True),
-         'price_average': fields.float('Average Price', readonly=True, group_operator="avg"),
-         'negociation': fields.float('Purchase-Standard Price', readonly=True, group_operator="avg"),
-         'price_standard': fields.float('Products Value', readonly=True, group_operator="sum"),
-         'nbr': fields.integer('# of Lines', readonly=True),
-         'category_id': fields.many2one('product.category', 'Category', readonly=True)
-     }
-     _order = 'date desc, price_total desc'
-     def init(self, cr):
-         tools.sql.drop_view_if_exists(cr, 'purchase_report')
-         cr.execute("""
-             create or replace view purchase_report as (
-                 select
-                     min(l.id) as id,
-                     s.date_order as date,
-                     s.state,
-                     s.date_approve,
-                     s.minimum_planned_date as expected_date,
-                     s.dest_address_id,
-                     s.pricelist_id,
-                     s.validator,
-                     s.picking_type_id as picking_type_id,
-                     s.partner_id as partner_id,
-                     s.create_uid as user_id,
-                     s.company_id as company_id,
-                     l.product_id,
-                     t.categ_id as category_id,
-                     t.uom_id as product_uom,
-                     s.location_id as location_id,
-                     sum(l.product_qty/u.factor*u2.factor) as quantity,
-                     extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay,
-                     extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass,
-                     count(*) as nbr,
-                     sum(l.price_unit*l.product_qty)::decimal(16,2) as price_total,
-                     avg(100.0 * (l.price_unit*l.product_qty) / NULLIF(ip.value_float*l.product_qty/u.factor*u2.factor, 0.0))::decimal(16,2) as negociation,
-                     sum(ip.value_float*l.product_qty/u.factor*u2.factor)::decimal(16,2) as price_standard,
-                     (sum(l.product_qty*l.price_unit)/NULLIF(sum(l.product_qty/u.factor*u2.factor),0.0))::decimal(16,2) as price_average
-                 from purchase_order_line l
-                     join purchase_order s on (l.order_id=s.id)
-                         left join product_product p on (l.product_id=p.id)
-                             left join product_template t on (p.product_tmpl_id=t.id)
-                             LEFT JOIN ir_property ip ON (ip.name='standard_price' AND ip.res_id=CONCAT('product.template,',t.id) AND ip.company_id=s.company_id)
-                     left join product_uom u on (u.id=l.product_uom)
-                     left join product_uom u2 on (u2.id=t.uom_id)
-                 group by
-                     s.company_id,
-                     s.create_uid,
-                     s.partner_id,
-                     u.factor,
-                     s.location_id,
-                     l.price_unit,
-                     s.date_approve,
-                     l.date_planned,
-                     l.product_uom,
-                     s.minimum_planned_date,
-                     s.pricelist_id,
-                     s.validator,
-                     s.dest_address_id,
-                     l.product_id,
-                     t.categ_id,
-                     s.date_order,
-                     s.state,
-                     s.picking_type_id,
-                     u.uom_type,
-                     u.category_id,
-                     t.uom_id,
-                     u.id,
-                     u2.factor
-             )
-         """)
- # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 -        'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
 -        'location_id': fields.many2one('stock.location', 'Destination', readonly=True),
 -        'partner_id':fields.many2one('res.partner', 'Supplier', readonly=True),
 -        'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', readonly=True),
 -        'date_approve':fields.date('Date Approved', readonly=True),
 -        'expected_date':fields.date('Expected Date', readonly=True),
 -        'validator' : fields.many2one('res.users', 'Validated By', readonly=True),
 -        'product_uom' : fields.many2one('product.uom', 'Reference Unit of Measure', required=True),
 -        'company_id':fields.many2one('res.company', 'Company', readonly=True),
 -        'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
 -        'delay':fields.float('Days to Validate', digits=(16,2), readonly=True),
 -        'delay_pass':fields.float('Days to Deliver', digits=(16,2), readonly=True),
 -        'quantity': fields.float('Quantity', readonly=True),
 -        'price_total': fields.float('Total Price', readonly=True),
 -        'price_average': fields.float('Average Price', readonly=True, group_operator="avg"),
 -        'negociation': fields.float('Purchase-Standard Price', readonly=True, group_operator="avg"),
 -        'price_standard': fields.float('Products Value', readonly=True, group_operator="sum"),
 -        'nbr': fields.integer('# of Lines', readonly=True),
 -        'category_id': fields.many2one('product.category', 'Category', readonly=True)
 -
 -    }
 -    _order = 'date desc, price_total desc'
 -    def init(self, cr):
 -        tools.sql.drop_view_if_exists(cr, 'purchase_report')
 -        cr.execute("""
 -            create or replace view purchase_report as (
 -                select
 -                    min(l.id) as id,
 -                    s.date_order as date,
 -                    s.state,
 -                    s.date_approve,
 -                    s.minimum_planned_date as expected_date,
 -                    s.dest_address_id,
 -                    s.pricelist_id,
 -                    s.validator,
 -                    s.warehouse_id as warehouse_id,
 -                    s.partner_id as partner_id,
 -                    s.create_uid as user_id,
 -                    s.company_id as company_id,
 -                    l.product_id,
 -                    t.categ_id as category_id,
 -                    t.uom_id as product_uom,
 -                    s.location_id as location_id,
 -                    sum(l.product_qty/u.factor*u2.factor) as quantity,
 -                    extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay,
 -                    extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass,
 -                    count(*) as nbr,
 -                    sum(l.price_unit*l.product_qty)::decimal(16,2) as price_total,
 -                    avg(100.0 * (l.price_unit*l.product_qty) / NULLIF(t.standard_price*l.product_qty/u.factor*u2.factor, 0.0))::decimal(16,2) as negociation,
 -                    sum(t.standard_price*l.product_qty/u.factor*u2.factor)::decimal(16,2) as price_standard,
 -                    (sum(l.product_qty*l.price_unit)/NULLIF(sum(l.product_qty/u.factor*u2.factor),0.0))::decimal(16,2) as price_average
 -                from purchase_order_line l
 -                    join purchase_order s on (l.order_id=s.id)
 -                        left join product_product p on (l.product_id=p.id)
 -                            left join product_template t on (p.product_tmpl_id=t.id)
 -                    left join product_uom u on (u.id=l.product_uom)
 -                    left join product_uom u2 on (u2.id=t.uom_id)
 -                group by
 -                    s.company_id,
 -                    s.create_uid,
 -                    s.partner_id,
 -                    u.factor,
 -                    s.location_id,
 -                    l.price_unit,
 -                    s.date_approve,
 -                    l.date_planned,
 -                    l.product_uom,
 -                    s.minimum_planned_date,
 -                    s.pricelist_id,
 -                    s.validator,
 -                    s.dest_address_id,
 -                    l.product_id,
 -                    t.categ_id,
 -                    s.date_order,
 -                    s.state,
 -                    s.warehouse_id,
 -                    u.uom_type,
 -                    u.category_id,
 -                    t.uom_id,
 -                    u.id,
 -                    u2.factor
 -            )
 -        """)
 -
 -
 -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --cc addons/purchase/report/purchase_report_view.xml
index fc171e4,50b22f4..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,86 -1,86 +1,0 @@@
--<?xml version="1.0" encoding="utf-8"?>
--<openerp>
--    <data>
--        <record model="ir.ui.view" id="view_purchase_order_graph">
--            <field name="name">product.month.graph</field>
--            <field name="model">purchase.report</field>
--            <field name="arch" type="xml">
--                <graph string="Purchase Orders Statistics" type="pivot">
--                    <field name="partner_id" type="row"/>
--                    <field name="product_id" type="row"/>
--                    <field name="nbr" type="measure"/>
--                    <field name="quantity" type="measure"/>
--                    <field name="price_average" type="measure"/>
--                    <field name="price_standard" type="measure"/>
--                    <field name="price_total" type="measure"/>
--                </graph>
--            </field>
--        </record>
--
--        <record id="view_purchase_order_search" model="ir.ui.view">
--        <field name="name">report.purchase.order.search</field>
--        <field name="model">purchase.report</field>
--        <field name="arch" type="xml">
--            <search string="Purchase Orders">
--                <filter icon="terp-document-new" string="Quotations" name="quotes" domain="[('state','=','draft')]"/>
--                <filter icon="terp-gtk-jump-to-rtl" string="Orders" name="orders" domain="[('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]"/>
--                <field name="partner_id"/>
--                <field name="product_id"/>
--                <group expand="0" string="Extended Filters...">
--                    <field name="user_id"/>
--                    <field name="validator"/>
--                    <field name="location_id"/>
-                     <field name="picking_type_id"/>
-                     <field name="company_id" groups="base.group_multi_company"/>
-                     <field name="date"/>
-                     <field name="date_approve"/>
-                     <field name="expected_date"/>
-                 </group>
-                 <newline/>
-                 <group expand="1" string="Group By...">
-                     <filter string="Supplier" name="group_partner_id" icon="terp-personal" context="{'group_by':'partner_id'}"/>
-                     <filter string="Responsible" name="Responsible" icon="terp-personal" context="{'group_by':'user_id'}"/>
-                     <filter string="Validated by" icon="terp-personal" context="{'group_by':'validator'}"/>
-                     <filter string="Product" name="group_product_id" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
-                     <filter string="Category" name="group_category_id" icon="terp-stock_symbol-selection" context="{'group_by':'category_id'}"/>
-                     <filter string="Warehouse" icon="terp-go-home" context="{'group_by':'picking_type_id'}"/>
-                     <filter string="Reference UOM" name="group_product_uom" icon="terp-mrp" context="{'group_by':'product_uom'}"/>
-                     <filter string="Destination" icon="terp-gtk-jump-to-ltr" context="{'group_by':'location_id'}"/>
-                     <filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
-                     <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
-                     <filter string="Order Date (day)" icon="terp-go-today" context="{'group_by':'date:day'}" help="Order of Day"/>
-                     <filter string="Order Date (month)" icon="terp-go-month" context="{'group_by':'date:month'}" help="Order of Day"/>
-                     <filter string="Order Date (year)" icon="terp-go-year" context="{'group_by':'date:year'}" help="Order of Day"/>
-                 </group>
-             </search>
-         </field>
-     </record>
-     <record id="action_purchase_order_report_all" model="ir.actions.act_window">
-         <field name="name">Purchase Analysis</field>
-         <field name="res_model">purchase.report</field>
-         <field name="view_type">form</field>
-         <field name="view_mode">graph</field>
-         <field name="view_id" ref="view_purchase_order_graph"></field>
-         <field name="context">{'search_default_year':1,'search_default_month':1, 'search_default_orders': 1, 'group_by_no_leaf':1,'group_by':[]}</field>
-         <field name="help">Purchase Analysis allows you to easily check and analyse your company purchase history and performance. From this menu you can track your negotiation performance, the delivery performance of your suppliers, etc.</field>
-     </record>
-     <menuitem id="base.next_id_73" name="Purchase" parent="base.menu_reporting" sequence="10"
-         groups="purchase.group_purchase_manager"/>
-     <menuitem action="action_purchase_order_report_all" id="menu_action_purchase_order_report_all" parent="base.next_id_73" sequence="3"/>
-     <!--<record id="action_stock_move_report_po" model="ir.actions.act_window">
-         <field name="name">Receptions Analysis</field>
-         <field name="res_model">report.stock.move</field>
-         <field name="view_type">form</field>
-         <field name="view_mode">graph</field>
-         <field name="search_view_id" ref="stock.view_stock_search"/>
-         <field name="view_id" ref="stock.view_stock_graph"/>
-         <field name="context">{'full':'1','contact_display': 'partner','search_default_done':1, 'search_default_month':1, 'search_default_group_type':1, 'group_by': [], 'group_by_no_leaf':1,'search_default_year':1,}</field>
-         <field name="help">Reception Analysis allows you to easily check and analyse your company order receptions and the performance of your supplier's deliveries.</field>
-     </record>
-     <menuitem action="action_stock_move_report_po" id="menu_action_stock_move_report_po" parent="stock.next_id_61" sequence="1"/>-->
-     </data>
- </openerp>
 -                    <field name="warehouse_id"/>
 -                    <field name="company_id" groups="base.group_multi_company"/>
 -                    <field name="date"/>
 -                    <field name="date_approve"/>
 -                    <field name="expected_date"/>
 -                </group>
 -                <newline/>
 -                <group expand="1" string="Group By...">
 -                    <filter string="Supplier" name="group_partner_id" icon="terp-personal" context="{'group_by':'partner_id'}"/>
 -                    <filter string="Responsible" name="Responsible" icon="terp-personal" context="{'group_by':'user_id'}"/>
 -                    <filter string="Validated by" icon="terp-personal" context="{'group_by':'validator'}"/>
 -                    <filter string="Product" name="group_product_id" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
 -                    <filter string="Category" name="group_category_id" icon="terp-stock_symbol-selection" context="{'group_by':'category_id'}"/>
 -                    <filter string="Warehouse" icon="terp-go-home" context="{'group_by':'warehouse_id'}"/>
 -                    <filter string="Reference UOM" name="group_product_uom" icon="terp-mrp" context="{'group_by':'product_uom'}"/>
 -                    <filter string="Destination" icon="terp-gtk-jump-to-ltr" context="{'group_by':'location_id'}"/>
 -                    <filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
 -                    <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
 -                    <filter string="Order Date (day)" icon="terp-go-today" context="{'group_by':'date:day'}" help="Order of Day"/>
 -                    <filter string="Order Date (month)" icon="terp-go-month" context="{'group_by':'date:month'}" help="Order of Day"/>
 -                    <filter string="Order Date (year)" icon="terp-go-year" context="{'group_by':'date:year'}" help="Order of Day"/>
 -                </group>
 -            </search>
 -        </field>
 -    </record>
 -
 -    <record id="action_purchase_order_report_all" model="ir.actions.act_window">
 -        <field name="name">Purchase Analysis</field>
 -        <field name="res_model">purchase.report</field>
 -        <field name="view_type">form</field>
 -        <field name="view_mode">graph</field>
 -        <field name="view_id" ref="view_purchase_order_graph"></field>
 -        <field name="context">{'search_default_year':1,'search_default_month':1, 'search_default_orders': 1, 'group_by_no_leaf':1,'group_by':[]}</field>
 -        <field name="help">Purchase Analysis allows you to easily check and analyse your company purchase history and performance. From this menu you can track your negotiation performance, the delivery performance of your suppliers, etc.</field>
 -    </record>
 -
 -    <menuitem id="base.next_id_73" name="Purchase" parent="base.menu_reporting" sequence="10"
 -        groups="purchase.group_purchase_manager"/>
 -    <menuitem action="action_purchase_order_report_all" id="menu_action_purchase_order_report_all" parent="base.next_id_73" sequence="3"/>
 -
 -    <record id="action_stock_move_report_po" model="ir.actions.act_window">
 -        <field name="name">Receptions Analysis</field>
 -        <field name="res_model">report.stock.move</field>
 -        <field name="view_type">form</field>
 -        <field name="view_mode">graph</field>
 -        <field name="search_view_id" ref="stock.view_stock_search"/>
 -        <field name="view_id" ref="stock.view_stock_graph"/>
 -        <field name="context">{'full':'1','contact_display': 'partner','search_default_done':1, 'search_default_month':1, 'search_default_group_type':1, 'group_by': [], 'group_by_no_leaf':1,'search_default_year':1,}</field>
 -        <field name="help">Reception Analysis allows you to easily check and analyse your company order receptions and the performance of your supplier's deliveries.</field>
 -    </record>
 -    <menuitem action="action_stock_move_report_po" id="menu_action_stock_move_report_po" parent="stock.next_id_61" sequence="1"/>
 -
 -    </data>
 -</openerp>
index 0000000,c03e535..300149e
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,127 +1,127 @@@
+ <?xml version="1.0" encoding="utf-8"?>
+ <openerp>
+ <data>
+ <template id="report_purchaseorder">
+     <t t-call="report.html_container">
+         <t t-foreach="docs" t-as="o">
+             <t t-call="report.external_layout">
+                 <div class="page">
+                     <div class="oe_structure"/>
+                     <div class="row">
+                         <div class="col-xs-6">
+                             Shipping address :<br/>
+                             <div t-if="o.dest_address_id">
+                                 <div t-field="o.dest_address_id" 
+                                     t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
+                                 <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
+                             </div>
 -                            <div t-if="o.warehouse_id">
 -                                <span t-field="o.warehouse_id.name"/>
 -                                <div t-field="o.warehouse_id.partner_id" 
++                            <div t-if="o.picking_type_id and o.picking_type_id.warehouse_id">
++                                <span t-field="o.picking_type_id.warehouse_id.name"/>
++                                <div t-field="o.picking_type_id.warehouse_id.partner_id" 
+                                     t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
+                                 <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
+                             </div>
+                         </div>
+                         <div class="col-xs-4 col-xs-offset-2">
+                             <div t-field="o.partner_id" 
+                                 t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
+                         </div>
+                     </div>
+                     <h2 t-if="o.state != 'draft'">Purchase Order Confirmation N°<span t-field="o.name"/></h2>
+                     <h2 t-if="o.state == 'draft'">Request for Quotation N°<span t-field="o.name"/></h2>
+                     <div class="row mt32 mb32">
+                         <div t-if="o.name" class="col-xs-3">
+                             <strong>Our Order Reference:</strong>
+                             <p t-field="o.name"/>
+                         </div>
+                         <div t-if="o.partner_ref" class="col-xs-3">
+                             <strong>Your Order Reference</strong>
+                             <p t-field="o.partner_ref"/>
+                         </div>
+                         <div t-if="o.date_order" class="col-xs-3">
+                             <strong>Order Date:</strong>
+                             <p t-field="o.date_order"/>
+                         </div>
+                         <div t-if="o.validator" class="col-xs-3">
+                             <strong>Validated By:</strong>
+                             <p t-field="o.validator"/>
+                         </div>
+                     </div>
+                     <table class="table table-condensed">
+                         <thead>
+                             <tr>
+                                 <th><strong>Description</strong></th>
+                                 <th><strong>Taxes</strong></th>
+                                 <th class="text-center"><strong>Date Req.</strong></th>
+                                 <th class="text-right"><strong>Qty</strong></th>
+                                 <th class="text-right"><strong>Unit Price</strong></th>
+                                 <th class="text-right"><strong>Net Price</strong></th>
+                             </tr>
+                         </thead>
+                         <tbody>
+                             <tr t-foreach="o.order_line" t-as="line">
+                                 <td>
+                                     <span t-field="line.name"/>
+                                 </td>
+                                 <td>
+                                     <span t-esc="', '.join(map(lambda x: x.name, line.taxes_id))"/>
+                                 </td>
+                                 <td class="text-center">
+                                     <span t-field="line.date_planned"/>
+                                 </td>
+                                 <td class="text-right">
+                                     <span t-field="line.product_qty"/>
+                                     <span t-field="line.product_uom.name" groups="product.group_uom"/>
+                                 </td>
+                                 <td class="text-right">
+                                     <span t-field="line.price_unit"/>
+                                 </td>
+                                 <td class="text-right">
+                                     <span t-field="line.price_subtotal"
+                                         t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                                 </td>
+                             </tr>
+                         </tbody>
+                     </table>
+                     <div class="row">
+                         <div class="col-xs-4 pull-right">
+                             <table class="table table-condensed">
+                                 <tr class="border-black">
+                                     <td><strong>Total Without Taxes</strong></td>
+                                     <td class="text-right">
+                                         <span t-field="o.amount_untaxed"
+                                             t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                                     </td>
+                                 </tr>
+                                 <tr>
+                                     <td>Taxes</td>
+                                     <td class="text-right">
+                                         <span t-field="o.amount_tax"
+                                             t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                                     </td>
+                                 </tr>
+                                 <tr class="border-black">
+                                     <td><strong>Total</strong></td>
+                                     <td class="text-right">
+                                         <span t-field="o.amount_total"
+                                             t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
+                                     </td>
+                                 </tr>
+                             </table>
+                         </div>
+                     </div>
+                 
+                     <p t-field="o.notes"/>
+                     <div class="oe_structure"/>
+                 </div>
+             </t>
+         </t>
+     </t>
+ </template>
+ </data>
+ </openerp>
index 0000000,68e8995..a18619f
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,70 +1,70 @@@
+ <?xml version="1.0" encoding="utf-8"?>
+ <openerp>
+ <data>
+ <template id="report_purchasequotation">
+     <t t-call="report.html_container">
+         <t t-foreach="docs" t-as="o">
+             <t t-call="report.external_layout">
+                 <div class="page">
+                     <div class="oe_structure"/>
+                     <div class="row mt32 mb32">
+                         <div class="col-xs-6">
+                             Shipping address :<br/>
+                             <div t-if="o.dest_address_id">
+                                 <div t-field="o.dest_address_id" 
+                                     t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
+                                 <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
+                             </div>
 -                            <div t-if="o.warehouse_id">
 -                                <span t-field="o.warehouse_id.name"/>
 -                                <div t-field="o.warehouse_id.partner_id" 
++                            <div t-if="o.picking_type_id.warehouse_id">
++                                <span t-field="o.picking_type_id.warehouse_id.name"/>
++                                <div t-field="o.picking_type_id.warehouse_id.partner_id" 
+                                     t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
+                                 <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
+                             </div>
+                         </div>
+                         <div class="col-xs-4 col-xs-offset-2">
+                             <div t-field="o.partner_id" 
+                                 t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
+                         </div>
+                     </div>
+                     <h2>Request for Quotation <span t-field="o.name"/></h2>
+                     <table class="table table-condensed">
+                         <thead>
+                             <tr>
+                                 <th><strong>Description</strong></th>
+                                 <th class="text-center"><strong>Expected Date</strong></th>
+                                 <th class="text-right"><strong>Qty</strong></th>
+                             </tr>
+                         </thead>
+                         <tbody>
+                             <tr t-foreach="o.order_line" t-as="order_line">
+                                 <td>
+                                     <span t-field="order_line.name"/>
+                                 </td>
+                                 <td class="text-center">
+                                     <span t-field="order_line.date_planned"/>
+                                 </td>
+                                 <td class="text-right">
+                                     <span t-field="order_line.product_qty"/>
+                                     <span t-field="order_line.product_uom" groups="product.group_uom"/>
+                                 </td>
+                             </tr>
+                         </tbody>
+                     </table>
+                     <p t-field="o.notes"/>
+                     <span>Regards,</span>
+                     <span t-field="user.signature"/>
+                     <div class="oe_structure"/>
+                 </div>
+             </t>
+         </t>
+     </t>
+ </template>
+ </data>
+ </openerp>
+     
@@@ -43,8 -39,9 +43,9 @@@ keep track and order all your purchase 
                'purchase_requisition_data.xml',
                'purchase_requisition_view.xml',
                'purchase_requisition_report.xml',
 -              'security/ir.model.access.csv','purchase_requisition_sequence.xml',
 -
 +              'purchase_requisition_workflow.xml',
 +              'security/ir.model.access.csv','purchase_requisition_sequence.xml'
+               'views/report_purchaserequisition.xml',
      ],
      'auto_install': False,
      'test': [
@@@ -1,6 -1,13 +1,13 @@@
  <?xml version="1.0" encoding="utf-8"?>
  <openerp>
      <data>
-         <report auto="False" id="report_purchase_requisition" model="purchase.requisition" name="purchase.requisition" rml="purchase_requisition/report/purchase_requisition.rml" string="Call for Bids"/>
+         <report 
 -            string="Purchase Requisition" 
++            string="Call for Bids" 
+             id="action_report_purchase_requisitions" 
+             model="purchase.requisition" 
+             report_type="qweb-pdf"
+             name="purchase_requisition.report_purchaserequisitions" 
+             file="purchase_requisition.report_purchaserequisitions"
+          />
      </data>
  </openerp>
index 0000000,249558f..0d9798d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,97 +1,101 @@@
+ <?xml version="1.0" encoding="utf-8"?>
+ <openerp>
+ <data>
+ <template id="report_purchaserequisitions">
+     <t t-call="report.html_container">
+         <t t-foreach="docs" t-as="o">
+             <t t-call="report.external_layout">
+                 <div class="page">
+                     <div class="oe_structure"/>
 -                    <h2>Purchase for Requisitions <span t-field="o.name"/></h2>
++                    <h2>Call for Bids <span t-field="o.name"/></h2>
+                     <div class="row mt32 mb32">
+                         <div class="col-xs-3">
 -                            <strong>Requisition Reference:</strong><br/>
++                            <strong>Call for Bif Reference:</strong><br/>
+                             <span t-field="o.name"/>
+                         </div>
+                         <div class="col-xs-3">
 -                            <strong>Requisition Date:</strong><br/>
++                            <strong>Date:</strong><br/>
+                             <span t-field="o.date_start"/>
+                         </div>
+                         <div class="col-xs-3">
 -                            <strong>Type:</strong><br/>
++                            <strong>Selection Type:</strong><br/>
+                             <span t-if="o.exclusive=='exclusive'">Purchase Requisitions (exclusive)</span>
+                             <span t-if="o.exclusive=='multiple'">Multiple Requisitions</span>
+                         </div>
+                         <div class="col-xs-3">
+                             <strong>Source:</strong><br/>
+                             <span t-field="o.origin"/>
+                         </div>
+                     </div>
+                     <t t-if="o.line_ids">
 -                        <h3>Product Detail</h3>
++                        <h3>Products</h3>
+                         <table class="table table-condensed">
+                             <thead>
+                                 <tr>
+                                     <th><strong>Description</strong></th>
+                                     <th class="text-right"><strong>Qty</strong></th>
+                                     <th class="text-center" groups="product.group_uom">
+                                         <strong>Product UoM</strong>
+                                     </th>
++                                    <th class="text-right"><strong>Scheduled Date</strong></th>
+                                 </tr>
+                             </thead>
+                             <tbody>
+                                 <tr t-foreach="o.line_ids" t-as="line_ids">
+                                     <td>
+                                         [ <span t-field="line_ids.product_id.code"/> ]
+                                         <span t-field="line_ids.product_id.name"/>
+                                     </td>
+                                     <td class="text-right">
+                                         <span t-field="line_ids.product_qty"/>
+                                     </td>
+                                     <t>
+                                         <td class="text-center" groups="product.group_uom">
+                                             <span t-field="line_ids.product_uom_id.category_id.name"/>
+                                         </td>
+                                     </t>
++                                    <td class="text-right">
++                                        <span t-field="line_ids.schedule_date"/>
++                                    </td>
+                                 </tr>
+                             </tbody>
+                         </table>
+                     </t>
+                     
+                     <t t-if="o.purchase_ids">
 -                        <h3>Quotation Detail</h3>
++                        <h3>Requests for Quotation Details</h3>
+                         <table class="table table-condensed">
+                             <thead>
+                                 <tr>
+                                     <th><strong>Supplier </strong></th>
 -                                    <th><strong>Date Ordered </strong></th>
 -                                    <th class="text-right"><strong>Order Reference </strong></th>
++                                    <th><strong>Date</strong></th>
++                                    <th class="text-right"><strong>Reference </strong></th>
+                                 </tr>
+                             </thead>
+                             <tbody>
+                                 <tr t-foreach="o.purchase_ids" t-as="purchase_ids">
+                                     <td>
+                                         <span t-field="purchase_ids.partner_id.name"/>
+                                     </td>
+                                     <td class="text-center">
+                                         <span t-field="purchase_ids.date_order"/>
+                                     </td>
+                                     <td class="text-right">
+                                         <span t-field="purchase_ids.name"/>
+                                     </td>
+                                 </tr>
+                             </tbody>
+                         </table>
+                     </t>
+                     <div class="oe_structure"/>
+                 </div>
+             </t>
+         </t>
+     </t>
+ </template>
+ </data>
+ </openerp>
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -227,19 -401,22 +222,16 @@@ class product_product(osv.osv)
                   "In a context with a single Warehouse, this includes "
                   "goods leaving the Stock Location of this Warehouse, or "
                   "any of its children.\n"
-                  "In a context with a single Shop, this includes goods "
-                  "leaving the Stock Location of the Warehouse of this "
-                  "Shop, or any of its children.\n"
                   "Otherwise, this includes goods leaving any Stock "
                   "Location with 'internal' type."),
 -        'track_production': fields.boolean('Track Manufacturing Lots', help="Forces to specify a Serial Number for all moves containing this product and generated by a Manufacturing Order"),
          'track_incoming': fields.boolean('Track Incoming Lots', help="Forces to specify a Serial Number for all moves containing this product and coming from a Supplier Location"),
          'track_outgoing': fields.boolean('Track Outgoing Lots', help="Forces to specify a Serial Number for all moves containing this product and going to a Customer Location"),
 +        'track_all': fields.boolean('Full Lots Traceability', help="Forces to specify a Serial Number on each and every operation related to this product"),
          'location_id': fields.dummy(string='Location', relation='stock.location', type='many2one'),
          'warehouse_id': fields.dummy(string='Warehouse', relation='stock.warehouse', type='many2one'),
 -        'valuation':fields.selection([('manual_periodic', 'Periodical (manual)'),
 -                                        ('real_time','Real Time (automated)'),], 'Inventory Valuation',
 -                                        help="If real-time valuation is enabled for a product, the system will automatically write journal entries corresponding to stock moves." \
 -                                             "The inventory variation account set on the product category will represent the current inventory value, and the stock input and stock output account will hold the counterpart moves for incoming and outgoing products."
 -                                        , required=True),
 -    }
 -
 -    _defaults = {
 -        'valuation': 'manual_periodic',
 +        'orderpoint_ids': fields.one2many('stock.warehouse.orderpoint', 'product_id', 'Minimum Stock Rules'),
 +        'route_ids': fields.many2many('stock.location.route', 'stock_route_product', 'product_id', 'route_id', 'Routes', domain="[('product_selectable', '=', True)]",
 +                                    help="Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, MTO/MTS,..."),
      }
  
      def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):