[MERGE]merge parent branch

bzr revid: prajapatijitendra7969@gmail.com-20130816060047-8vlfdmfykyr8h9km
This commit is contained in:
Jitendra Prajapati (OpenERP)
2013-08-16 11:30:47 +05:30
12 changed files with 62 additions and 53 deletions
@@ -16,11 +16,13 @@
</record>
<record id="stock.property_stock_account_input_categ" model="ir.property">
<field name="fields_id" search="[('model','=','product.category'),('name','=','property_stock_account_input_categ')]"/>
<field eval="'account.account,'+str(ref('chart2141_en'))" model="account.account" name="value"/>
<field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/>
</record>
<record id="stock.property_stock_account_output_categ" model="ir.property">
<field name="fields_id" search="[('model','=','product.category'),('name','=','property_stock_account_output_categ')]"/>
<field eval="'account.account,'+str(ref('chart1145_en'))" model="account.account" name="value"/>
<field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/>
</record>
+3 -1
View File
@@ -15,11 +15,13 @@
</record>
<record id="stock.property_stock_account_input_categ" model="ir.property">
<field name="fields_id" search="[('model','=','product.category'),('name','=','property_stock_account_input_categ')]"/>
<field eval="'account.account,'+str(ref('chart2171_fr'))" model="account.account" name="value"/>
<field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/>
</record>
</record>
<record id="stock.property_stock_account_output_categ" model="ir.property">
<field name="fields_id" search="[('model','=','product.category'),('name','=','property_stock_account_output_categ')]"/>
<field eval="'account.account,'+str(ref('chart1145_fr'))" model="account.account" name="value"/>
<field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/>
</record>
+21 -1
View File
@@ -452,6 +452,25 @@ class mrp_production(osv.osv):
result[mrp_production.id] = done / mrp_production.product_qty * 100
return result
def _moves_assigned(self, cr, uid, ids, name, arg, context=None):
""" Test whether all the consume lines are assigned """
res = True
for production in self.browse(cr, uid, ids, context=context):
states = [x.state != 'assigned' for x in production.move_lines if x]
if any(states) or len(states) == 0:
return False
return res
def _mrp_from_move(self, cr, uid, ids, context=None):
""" Return mrp"""
res = []
for move in self.browse(cr, uid, ids, context=context):
res += self.pool.get("mrp.production").search(cr, uid, [('move_lines', 'in', move.id)], context=context)
return res
_columns = {
'name': fields.char('Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}),
'origin': fields.char('Source Document', size=64, readonly=True, states={'draft': [('readonly', False)]},
@@ -510,6 +529,8 @@ class mrp_production(osv.osv):
'cycle_total': fields.function(_production_calc, type='float', string='Total Cycles', multi='workorder', store=True),
'user_id':fields.many2one('res.users', 'Responsible'),
'company_id': fields.many2one('res.company','Company',required=True),
'ready_production': fields.function(_moves_assigned, type='boolean', store={'stock.move': (_mrp_from_move, ['state'], 10)}),
}
_defaults = {
'priority': lambda *a: '1',
@@ -554,7 +575,6 @@ class mrp_production(osv.osv):
'move_created_ids2' : [],
'product_lines' : [],
'move_prod_id' : False,
'picking_id' : False
})
return super(mrp_production, self).copy(cr, uid, id, default, context)
+2 -2
View File
@@ -43,7 +43,7 @@
<field name="wkf_id" ref="wkf_prod"/>
<field name="flow_stop">True</field>
<field name="kind">function</field>
<field name="action">action_production_end()</field>
<field name="action">action_production_end()</field>
<field name="name">done</field>
</record>
<record id="prod_act_cancel" model="workflow.activity">
@@ -70,7 +70,7 @@
<field name="act_from" ref="prod_act_picking"/>
<field name="act_to" ref="prod_act_ready"/>
<field name="signal"></field>
<field name="condition">picking_id and picking_id.state=='done'</field>
<field name="condition">ready_production</field>
</record>
<record id="prod_trans_ready_in_production" model="workflow.transition">
<field name="act_from" ref="prod_act_ready"/>
+1 -2
View File
@@ -92,8 +92,7 @@ class procurement_order(osv.osv):
def get_phantom_bom_id(self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids, context=context):
if procurement.move_dest_id and procurement.move_dest_id.product_id.supply_method=='produce' \
and procurement.move_dest_id.product_id.procure_method=='make_to_order':
if procurement.move_dest_id and procurement.move_dest_id.product_id.supply_method=='produce':
phantom_bom_id = self.pool.get('mrp.bom').search(cr, uid, [
('product_id', '=', procurement.move_dest_id.product_id.id),
('bom_id', '=', False),
+3 -3
View File
@@ -32,7 +32,7 @@ class procurement_order(osv.osv):
}
def _is_procurement_task(self, cr, uid, procurement, context=None):
return procurement.product_id.type == 'service' and procurement.product_it.auto_create_task or False
return procurement.product_id.type == 'service' and procurement.product_id.auto_create_task or False
def _assign(self, cr, uid, procurement, context=None):
res = super(procurement_order, self)._assign(cr, uid, procurement, context=context)
@@ -123,9 +123,9 @@ class product_product(osv.osv):
class sale_order(osv.osv):
_inherit = 'sale.order'
def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None):
def _prepare_order_line_procurement(self, cr, uid, order, line, group_id=False, context=None):
proc_data = super(sale_order, self)._prepare_order_line_procurement(cr,
uid, order, line, move_id, date_planned, context=context)
uid, order, line, group_id = group_id, context=context)
proc_data['sale_line_id'] = line.id
return proc_data
-7
View File
@@ -49,13 +49,6 @@
<xpath expr="//field[@name='supply_method']" position="attributes">
<attribute name="invisible">False</attribute>
</xpath>
<group name="procurement_help" position="inside">
<p attrs="{'invisible': ['|','|',('type','&lt;&gt;','service'),('procure_method','&lt;&gt;','make_to_order'),('supply_method','&lt;&gt;','produce')]}">
When you sell this service to a customer, <b>a task</b> will be
created to follow up the job to do. This task will appear
in the project related to the contract of the sales order.
</p>
</group>
</field>
</record>
</data>
@@ -4,7 +4,6 @@
!record {model: product.product, id: product_onchange1}:
name: 'Devil Worship Book'
list_price: 66.6
procure_method: 'make_to_order'
-
Now i create a sale order that uses my new product
-
@@ -19,4 +18,3 @@
!assert {model: sale.order, id: sale_order_onchange1, string: The onchange function of product was not correctly triggered}:
- order_line[0].name == u'Devil Worship Book'
- order_line[0].price_unit == 66.6
- order_line[0].type == 'make_to_order'
-10
View File
@@ -1510,16 +1510,6 @@ class stock_move(osv.osv):
}, context=context)
return new_move
def get_type_from_usage(self, cr, uid, location, location_dest, context=None):
'''
Returns the type to be chosen based on the usages of the locations
'''
if location.usage == 'internal' and location_dest.usage in ['supplier', 'customer']:
return 'out'
if location.usage in ['supplier', 'customer'] and location_dest.usage == 'internal' :
return 'in'
return 'internal'
class stock_inventory(osv.osv):
_name = "stock.inventory"
_description = "Inventory"
+7 -1
View File
@@ -1,5 +1,11 @@
-
Create new delivery order from output -> customers
Create new global procurement rule from Stock -> Output
-
!record {model: procurement.rule, ref:}
location_id: stock
location_dest_id: output
-
Create Delivery Order from Output -> Customer
-
!record {model: stock.picking, ref:}
-
@@ -21,29 +21,29 @@
from openerp.osv import fields, osv
class invoice_directly(osv.osv_memory):
_inherit = 'stock.partial.picking'
def do_partial(self, cr, uid, ids, context=None):
"""Launch Create invoice wizard if invoice state is To be Invoiced,
after processing the partial picking.
"""
if context is None: context = {}
result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
partial = self.browse(cr, uid, ids[0], context)
context.update(active_model='stock.picking',
active_ids=[partial.picking_id.id])
if partial.picking_id.invoice_state == '2binvoiced':
return {
'name': 'Create Invoice',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.invoice.onshipping',
'type': 'ir.actions.act_window',
'target': 'new',
'context': context
}
return {'type': 'ir.actions.act_window_close'}
# class invoice_directly(osv.osv_memory):
# _inherit = 'stock.partial.picking'
#
# def do_partial(self, cr, uid, ids, context=None):
# """Launch Create invoice wizard if invoice state is To be Invoiced,
# after processing the partial picking.
# """
# if context is None: context = {}
# result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
# partial = self.browse(cr, uid, ids[0], context)
# context.update(active_model='stock.picking',
# active_ids=[partial.picking_id.id])
# if partial.picking_id.invoice_state == '2binvoiced':
# return {
# 'name': 'Create Invoice',
# 'view_type': 'form',
# 'view_mode': 'form',
# 'res_model': 'stock.invoice.onshipping',
# 'type': 'ir.actions.act_window',
# 'target': 'new',
# 'context': context
# }
# return {'type': 'ir.actions.act_window_close'}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-1
View File
@@ -102,7 +102,6 @@ class stock_location_path(osv.osv):
'date_expected': newdate,
'picking_id': False,
'picking_type_id': rule.picking_type_id and rule.picking_type_id.id or False,
'type': move_obj.get_type_from_usage(cr, uid, move.location_id, move.location_dest_id, context=context),
'rule_id': rule.id,
'propagate': rule.propagate,
})