Skip to content

Commit

Permalink
Merge pull request #1308 from alfredoavanzosc/odoomrp-wip-mrp_operati…
Browse files Browse the repository at this point in the history
…ons_rejected_quantity

[IMP] mrp_operations_rejected_quantity: Show warning if producto to p…
  • Loading branch information
Daniel authored Oct 13, 2016
2 parents 2bdc76d + cf19ea9 commit 726e710
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
12 changes: 12 additions & 0 deletions mrp_operations_rejected_quantity/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ msgstr "o"
msgid "pause"
msgstr "pausa"

#. module: mrp_operations_rejected_quantity
#: code:addons/mrp_operations_rejected_quantity/wizard/mrp_work_order_produce.py:88
#, python-format
msgid "Product to produce"
msgstr "Producto a producir"

#. module: mrp_operations_rejected_quantity
#: code:addons/mrp_operations_rejected_quantity/wizard/mrp_work_order_produce.py:89
#, python-format
msgid "Quantity to produce greater than planned"
msgstr "Cantidad a producir mayor que la cantidad a producir planificada en OF"

#. module: mrp_operations_rejected_quantity
#: view:mrp.work.order.produce:mrp_operations_rejected_quantity.view_mrp_product_consume_wizard_inh_rejectedquantity
#: view:mrp.work.order.produce:mrp_operations_rejected_quantity.view_mrp_product_produce_wizard_inh_rejectedquantity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
from openerp import models, fields, api, _


class MrpWorkOrderProduce(models.TransientModel):
Expand Down Expand Up @@ -62,12 +62,12 @@ def on_change_qty(self, product_qty, consume_lines):
operation_obj = self.env['mrp.production.workcenter.line']
planned_product_obj = self.env['mrp.production.product.line']
operation = operation_obj.browse(self.env.context.get('active_id'))
accepted_amount = sum(
processed_accepted_amount = sum(
x.accepted_amount for x in
operation.operation_time_lines.filtered(
lambda r: r.state == 'processed'))
res = super(MrpWorkOrderProduce, self).on_change_qty(
operation.production_id.product_qty - accepted_amount,
operation.production_id.product_qty - processed_accepted_amount,
consume_lines)
accepted_amount = sum(
x.accepted_amount for x in
Expand All @@ -77,6 +77,11 @@ def on_change_qty(self, product_qty, consume_lines):
x.rejected_amount for x in
operation.operation_time_lines.filtered(
lambda r: r.state == 'pending'))
if (product_qty + processed_accepted_amount >
operation.production_id.product_qty):
res['warning'] = {
'title': _('Product to produce'),
'message': _('Quantity to produce greater than planned')}
for line in res['value']['consume_lines']:
cond = [('work_order', '=', operation.id),
('product_id', '=', line[2].get('product_id'))]
Expand Down

0 comments on commit 726e710

Please sign in to comment.