[IMP]: Apply removing changes when merge branch

bzr revid: ksa@tinyerp.co.in-20101123132434-fm0u05iasfpt0c3p
This commit is contained in:
ksa (Open ERP) 2010-11-23 18:54:34 +05:30
parent afa946594c
commit f4ebea2992
6 changed files with 47 additions and 15 deletions

View File

@ -53,11 +53,23 @@ class mrp_workcenter(osv.osv):
'costs_journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal'),
'costs_general_account_id': fields.many2one('account.account', 'General Account', domain=[('type','<>','view')]),
'resource_id': fields.many2one('resource.resource','Resource', ondelete='cascade', required=True),
'product_id': fields.many2one('product.product','Product'),
}
_defaults = {
'capacity_per_cycle': 1.0,
'resource_type': 'material',
}
def on_change_product_cost(self, cr, uid, ids, product_id, context=None):
if context is None:
context = {}
res = {'value':{}}
if product_id:
cost = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
res = {'value' : {'costs_hour' :cost.standard_price }}
return res
mrp_workcenter()
@ -737,7 +749,10 @@ class mrp_production(osv.osv):
'account_id': account,
'general_account_id': wc.costs_general_account_id.id,
'journal_id': wc.costs_journal_id.id,
'code': wc.code
'ref': wc.code,
'product_id': wc.product_id.id,
'unit_amount': wc.costs_hour * wc.time_cycle,
'product_uom_id': wc.product_id.uom_id.id
} )
if wc.costs_journal_id and wc.costs_general_account_id:
value = wc_line.cycle * wc.costs_cycle
@ -750,7 +765,10 @@ class mrp_production(osv.osv):
'account_id': account,
'general_account_id': wc.costs_general_account_id.id,
'journal_id': wc.costs_journal_id.id,
'code': wc.code,
'ref': wc.code,
'product_id': wc.product_id.id,
'unit_amount': wc.costs_hour * wc.time_cycle,
'product_uom_id': wc.product_id.uom_id.id
} )
return amount

View File

@ -160,12 +160,13 @@
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Costing Information"/>
<field name="product_id" on_change="on_change_product_cost(product_id)"/>
<field name="costs_hour"/>
<field name="costs_hour_account_id" groups="analytic.group_analytic_accounting"/>
<field name="costs_cycle"/>
<field name="costs_cycle_account_id" groups="analytic.group_analytic_accounting"/>
<field name="costs_journal_id" groups="analytic.group_analytic_accounting"/>
<field name="costs_general_account_id" groups="analytic.group_analytic_accounting"/>
<field name="costs_journal_id" attrs="{'required':['|',('costs_hour_account_id', '=', True),('costs_cycle_account_id', '=', True)]}" groups="analytic.group_analytic_accounting"/>
<field name="costs_general_account_id" attrs="{ 'required':['|',('costs_cycle_account_id', '=', True),('costs_hour_account_id', '=', True)]}" groups="analytic.group_analytic_accounting"/>
</group>
<separator colspan="4" string="Description"/>
<field colspan="4" name="note" nolabel="1"/>
@ -649,9 +650,9 @@
<field name="product_uom" string="UOM" widget="selection"/>
<field name="location_id" string="Source Loc." />
<field name="state" invisible="1"/>
<button name="%(stock.action_partial_move)d"
string="Partial"
type="action" states="confirmed,assigned"
<button name="%(stock.action_partial_move)d"
string="Partial"
type="action" states="confirmed,assigned"
icon="gtk-justify-fill"/>
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
@ -926,9 +927,9 @@
<menuitem action="mrp_workcenter_action" id="menu_view_resource_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
<menuitem action="resource.action_resource_calendar_form" id="menu_view_resource_calendar_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
<menuitem action="resource.action_resource_calendar_leave_tree" id="menu_view_resource_calendar_leaves_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
<!-- Planning -->
<menuitem id="menu_mrp_planning" name="Planning"
parent="base.menu_mrp_root" sequence="2"
groups="base.group_extended"/>

View File

@ -25,7 +25,7 @@ class mrp_price(osv.osv_memory):
_name = 'mrp.product_price'
_description = 'Product Price'
_columns = {
'number': fields.integer('Quantity', required=True, help="Specify quantity of products to produce or buy. Report of Cost structure will be displayed base on this qunatity."),
'number': fields.integer('Quantity', required=True, help="Specify quantity of products to produce or buy. Report of Cost structure will be displayed base on this quantity."),
}
_defaults = {
'number': 1,

View File

@ -327,7 +327,8 @@ class product_template(osv.osv):
return True
_constraints = [
(_check_uos, 'Error: UOS must be in a different category than the UOM', ['uos_id']),
# As Per do changes given by lp bug : 543979
# (_check_uos, 'Error: UOS must be in a different category than the UOM', ['uos_id']),
(_check_uom, 'Error: The default UOM and the purchase UOM must be in the same category.', ['uom_id']),
]

View File

@ -1904,6 +1904,12 @@ class stock_move(osv.osv):
acc_variation = accounts.get('property_stock_variation', False)
journal_id = accounts['stock_journal']
if acc_dest == acc_variation:
raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Output Account on defined on this product and Variant account on category of this product is same.'))
if acc_src == acc_variation:
raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Input Account on defined on this product and Variant account on category of this product is same.'))
if not acc_src:
raise osv.except_osv(_('Error!'), _('There is no stock input account defined for this product or its category: "%s" (id: %d)') % \
(move.product_id.name, move.product_id.id,))
@ -2416,6 +2422,12 @@ class stock_inventory(osv.osv):
return self.pool.get('stock.move').create(cr, uid, move_vals)
def action_done(self, cr, uid, ids, context=None):
""" Finished the inventory
@return: True
"""
if context is None:
context = {}
move_obj = self.pool.get('stock.move')
for inv in self.browse(cr, uid, ids, context=context):
move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context)
@ -2423,7 +2435,7 @@ class stock_inventory(osv.osv):
return True
def action_confirm(self, cr, uid, ids, context=None):
""" Finishes the inventory and writes its finished date
""" Confirm the inventory and writes its finished date
@return: True
"""
if context is None:
@ -2434,7 +2446,7 @@ class stock_inventory(osv.osv):
product_context = dict(context, compute_child=False)
location_obj = self.pool.get('stock.location')
for inv in self.browse(cr, uid, ids):
for inv in self.browse(cr, uid, ids, context=context):
move_ids = []
for line in inv.inventory_line_id:
pid = line.product_id.id

View File

@ -63,10 +63,10 @@ class stock_split_into(osv.osv_memory):
})
if quantity_rest>0:
if quantity_rest > 0:
quantity_rest = move.product_qty - quantity
tracking_id = track_obj.create(cr, uid, {}, context=context)
if quantity==0.0:
if quantity == 0.0:
move_obj.write(cr, uid, [move.id], {'tracking_id': tracking_id}, context=context)
else:
default_val = {