[WIP] Remove procure_method in procurement, stock, stock_location

bzr revid: jco@openerp.com-20130709151528-4cilv2pbed5py14k
This commit is contained in:
Josse Colpaert 2013-07-09 17:15:28 +02:00
parent 277531f21d
commit c4b15ad151
8 changed files with 11 additions and 46 deletions

View File

@ -16,7 +16,6 @@
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom" string="Unit of Measure"/>
<field name="procure_method"/>
<field name="state"/>
</tree>
</field>
@ -49,7 +48,6 @@
<group>
<group>
<field name="date_planned"/>
<field name="procure_method"/>
<field name="priority"/>
</group>
<group>

View File

@ -3,30 +3,26 @@
<data noupdate="1">
<record id="product.product_product_1" model="product.product">
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
<record id="product.product_product_2" model="product.product">
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
<record id="product.product_product_3" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
<record id="product.product_product_4" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
<record id="product.product_product_5" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
@ -44,7 +40,6 @@
<record id="product.product_product_9" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
</record>
<record id="product.product_product_10" model="product.product">
@ -57,7 +52,6 @@
<record id="product.product_product_12" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
</record>
<record id="product.product_product_13" model="product.product">
@ -74,7 +68,6 @@
<record id="product.product_product_16" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
@ -84,13 +77,11 @@
<record id="product.product_product_18" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
<record id="product.product_product_19" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
@ -124,7 +115,6 @@
<record id="product.product_product_27" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>
@ -150,7 +140,6 @@
<record id="product.product_product_33" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
</record>
<record id="product.product_product_34" model="product.product">
@ -167,7 +156,6 @@
<record id="product.product_product_37" model="product.product">
<field name="type">product</field>
<field name="procure_method">make_to_order</field>
</record>
<record id="product.product_product_38" model="product.product">
@ -179,7 +167,6 @@
</record>
<record id="product.product_product_44" model="product.product">
<field name="procure_method">make_to_order</field>
<field name="supply_method">produce</field>
</record>

View File

@ -68,10 +68,13 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<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"/>
</xpath>
<group name="procurement_uom" position="before">
<group name="delay" string="Delays">
<label for="produce_delay" attrs="{'invisible':[('type','=','service')]}"/>
@ -87,6 +90,7 @@
<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"/>
@ -123,6 +127,7 @@
<field name="property_stock_inventory" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','inventory')]"/>
</group>
</group>
</field>
</record>
@ -244,30 +249,11 @@
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
</xpath>
<xpath expr="//field[@name='cost_method']" position="before">
<field name="procure_method" groups="base.group_user"/>
<field name="supply_method" groups="base.group_user"/>
</xpath>
<xpath expr="//group[@name='general']" position="after" >
<group name="procurement_help" class="oe_grey" col="1" groups="base.group_user">
<p attrs="{'invisible': ['|','|',('type','&lt;&gt;','service'),('procure_method','&lt;&gt;','make_to_stock')]}">
When you sell this service, nothing special will be triggered
to deliver the customer, as you set the procurement method as
'Make to Stock'.
</p>
<p attrs="{'invisible': ['|','|',('type','&lt;&gt;','product'),('procure_method','&lt;&gt;','make_to_stock')]}">
When you sell this product, OpenERP will <b>use the available
inventory</b> for the delivery order.
<br/><br/>
If there are not enough quantities available, the delivery order
will wait for new products. To fulfill the inventory, you should
create others rules like orderpoints.
</p>
<p attrs="{'invisible': ['|','|',('type','&lt;&gt;','consu'),('procure_method','&lt;&gt;','make_to_stock')]}">
When you sell this product, a delivery order will be created.
OpenERP will consider that the <b>required quantities are always
available</b> as it's a consumable (as a result of this, the quantity
on hand may become negative).
</p>
<!--TODO: Should write explanation for different routes-->
</group>
</xpath>
</field>

View File

@ -1774,6 +1774,7 @@ class stock_move(osv.osv):
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c),
'date_expected': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'procure_method': 'make_to_order', #TODO: Might need to be changed or supplied
}
def _create_procurement(self, cr, uid, move, context=None):
@ -1792,8 +1793,7 @@ class stock_move(osv.osv):
'product_uom': move.product_uom.id,
'product_uos_qty': (move.product_uos and move.product_uos_qty) or move.product_qty,
'product_uos': (move.product_uos and move.product_uos.id) or move.product_uom.id,
'location_id': move.location_src_id.id,
'procure_method': move.procure_method,
'location_id': move.location_id.id,
'move_id': move.id,
})
@ -2998,7 +2998,6 @@ class product_template(osv.osv):
'supply_method': fields.selection([('produce', 'Manufacture'), ('buy', 'Buy')], 'Supply Method', required=True, help="Manufacture: When procuring the product, a manufacturing order or a task will be generated, depending on the product type. \nBuy: When procuring the product, a purchase order will be generated."),
}
_defaults = {
'procure_method': 'make_to_stock',
'supply_method': 'buy',
}

View File

@ -35,7 +35,6 @@
standard_price: 70.0
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
procure_method: make_to_stock
property_stock_inventory: location_opening
valuation: real_time
cost_method: average

View File

@ -1081,6 +1081,7 @@
<field name="name" invisible="1"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
<field name="type" invisible="1"/>
<field name="procure_method"/>
<label for="product_uom_qty"/>
<div>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)" class="oe_inline"/>
@ -1568,7 +1569,6 @@
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='type']" position="after">
<field name="procure_method"/>
<field name="supply_method"/>
</xpath>
</field>

View File

@ -74,7 +74,6 @@ class make_procurement(osv.osv_memory):
'product_qty': proc.qty,
'product_uom': proc.uom_id.id,
'location_id': wh.lot_stock_id.id,
'procure_method':'make_to_order',
'company_id': wh.company_id.id,
})
procurement_obj.signal_button_confirm(cr, uid, [procure_id])

View File

@ -108,7 +108,7 @@ class procurement_rule(osv.osv):
_inherit = 'procurement.rule'
_columns = {
'route_id': fields.many2one('stock.location.route', 'Route',
help="If route_id is False, the route is global"),
help="If route_id is False, the rule is global"),
'delay': fields.integer('Number of Hours'),
'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procure Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."),
'type_proc': fields.selection([('produce','Produce'),('buy','Buy'),('move','Move')], 'Type of Procurement', required=True),
@ -141,7 +141,6 @@ class procurement_order(osv.osv):
newdate = (datetime.strptime(date, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.rule_id.delay or 0)).strftime('%Y-%m-%d %H:%M:%S')
d.update({
'date_planned': newdate,
'procure_method': procurement.rule_id.procure_method,
})
return d
@ -207,8 +206,6 @@ class stock_move(osv.osv):
_columns = {
'cancel_cascade': fields.boolean('Cancel Cascade', help='If checked, when this move is cancelled, cancel the linked move too'),
'putaway_ids': fields.one2many('stock.move.putaway', 'move_id', 'Put Away Suggestions'),
'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')],
'Procure Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."),
}