[WIP] Put product view together in stock_view, make mrp independent of purchase and correct single quant move in stock_account when creating quants

bzr revid: jco@openerp.com-20130715093053-19gahkhq9gnqzlsy
This commit is contained in:
Josse Colpaert 2013-07-15 11:30:53 +02:00
parent 421a349958
commit 670df13e80
8 changed files with 163 additions and 178 deletions

View File

@ -29,7 +29,7 @@
'sequence': 18,
'summary': 'Manufacturing Orders, Bill of Materials, Routing',
'images': ['images/bill_of_materials.jpeg', 'images/manufacturing_order.jpeg', 'images/planning_manufacturing_order.jpeg', 'images/manufacturing_analysis.jpeg', 'images/production_dashboard.jpeg','images/routings.jpeg','images/work_centers.jpeg'],
'depends': ['product','procurement', 'stock', 'resource', 'purchase','process'],
'depends': ['product','procurement', 'stock_account', 'resource','process'],
'description': """
Manage the Manufacturing process in OpenERP
===========================================

View File

@ -38,7 +38,7 @@
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_rfq0" model="process.node">
<!-- <record id="process_node_rfq0" model="process.node">
<field name="menu_id" ref="purchase.menu_purchase_form_action"/>
<field name="model_id" ref="purchase.model_purchase_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
@ -48,7 +48,7 @@
<field name="process_id" ref="process_process_stockableproductprocess0"/>
<field eval="&quot;&quot;&quot;object.state=='draft'&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
</record>-->
<record id="process_node_production0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_production_action"/>
@ -65,13 +65,13 @@
Process Transition
-->
<record id="process_transition_stockrfq0" model="process.transition">
<!-- <record id="process_transition_stockrfq0" model="process.transition">
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;To Buy&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;In case the Supply method of the product is Buy, the system creates a purchase order.&quot;&quot;&quot;" name="note"/>
<field name="target_node_id" ref="process_node_rfq0"/>
<field name="source_node_id" ref="process_node_stock0"/>
</record>
</record>-->
<record id="process_transition_stockproduction0" model="process.transition">
<field eval="[(6,0,[])]" name="transition_ids"/>

View File

@ -19,8 +19,6 @@ access_stock_picking_mrp_worker,stock.picking mrp_worker,stock.model_stock_picki
access_stock_warehouse,stock.warehouse mrp_worker,stock.model_stock_warehouse,mrp.group_mrp_user,1,0,0,0
access_account_analytic_journal_mrp_worker,account.analytic.journal mrp_worker,account.model_account_analytic_journal,mrp.group_mrp_user,1,0,0,0
access_account_account,account.account mrp_worker,account.model_account_account,mrp.group_mrp_user,1,0,0,0
access_purchase_order_mrp_worker,purchase.order mrp_worker,purchase.model_purchase_order,mrp.group_mrp_user,1,0,0,0
access_purchase_order_line_mrp_worker,purchase.order.line mrp_worker,purchase.model_purchase_order_line,mrp.group_mrp_user,1,0,0,0
access_hr_timesheet_group_mrp_worker,resource.calendar mrp_manager,resource.model_resource_calendar,mrp.group_mrp_manager,1,1,1,1
access_procurement_user,procurement.order.user,model_procurement_order,base.group_user,1,1,1,1
access_mrp_production_stock_worker,mrp.production stock_worker,model_mrp_production,stock.group_stock_user,1,0,0,0
@ -72,8 +70,6 @@ access_product_pricelist_version_mrp_manager,product.pricelist.version mrp_manag
access_product_pricelist_item_mrp_manager,product.pricelist.item mrp_manager,product.model_product_pricelist_item,mrp.group_mrp_manager,1,1,1,1
access_resource_calendar_manufacturinguser,resource.calendar manufacturing.user,resource.model_resource_calendar,mrp.group_mrp_user,1,0,0,0
access_account_journal_mrp_manager,account.journal mrp manager,account.model_account_journal,mrp.group_mrp_manager,1,0,0,0
access_purchase_order_stock_user,purchase.order stock user,purchase.model_purchase_order,stock.group_stock_user,1,1,1,0
access_mrp_bom_purchase_manager,mrp.bom,model_mrp_bom,purchase.group_purchase_manager,1,0,0,0
access_mrp_property_group,mrp.property.group,model_mrp_property_group,stock.group_stock_manager,1,1,1,1
access_mrp_property,mrp.property,model_mrp_property,stock.group_stock_manager,1,1,1,1
access_mrp_property_group,mrp.property.group,model_mrp_property_group,base.group_user,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
19 access_stock_warehouse stock.warehouse mrp_worker stock.model_stock_warehouse mrp.group_mrp_user 1 0 0 0
20 access_account_analytic_journal_mrp_worker account.analytic.journal mrp_worker account.model_account_analytic_journal mrp.group_mrp_user 1 0 0 0
21 access_account_account account.account mrp_worker account.model_account_account mrp.group_mrp_user 1 0 0 0
access_purchase_order_mrp_worker purchase.order mrp_worker purchase.model_purchase_order mrp.group_mrp_user 1 0 0 0
access_purchase_order_line_mrp_worker purchase.order.line mrp_worker purchase.model_purchase_order_line mrp.group_mrp_user 1 0 0 0
22 access_hr_timesheet_group_mrp_worker resource.calendar mrp_manager resource.model_resource_calendar mrp.group_mrp_manager 1 1 1 1
23 access_procurement_user procurement.order.user model_procurement_order base.group_user 1 1 1 1
24 access_mrp_production_stock_worker mrp.production stock_worker model_mrp_production stock.group_stock_user 1 0 0 0
70 access_product_pricelist_item_mrp_manager product.pricelist.item mrp_manager product.model_product_pricelist_item mrp.group_mrp_manager 1 1 1 1
71 access_resource_calendar_manufacturinguser resource.calendar manufacturing.user resource.model_resource_calendar mrp.group_mrp_user 1 0 0 0
72 access_account_journal_mrp_manager account.journal mrp manager account.model_account_journal mrp.group_mrp_manager 1 0 0 0
access_purchase_order_stock_user purchase.order stock user purchase.model_purchase_order stock.group_stock_user 1 1 1 0
access_mrp_bom_purchase_manager mrp.bom model_mrp_bom purchase.group_purchase_manager 1 0 0 0
73 access_mrp_property_group mrp.property.group model_mrp_property_group stock.group_stock_manager 1 1 1 1
74 access_mrp_property mrp.property model_mrp_property stock.group_stock_manager 1 1 1 1
75 access_mrp_property_group mrp.property.group model_mrp_property_group base.group_user 1 0 0 0

View File

@ -41,83 +41,6 @@
</field>
</record>
<record id="view_normal_procurement_locations_form" model="ir.ui.view">
<field name="name">product.normal.procurement.locations.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='general']" position="after" >
<group name="procurement_help" class="oe_grey" col="1" groups="base.group_user">
<!--TODO: Should write explanation for different routes-->
</group>
</xpath>
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Inventory" name="%(action_product_location_tree)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations"/>
<button string="Moves" name= "%(act_product_stock_move_open)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_stock_user"/>
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
</xpath>
<xpath expr="//field[@name='standard_price']" position="before">
<field name="supply_method" groups="base.group_user"/>
</xpath>
<group name="procurement_uom" position="before">
<group name="delay" string="Delays">
<label for="produce_delay" attrs="{'invisible':[('type','=','service')]}"/>
<div attrs="{'invisible':[('type','=','service')]}">
<field name="produce_delay" class="oe_inline"/> days
</div>
<field name="active"/>
</group>
</group>
<xpath expr="//group[@string='Sale Conditions']" position="inside">
<label for="sale_delay"/>
<div>
<field name="sale_delay" class="oe_inline"/> days
</div>
</xpath>
<group name="status" position="before" version="7.0">
<group string="Stock and Expected Variations" attrs="{'invisible': [('type', '=', 'service')]}" groups="base.group_user">
<label for="qty_available"/>
<div>
<field name="qty_available" class="oe_inline"/>
<button name="%(action_view_change_product_quantity)d" string="⇒ Update"
type="action"
class="oe_link"/>
</div>
<label for="incoming_qty"/>
<div>
<field name="incoming_qty" class="oe_inline"/>
<button string="⇒ Request Procurement" name="%(act_make_procurement)d" type="action" class="oe_link"/>
</div>
<field name="outgoing_qty" class="oe_inline"/>
<field name="virtual_available" class="oe_inline"/>
</group>
<group name="lot" groups="stock.group_tracking_lot,stock.group_production_lot" string="Lots">
<field name="track_production" groups="stock.group_production_lot"/>
<field name="track_incoming" groups="stock.group_tracking_lot"/>
<field name="track_outgoing" groups="stock.group_tracking_lot"/>
</group>
</group>
<group name="status" position="after" version="7.0">
<group name="store" string="Storage Location" attrs="{'invisible':[('type','=','service')]}">
<field name="loc_rack"/>
<field name="loc_row"/>
<field name="loc_case"/>
</group>
</group>
<group name="Weights" position="after">
<group name="store" groups="stock.group_locations" string="Counter-Part Locations Properties">
<field name="property_stock_procurement" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','procurement')]"/>
<field name="property_stock_production" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','production')]"/>
<field name="property_stock_inventory" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','inventory')]"/>
</group>
</group>
</field>
</record>
<record id="action_receive_move" model="ir.actions.act_window">
<field name="name">Receptions</field>

View File

@ -199,6 +199,7 @@ class stock_quant(osv.osv):
'reservation_id': move.move_dest_id and move.move_dest_id.id or False,
'history_ids': [(4, move.id)]
})
return quant
# FP Note: TODO: implement domain preference that tries to retrieve first with this domain

View File

@ -1589,21 +1589,90 @@
</field>
</record>
<record id="view_normal_procurement_locations_form" model="ir.ui.view">
<field name="name">product.normal.procurement.locations.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='general']" position="after" >
<group name="procurement_help" class="oe_grey" col="1" groups="base.group_user">
<!--TODO: Should write explanation for different routes-->
</group>
</xpath>
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Inventory" name="%(action_product_location_tree)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations"/>
<button string="Moves" name= "%(act_product_stock_move_open)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_stock_user"/>
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
</xpath>
<xpath expr="//field[@name='standard_price']" position="before">
<field name="supply_method" groups="base.group_user"/>
</xpath>
<group name="procurement_uom" position="before">
<group name="delay" string="Delays">
<label for="produce_delay" attrs="{'invisible':[('type','=','service')]}"/>
<div attrs="{'invisible':[('type','=','service')]}">
<field name="produce_delay" class="oe_inline"/> days
</div>
<field name="active"/>
</group>
</group>
<xpath expr="//group[@string='Sale Conditions']" position="inside">
<label for="sale_delay"/>
<div>
<field name="sale_delay" class="oe_inline"/> days
</div>
</xpath>
<group name="status" position="after" version="7.0">
<group name="store" string="Storage Location" attrs="{'invisible':[('type','=','service')]}">
<field name="loc_rack"/>
<field name="loc_row"/>
<field name="loc_case"/>
</group>
</group>
<group name="Weights" position="after">
<group name="store" groups="stock.group_locations" string="Counter-Part Locations Properties">
<field name="property_stock_procurement" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','procurement')]"/>
<field name="property_stock_production" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','production')]"/>
<field name="property_stock_inventory" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','inventory')]"/>
</group>
</group>
</field>
</record>
<record model="ir.ui.view" id="product_form_view_procurement_button">
<field name="name">product.product.procurement</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="view_normal_procurement_locations_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='incoming_qty']" position="after">
<button string="⇒ Request Procurement" name="%(act_make_procurement)d" type="action" class="oe_link"/>
</xpath>
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
</xpath>
<xpath expr="//field[@name='standard_price']" position="after">
<field name="supply_method" groups="base.group_user"/>
</xpath>
<group name="status" position="before" version="7.0">
<group string="Stock and Expected Variations" attrs="{'invisible': [('type', '=', 'service')]}" groups="base.group_user">
<label for="qty_available"/>
<div>
<field name="qty_available" class="oe_inline"/>
<button name="%(action_view_change_product_quantity)d" string="⇒ Update"
type="action"
class="oe_link"/>
</div>
<label for="incoming_qty"/>
<div>
<field name="incoming_qty" class="oe_inline"/>
<button string="⇒ Request Procurement" name="%(act_make_procurement)d" type="action" class="oe_link"/>
</div>
<field name="outgoing_qty" class="oe_inline"/>
<field name="virtual_available" class="oe_inline"/>
</group>
<group name="lot" groups="stock.group_tracking_lot,stock.group_production_lot" string="Lots">
<field name="track_production" groups="stock.group_production_lot"/>
<field name="track_incoming" groups="stock.group_tracking_lot"/>
<field name="track_outgoing" groups="stock.group_tracking_lot"/>
</group>
</group>
</field>
</record>

View File

@ -99,10 +99,11 @@ class stock_quant(osv.osv):
account_moves += self._create_account_move_line(cr, uid, quant, acc_valuation, acc_dest, context=context)
def move_single_quant(self, cr, uid, quant, qty, move, context=None):
location_from = quant.location_id
super(stock_quant, self).move_single_quant(cr, uid, quant, qty, move, context=context)
quant = super(stock_quant, self).move_single_quant(cr, uid, quant, qty, move, context=context)
quant.refresh()
location_from = quant.location_id
self._account_entry_move(cr, uid, quant, location_from, quant.location_id, move, context=context)
return quant
# TODO: move this code on the _account_entry_move method above. Should be simpler

View File

@ -25,11 +25,6 @@
name: Gate A
usage: internal
location_id: location_dispatch_zone
-
!record {model: stock.location, id: location_pack_zone}:
name: Pack Zone
usage: internal
location_id: location_order
-
!record {model: stock.location, id: location_gate_b}:
name: Gate B