Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] mrp_production_estimated_cost #64

Merged
merged 20 commits into from
Feb 17, 2016

Conversation

pedrobaeza
Copy link
Member

Estimated costs in manufacturing orders

Thanks to this module, you can estimate the cost of your manufacturing orders
order, split as followed:

  • Raw Material cost: an analytic line is generated for each material to
    be consumed in the order with the product cost.
  • Operators time: one line will be generated for the time recorded by the
    operators on each operation, so that the number of lines will be equal to
    the number of operators in the operation.
  • Machine time: one analytic line for each operation will be created in the
    associated routing, taking the hourly cost or if missing, the cost per cycle.

This module also allows to create a virtual manufacturing order for estimating
costs of a manufactured product.

Installation

This module depends on the module product_variant_cost_price, that is
available in:

https://github.com/OCA/product-variant

Usage

When the manufacturing order is confirmed, analytic lines
are automatically generated in order to estimate the costs of the production

A new menu is available "Virtual Manufacturing Orders for cost estimation"
where the user can managed virtual MO:

  • When a new MO is created and the new field "active" is false, the MO will be
    considered virtual. It is only used for cost estimation and can not be
    confirmed.
  • To estimate the cost of the MO, the user has to press the button "Compute
    data" in the tab "Work Orders".
  • These virtual MO have a separate sequence number.
  • The user can create a virtual MO directly from the product form.

@pedrobaeza pedrobaeza force-pushed the 8.0-mrp_production_estimated_cost branch from dca2533 to 962f90d Compare December 10, 2015 07:10
Estimated costs in manufacturing orders
=======================================

Thanks to this module, you can estimate the cost of your manufacturing orders
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module extends the functionality of MRP adding estimates for Manufacturing Orders costs, as followed:

@rafaelbn
Copy link
Member

  • Go to a Manufacturer order
    
  • Click on smartbutton "Cost analysis"
    
  • Then:
    
File "/opt/odoo/common/openerp/v8/openerp/api.py", line 256, in
wrapper
return old_api(self, *args, **kwargs)
File
"/opt/odoo/common/openerp/v8/openerp/addons/base/ir/ir_model.py", line
905, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/opt/odoo/common/openerp/v8/openerp/api.py", line 256, in
wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/opt/odoo/common/openerp/v8/openerp/tools/cache.py", line 74,
in lookup
value = d[key] = self.method(*args, **kwargs)
File
"/opt/odoo/common/openerp/v8/openerp/addons/base/ir/ir_model.py", line
895, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' %
(xmlid))
ValueError: External ID not found in the system: ValueError: External
ID not found in the system:
mrp_production_project_estimated_cost.estimated_cost_list_view.

@pedrobaeza pedrobaeza force-pushed the 8.0-mrp_production_estimated_cost branch 2 times, most recently from 537341a to c4f32e4 Compare December 16, 2015 01:32
@pedrobaeza
Copy link
Member Author

Comments fixed and available to be reviewed

@oihane
Copy link
Contributor

oihane commented Dec 16, 2015

I was just testing, in _base database, and I got this error:

 File "*/mrp_production_estimated_cost/models/mrp_production.py", line 160, in _create_material_estimated_cost
    name = '%s-%s' % (prod.name, product_line.work_order.name or '')
ValueError: "'mrp.production.product.line' object has no attribute 'work_order'" while evaluating
u'action_confirm()'

Product used A2323 Ipad retina display (16GB, White, 2.4 GHZ)

@JMODaERP
Copy link

You said:

"Operators time: one line will be generated for the time recorded by the operators on each operation, so that the number of lines will be equal to the number of operators in the operation".

I have created 2 operator in laminate and 1 operator in punch. but in Costs Analysis they do not appear:

Laminate:

2015-12-18 16_40_29-routing operation - odoo

Punching:

2015-12-18 16_40_45-routing operation - odoo

Costs analysis:

2015-12-18 16_42_04-

Thanks

@JMODaERP
Copy link

More data over the order:

2015-12-18 16_56_23-manufacturing orders - odoo

2015-12-18 16_56_56-manufacturing orders - odoo

2015-12-18 16_57_19-manufacturing orders - odoo

@pedrobaeza pedrobaeza force-pushed the 8.0-mrp_production_estimated_cost branch 2 times, most recently from 49f6d00 to 6ce60f0 Compare December 28, 2015 10:02
@pedrobaeza
Copy link
Member Author

