[MERGE] merged the branch with stock demo data cleaning and improvements

bzr revid: qdp-launchpad@openerp.com-20131212095740-wuvkp8nexkyvvgd7
This commit is contained in:
Quentin (OpenERP)
2013-12-12 10:57:40 +01:00
10 changed files with 282 additions and 104 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class TestMrpMulticompany(common.TransactionCase):
model, group_user_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'base', 'group_user')
model, group_stock_manager_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'group_stock_manager')
model, company_2_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'res_company_2')
model, company_2_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'res_company_1')
self.multicompany_user_id = self.res_users.create(cr, uid,
{'name': 'multicomp', 'login': 'multicomp',
'groups_id': [(6, 0, [group_user_id, group_stock_manager_id])],
@@ -13,6 +13,7 @@
!record {model: res.users, id: res_mrp_operation_user}:
groups_id:
- mrp.group_mrp_user
- stock.group_stock_user
-
In order to test mrp_operations with OpenERP, I refer created production order of PC Assemble SC349
with routing - Manual Component's Assembly to test complete production process with respect of workcenter with giving access rights of MRP User.
+24
View File
@@ -17,6 +17,30 @@
<record id="product.product_product_consultant" model="product.product">
<field eval="False" name="purchase_ok"/>
</record>
<record id="product.product_product_48" model="product.product">
<field name="route_ids" eval="[(4,ref('route_warehouse0_buy'))]"></field>
</record>
<record id="product.product_product_36" model="product.product">
<field name="route_ids" eval="[(4,ref('route_warehouse0_buy'))]"></field>
</record>
<record id="product.product_product_28" model="product.product">
<field name="route_ids" eval="[(4,ref('route_warehouse0_buy'))]"></field>
</record>
<record id="product.product_product_46" model="product.product">
<field name="route_ids" eval="[(4,ref('route_warehouse0_buy'))]"></field>
</record>
<record id="product.product_product_23" model="product.product">
<field name="route_ids" eval="[(4,ref('route_warehouse0_buy'))]"></field>
</record>
<record id="product.product_product_20" model="product.product">
<field name="route_ids" eval="[(4,ref('route_warehouse0_buy'))]"></field>
</record>
</data>
</openerp>
+1 -1
View File
@@ -1,7 +1,7 @@
-
!python {model: stock.warehouse}: |
pull_obj = self.pool.get('procurement.rule')
wh_to_assign = ['stock_warehouse_shop0','stock_warehouse_shop1','warehouse_icecream']
wh_to_assign = ['stock_warehouse_shop0']
for wh_ref in wh_to_assign:
warehouse = self.browse(cr, uid, ref('stock.' + wh_ref), context=context)
#Force the rewriting of route and rule
@@ -28,6 +28,7 @@
!record {model: res.users, id: res_sale_stock_salesman}:
groups_id:
- base.group_sale_salesman_all_leads
- stock.group_stock_user
-
Create a user as 'Stock User'
-
+6 -7
View File
@@ -2,10 +2,15 @@
<openerp>
<data noupdate="0">
<record id="group_locations" model="res.groups">
<field name="name">Manage Multiple Locations and Warehouses</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_stock_user" model="res.groups">
<field name="name">User</field>
<field name="category_id" ref="base.module_category_warehouse_management"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="implied_ids" eval="[(4, ref('base.group_user')),(4, ref('stock.group_locations'))]"/>
</record>
<record id="group_stock_manager" model="res.groups">
<field name="name">Manager</field>
@@ -24,17 +29,11 @@
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_locations" model="res.groups">
<field name="name">Manage Multiple Locations and Warehouses</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_adv_location" model="res.groups">
<field name="name">Manage Push and Pull inventory flows</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_tracking_owner" model="res.groups">
<field name="name">Manage Different Stock Owners</field>
<field name="category_id" ref="base.module_category_hidden"/>
+6 -1
View File
@@ -3466,6 +3466,11 @@ class stock_picking_type(osv.osv):
group_begin_date = datetime.strptime(group['__domain'][0][2], DEFAULT_SERVER_DATE_FORMAT)
month_delta = relativedelta.relativedelta(month_begin, group_begin_date)
section_result[10 - (month_delta.months + 1)] = {'value': group.get(value_field, 0), 'tooltip': group_begin_date.strftime('%B')}
inner_groupby = (group.get('__context', {})).get('group_by',[])
if inner_groupby:
groupby_picking = obj.read_group(cr, uid, group.get('__domain'), read_fields, inner_groupby, context=context)
for groupby in groupby_picking:
section_result[10 - (month_delta.months + 1)]['value'] = groupby.get(value_field, 0)
return section_result
def _get_picking_data(self, cr, uid, ids, field_name, arg, context=None):
@@ -3481,7 +3486,7 @@ class stock_picking_type(osv.osv):
('date', '>=', groupby_begin),
('date', '<', groupby_end),
]
res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['date'], 'picking_type_id_count', 'date', context=context)
res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['date','picking_type_id'], 'picking_type_id_count', ['date','picking_type_id'], context=context)
return res
def _get_picking_count(self, cr, uid, ids, field_names, arg, context=None):
-61
View File
@@ -188,60 +188,6 @@
<field name="name">Your Company, Chicago shop</field>
</record>
<!-- Child Company 2-->
<record id="res_partner_company_2" model="res.partner">
<field name="name">Your Company, Birmingham shop</field>
<field eval="1" name="customer"/>
<field eval="1" name="supplier"/>
<field eval="1" name="active"/>
<field name="is_company">1</field>
<field name="street">82-85 Academy Avenue</field>
<field name="city">Birmingham</field>
<field name="zip">B46 3AG</field>
<field model="res.country" name="country_id" search="[('code','ilike','gb')]"/>
<field name="phone">+44 121 690 4596</field>
<field name="email">birmingham@yourcompany.com</field>
<field name="website">www.yourcompany.com</field>
</record>
<record id="res_partner_address_40" model="res.partner">
<field name="name">Donald Thompson</field>
<field name="parent_id" ref="res_partner_company_2"/>
<field name="use_parent_address" eval="1"/>
</record>
<record id="res_company_2" model="res.company">
<field name="currency_id" ref="base.GBP"/>
<field name="partner_id" ref="res_partner_company_2"/>
<field name="parent_id" ref="base.main_company"/>
<field name="name">Your Company, Birmingham shop</field>
</record>
<!--TOCHECK-->
<record id="stock_location_shop0" model="stock.location">
<field model="res.partner" name="partner_id" search="[('name','=','Fabien')]"/>
<field name="location_id" ref="stock.stock_location_locations"/>
<field name="company_id" ref="res_company_1"/>
<field name="usage">internal</field>
<field eval="1" name="active"/>
<field name="name">Your Company, Chicago shop</field>
</record>
<record id="stock_location_shop1" model="stock.location">
<field model="res.partner" name="partner_id" search="[('name','=','Eric')]"/>
<field name="company_id" ref="res_company_2"/>
<field name="location_id" ref="stock.stock_location_locations"/>
<field name="usage">internal</field>
<field eval="1" name="active"/>
<field name="name">Your Company, Birmingham shop</field>
</record>
<record id="stock_location_intermediatelocation0" model="stock.location">
<field name="partner_id" ref="base.main_partner"/>
<field name="location_id" ref="stock.stock_location_locations_partner"/>
<field name="usage">transit</field>
<field name="name">Internal Shippings</field>
<field name="company_id" eval="False"/>
</record>
<record id="stock_warehouse_shop0" model="stock.warehouse">
<field name="name">Chicago Warehouse</field>
<field name="lot_stock_id" ref="stock_location_shop0"/>
@@ -249,13 +195,6 @@
<field name="company_id" ref="res_company_1"/>
<field name="code">Chic</field>
</record>
<record id="stock_warehouse_shop1" model="stock.warehouse">
<field name="name">Birmingham Warehouse</field>
<field name="lot_stock_id" ref="stock_location_shop1"/>
<field name="partner_id" ref="res_partner_address_40"/>
<field name="company_id" ref="res_company_1"/>
<field name="code">Birm</field>
</record>
</data>
</openerp>
+241 -33
View File
@@ -1,30 +1,24 @@
-
!record {model: stock.location, id: location_refrigerator}:
name: Refrigerator
usage: internal
-
!record {model: stock.location, id: location_delivery_counter}:
name: Delivery Counter
usage: internal
!python {model: ir.model.data}: |
chicago_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock_warehouse_shop0'), context=context)
#create xml ids for demo data that are widely used in tests or in other codes, for more convenience
xml_references = [
{'name':'chi_picking_type_in','module':'stock', 'model':'stock.picking.type','res_id': chicago_warehouse.in_type_id.id},
{'name':'chi_picking_type_out','module':'stock', 'model':'stock.picking.type','res_id': chicago_warehouse.out_type_id.id},
{'name':'stock_location_shop0','module':'stock', 'model':'stock.location','res_id': chicago_warehouse.lot_stock_id.id},
]
for xml_record in xml_references:
xml_ids = self.search(cr, uid, [('module', '=', xml_record['module']), ('model', '=', xml_record['model']), ('name', '=', xml_record['name'])], context=context)
if not xml_ids:
self.create(cr, uid, xml_record, context=context)
#avoid the xml id and the associated resource being dropped by the orm by manually making a hit on it
self._update_dummy(cr, uid, xml_record['model'], xml_record['module'], xml_record['name'])
-
!record {model: stock.location, id: location_refrigerator_small}:
name: Small Refrigerator
usage: internal
location_id: location_refrigerator
-
!record {model: stock.location, id: location_opening}:
name: opening
usage: inventory
-
!record {model: stock.location, id: location_convenience_shop}:
name: Convenient Store
usage: supplier
-
!record {model: stock.warehouse, id: warehouse_icecream}:
name: Ice Cream Shop
code: ICE
lot_stock_id: location_refrigerator
code: Cream
location_id: stock_location_14
-
!record {model: product.product, id: product_icecream}:
default_code: 001
@@ -35,7 +29,7 @@
standard_price: 70.0
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
property_stock_inventory: location_opening
property_stock_inventory: location_inventory
description: Ice cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events.
-
!record {model: stock.production.lot, id: lot_icecream_0}:
@@ -56,7 +50,7 @@
inventory_id: stock_inventory_icecream
product_qty: 50.0
prod_lot_id: lot_icecream_0
location_id: location_refrigerator
location_id: stock_location_14
-
!record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot1}:
product_id: product_icecream
@@ -64,16 +58,63 @@
inventory_id: stock_inventory_icecream
product_qty: 40.0
prod_lot_id: lot_icecream_1
location_id: location_refrigerator
location_id: stock_location_14
-
Create STOCK_MOVE for OUT
-
!record {model: stock.move, id: outgoing_shipment_icecream}:
product_id: product_icecream
product_uom: product.product_uom_kgm
product_uom_qty: 130.0
location_id: location_refrigerator
location_dest_id: location_delivery_counter
!record {model: stock.picking, id: outgoing_shipment_main_warehouse}:
picking_type_id: stock.picking_type_out
origin: 'outgoing shipment main_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_27
product_uom: product.product_uom_unit
product_uom_qty: 15.0
picking_type_id: stock.picking_type_out
location_id: stock.stock_location_stock
location_dest_id: stock.stock_location_customers
-
!record {model: stock.picking, id: outgoing_shipment_main_warehouse1}:
picking_type_id: stock.picking_type_out
origin: 'outgoing shipment'
partner_id: base.res_partner_6
date: !eval "'%s-%s-15' %(datetime.now().year,datetime.now().month-2)"
move_lines:
- product_id: product.product_product_6
product_uom: product.product_uom_unit
product_uom_qty: 180.0
picking_type_id: stock.picking_type_out
location_id: stock.stock_location_stock
location_dest_id: stock.stock_location_customers
pack_operation_ids:
- product_id: product.product_product_6
product_qty: 100
product_uom_id: product.product_uom_unit
-
!record {model: stock.picking, id: outgoing_shipment_main_warehouse2}:
picking_type_id: stock.picking_type_out
origin: 'outgoing shipment your_company warehouse'
partner_id: base.res_partner_6
date: !eval "'%s-%s-15' %(datetime.now().year,datetime.now().month-1)"
move_lines:
- product_id: product.product_product_31
product_uom: product.product_uom_unit
product_uom_qty: 45.0
picking_type_id: stock.picking_type_out
location_id: stock.stock_location_stock
location_dest_id: stock.stock_location_customers
-
!record {model: stock.picking, id: outgoing_shipment_main_warehouse3}:
picking_type_id: stock.picking_type_out
origin: 'your company warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_5
product_uom: product.product_uom_unit
product_uom_qty: 75.0
picking_type_id: stock.picking_type_out
location_id: stock.stock_location_stock
location_dest_id: stock.stock_location_customers
-
Create STOCK_PICKING for IN
-
@@ -87,5 +128,172 @@
product_uom: product.product_uom_kgm
product_uom_qty: 50.0
picking_type_id: stock.picking_type_in
location_id: location_convenience_shop
location_dest_id: location_refrigerator
location_id: stock_location_suppliers
location_dest_id: stock_location_14
-
!record {model: stock.picking, id: incomming_shipment1}:
picking_type_id: stock.picking_type_in
origin: 'incomming_shipment'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_48
product_uom: product.product_uom_unit
product_uom_qty: 35.0
picking_type_id: stock.picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_stock
-
!record {model: stock.picking, id: incomming_shipment2}:
picking_type_id: stock.picking_type_in
origin: 'incomming_shipment main_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_22
product_uom: product.product_uom_unit
product_uom_qty: 125.0
picking_type_id: stock.picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_stock
-
!record {model: stock.picking, id: incomming_shipment3}:
picking_type_id: stock.picking_type_in
origin: 'incomming_shipment your_company warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_10
product_uom: product.product_uom_unit
product_uom_qty: 120.0
picking_type_id: stock.picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_stock
-
!record {model: stock.picking, id: incomming_shipment4}:
picking_type_id: stock.picking_type_in
origin: 'incomming_shipment_main_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_31
product_uom: product.product_uom_unit
product_uom_qty: 50.0
picking_type_id: stock.picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_stock
-
Create STOCK_PICKING_IN for Chicago Warehouse
-
!record {model: stock.picking, id: incomming_chicago_warehouse}:
picking_type_id: chi_picking_type_in
origin: 'incomming_chicago_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_9
product_uom: product.product_uom_unit
product_uom_qty: 25.0
picking_type_id: chi_picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_shop0
-
!record {model: stock.picking, id: incomming_chicago_warehouse1}:
picking_type_id: chi_picking_type_in
origin: 'incomming_shipment_chicago_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_48
product_uom: product.product_uom_unit
product_uom_qty: 180.0
picking_type_id: chi_picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_shop0
state: done
pack_operation_ids:
- product_id: product.product_product_48
product_qty: 100
product_uom_id: product.product_uom_unit
-
!record {model: stock.picking, id: incomming_chicago_warehouse2}:
picking_type_id: chi_picking_type_in
origin: 'incomming_shipment chicago_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_32
product_uom: product.product_uom_unit
product_uom_qty: 45.0
picking_type_id: chi_picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_shop0
-
!record {model: stock.picking, id: incomming_chicago_warehouse3}:
picking_type_id: chi_picking_type_in
origin: 'chicago_warehouse'
partner_id: base.res_partner_6
date: !eval "'%s-%s-2' %(datetime.now().year,datetime.now().month-1)"
move_lines:
- product_id: product.product_product_22
product_uom: product.product_uom_unit
product_uom_qty: 75.0
picking_type_id: chi_picking_type_in
location_id: stock.stock_location_suppliers
location_dest_id: stock.stock_location_shop0
-
Create STOCK_PICKING_OUT for Chicago Warehouse
-
!record {model: stock.picking, id: outgoing_chicago_warehouse}:
picking_type_id: chi_picking_type_out
origin: 'outgoing_chicago_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_27
product_uom: product.product_uom_unit
product_uom_qty: 15.0
picking_type_id: chi_picking_type_out
location_id: stock.stock_location_shop0
location_dest_id: stock.stock_location_customers
-
!record {model: stock.picking, id: outgoing_chicago_warehouse1}:
picking_type_id: chi_picking_type_out
origin: 'outgoing_shipment_chicago_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_6
product_uom: product.product_uom_unit
product_uom_qty: 180.0
picking_type_id: chi_picking_type_out
location_id: stock.stock_location_shop0
location_dest_id: stock.stock_location_customers
pack_operation_ids:
- product_id: product.product_product_6
product_qty: 100
product_uom_id: product.product_uom_unit
-
!record {model: stock.picking, id: outgoing_chicago_warehouse2}:
picking_type_id: chi_picking_type_out
origin: 'chicago_warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_31
product_uom: product.product_uom_unit
product_uom_qty: 45.0
picking_type_id: chi_picking_type_out
location_id: stock.stock_location_shop0
location_dest_id: stock.stock_location_customers
-
!record {model: stock.picking, id: outgoing_chicago_warehouse3}:
picking_type_id: chi_picking_type_out
origin: 'outgoing chicago warehouse'
partner_id: base.res_partner_6
move_lines:
- product_id: product.product_product_5
product_uom: product.product_uom_unit
product_uom_qty: 75.0
picking_type_id: chi_picking_type_out
location_id: stock.stock_location_shop0
location_dest_id: stock.stock_location_customers
-
!python {model: stock.picking}: |
self.action_confirm(cr, uid, [ref('outgoing_shipment_main_warehouse'),ref('outgoing_shipment_main_warehouse1'),ref('incomming_shipment2'),ref('incomming_shipment1'),ref('incomming_shipment3'),ref('outgoing_chicago_warehouse3'),ref('outgoing_chicago_warehouse2'),ref('outgoing_chicago_warehouse1'),ref('incomming_chicago_warehouse1'),ref('incomming_chicago_warehouse2'),ref('incomming_chicago_warehouse3')], context=context)
record = self.browse(cr, uid, ref('outgoing_shipment_main_warehouse1'), context=context)
record_chi_in = self.browse(cr, uid, ref('incomming_chicago_warehouse1'), context=context)
record_chi_out = self.browse(cr, uid, ref('outgoing_chicago_warehouse1'), context=context)
if record.state != 'done' and record_chi_in.state != 'done' and record_chi_out.state != 'done':
self.force_assign(cr, uid, [ref('outgoing_shipment_main_warehouse'),ref('outgoing_chicago_warehouse3'),ref('outgoing_shipment_main_warehouse2')], context=context)
self.do_transfer(cr, uid, [ref('outgoing_shipment_main_warehouse1'),ref('incomming_chicago_warehouse1'),ref('outgoing_chicago_warehouse1')], context=context)
@@ -4,6 +4,7 @@
<field name="description">This product is configured with example of push/pull flows</field>
</record>
<record id="stock_warehouse_orderpoint_shop1_cpu1" model="stock.warehouse.orderpoint">
<field name="product_max_qty">20.0</field>
<field name="product_min_qty">10.0</field>