[FIX]:No analytic entry is generated finishing one production order

lp bug: https://launchpad.net/bugs/500931 fixed

bzr revid: ksa@tinyerp.co.in-20101118133707-zlvo0grdbyyhjr38
This commit is contained in:
ksa (Open ERP)
2010-11-18 19:07:07 +05:30
parent 3be905a248
commit b25062ed30
2 changed files with 27 additions and 9 deletions
+19 -2
View File
@@ -53,11 +53,22 @@ 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 +748,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 +764,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
+8 -7
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." widget="selection"/>
<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"/>