Ready to be reviewed

@JavierIniesta
Copy link

Travis fails

@rafaelbn
Copy link
Member

Error when clicking in Cost Analysis

31-12-2015 13-32-23

Odoo Server Error

Traceback (most recent call last):
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/http.py", line 537, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/http.py", line 574, in dispatch
    result = self._call_function(**self.params)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/http.py", line 310, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/http.py", line 307, in checked_call
    return self.endpoint(*a, **kw)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/http.py", line 803, in __call__
    return self.method(*args, **kw)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/http.py", line 403, in response_wrap
    response = f(*args, **kw)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/addons/web/controllers/main.py", line 948, in call_button
    action = self._call_kw(model, method, args, {})
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/addons/web/controllers/main.py", line 936, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/api.py", line 256, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/api.py", line 387, in old_api
    result = method(recs, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/addons/mrp_production_estimated_cost/models/mrp_production.py", line 79, in action_show_estimated_costs
    'mrp_production_project_estimated_cost.estimated_cost_list_view')
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/api.py", line 775, in ref
    return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/api.py", line 254, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/api.py", line 496, in new_api
    result = method(self._model, cr, uid, *args, **old_kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/addons/base/ir/ir_model.py", line 919, in xmlid_to_object
    t = self.xmlid_to_res_model_res_id(cr, uid, xmlid, raise_if_not_found)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/api.py", line 256, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/addons/base/ir/ir_model.py", line 905, in xmlid_to_res_model_res_id
    return self.xmlid_lookup(cr, uid, xmlid)[1:3]
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/api.py", line 256, in wrapper
    return old_api(self, *args, **kwargs)
  File "<string>", line 2, in xmlid_lookup
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/tools/cache.py", line 74, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3138912-64-6ce60f/openerp/addons/base/ir/ir_model.py", line 895, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % (xmlid))
ValueError: External ID not found in the system: mrp_production_project_estimated_cost.estimated_cost_list_view

@pedrobaeza pedrobaeza force-pushed the 8.0-mrp_production_estimated_cost branch 3 times, most recently from b5f9f98 to 9cf3b77 Compare January 5, 2016 18:18
@pedrobaeza
Copy link
Member Author

The problem now happens with the real costs module. @JavierIniesta, please check it.

@rafaelbn
Copy link
Member

@pedrobaeza could you please review travis? to final test before merging. Thanks

return self.env['account.analytic.line'].create(vals)

@api.model
def _create_worcenter_cycles_estimated_cost(self, prod, wc, workorder):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is really a misstyping do not know if it has to be really fixed but just in case there shows worcenter instead of workcenter

@oihane oihane force-pushed the 8.0-mrp_production_estimated_cost branch from 9cf3b77 to 72402ea Compare January 21, 2016 22:22
* added some spanish translations
* button cost analysis show only estimated lines
* miss typing fixed
@oihane
Copy link
Contributor

oihane commented Jan 21, 2016

@pedrobaeza @JMODaERP @JavierIniesta @rafaelbn

I was taking a look to the buttons that @rafaelbn said where not working properly and there was only one difference:
Cost analysis domain = [('mrp_production_id', '=', self.id), ('task_id', '=', False)]
Production Costs domain = [('mrp_production_id', '=', self.id)]

So in my tests, both buttons show exactly the same, what do you think that each of them must show?

@rafaelbn
Copy link
Member

rafaelbn commented Feb 5, 2016

Hi, where is the status of this PR? This PR depends in other PR?

@pedrobaeza
Copy link
Member Author

This one is ready to be merged. It has only a slight decrease on coverage, but the rest is working as expected.

@JMODaERP
Copy link

I have tested 👍

@rafaelbn
Copy link
Member

Thanks a lot!, 👍

@pedrobaeza
Copy link
Member Author

Please merge this one.

@JavierIniesta
Copy link

👍

1 similar comment
@antespi
Copy link

antespi commented Feb 17, 2016

👍

gurneyalex added a commit that referenced this pull request Feb 17, 2016
@gurneyalex gurneyalex merged commit cfb78dd into OCA:8.0 Feb 17, 2016
@oihane oihane deleted the 8.0-mrp_production_estimated_cost branch February 17, 2016 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet