add funcionality to cancel availability

This commit is contained in:
Àngel Àlvarez 2012-07-10 11:59:17 +02:00
parent 42b773fb6c
commit 409565c81f
6 changed files with 115 additions and 56 deletions

View File

@ -1,22 +1,32 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * nan_mrp_without_internal_picking
# * nan_mrp_without_internal_picking
#
# Guillem Barba <guillem@nan-tic.com>, 2012.
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.2\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-04-30 15:05+0000\n"
"PO-Revision-Date: 2012-04-30 17:05+0200\n"
"Last-Translator: Guillem Barba <guillem@nan-tic.com>\n"
"Language-Team: Catalan <>\n"
"POT-Creation-Date: 2012-07-10 09:56+0000\n"
"PO-Revision-Date: 2012-07-10 11:57+0200\n"
"Last-Translator: Àngel Àlvarez\n"
"Language-Team: Catalan <kde-i18n-ca@kde.org>\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Language: ca\n"
"X-Generator: Lokalize 1.2\n"
"X-Generator: Lokalize 1.4\n"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Torna a crear albarà"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Cancel Availability"
msgstr "Cancel·lar disponibilitat"
#. module: nan_mrp_without_internal_picking
#: model:ir.model,name:nan_mrp_without_internal_picking.model_mrp_production
@ -29,9 +39,9 @@ msgid "Check Availability"
msgstr "Comprova disponibilitat"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Torna a crear albarà"
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "Ordre de producció '%s' planificada pel '%s'"
#. module: nan_mrp_without_internal_picking
#: code:addons/nan_mrp_without_internal_picking/mrp.py:109
@ -39,9 +49,3 @@ msgstr "Torna a crear albarà"
msgid "Manufacturing order '%s' is scheduled for the %s."
msgstr "Ordre de producció '%s' planificada pel '%s'"
#. module: nan_mrp_without_internal_picking
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "Ordre de producció '%s' planificada pel '%s'"

View File

@ -1,20 +1,32 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * nan_mrp_without_internal_picking
# * nan_mrp_without_internal_picking
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.2\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-04-30 15:05+0000\n"
"POT-Creation-Date: 2012-07-10 09:56+0000\n"
"PO-Revision-Date: 2012-04-30 15:05+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Recreate Picking"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
#, fuzzy
msgid "Cancel Availability"
msgstr "Check Availability"
#. module: nan_mrp_without_internal_picking
#: model:ir.model,name:nan_mrp_without_internal_picking.model_mrp_production
msgid "Manufacturing Order"
@ -26,18 +38,12 @@ msgid "Check Availability"
msgstr "Check Availability"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Recreate Picking"
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "Order quantity cannot be negative or zero !"
#. module: nan_mrp_without_internal_picking
#: code:addons/nan_mrp_without_internal_picking/mrp.py:109
#, python-format
msgid "Manufacturing order '%s' is scheduled for the %s."
msgstr "Manufacturing order '%s' is scheduled for the %s."
#. module: nan_mrp_without_internal_picking
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "Order quantity cannot be negative or zero !"

View File

@ -1,22 +1,32 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * nan_mrp_without_internal_picking
# * nan_mrp_without_internal_picking
#
# Guillem Barba <guillem@nan-tic.com>, 2012.
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.2\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-04-30 15:05+0000\n"
"PO-Revision-Date: 2012-04-30 17:05+0200\n"
"Last-Translator: Guillem Barba <guillem@nan-tic.com>\n"
"Language-Team: Spanish <>\n"
"POT-Creation-Date: 2012-07-10 09:56+0000\n"
"PO-Revision-Date: 2012-07-10 11:57+0200\n"
"Last-Translator: Àngel Àlvarez\n"
"Language-Team: Spanish <kde-i18n-ca@kde.org>\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Language: es\n"
"X-Generator: Lokalize 1.2\n"
"X-Generator: Lokalize 1.4\n"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Volver a crear albarán"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Cancel Availability"
msgstr "Cancelar disponibilidad"
#. module: nan_mrp_without_internal_picking
#: model:ir.model,name:nan_mrp_without_internal_picking.model_mrp_production
@ -29,9 +39,9 @@ msgid "Check Availability"
msgstr "Comprobar disponibilidad"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Volver a crear albarán"
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "La cantidad ordenada no puede ser negativa o cero !"
#. module: nan_mrp_without_internal_picking
#: code:addons/nan_mrp_without_internal_picking/mrp.py:109
@ -39,9 +49,3 @@ msgstr "Volver a crear albarán"
msgid "Manufacturing order '%s' is scheduled for the %s."
msgstr "Órden de producción '%s' planificada para el '%s'"
#. module: nan_mrp_without_internal_picking
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "La cantidad ordenada no puede ser negativa o cero !"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.2\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-04-30 15:05+0000\n"
"PO-Revision-Date: 2012-04-30 15:05+0000\n"
"POT-Creation-Date: 2012-07-10 09:56+0000\n"
"PO-Revision-Date: 2012-07-10 09:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -15,6 +15,16 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Recreate Picking"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Cancel Availability"
msgstr "Cancel Availability"
#. module: nan_mrp_without_internal_picking
#: model:ir.model,name:nan_mrp_without_internal_picking.model_mrp_production
msgid "Manufacturing Order"
@ -26,9 +36,9 @@ msgid "Check Availability"
msgstr "Check Availability"
#. module: nan_mrp_without_internal_picking
#: view:mrp.production:0
msgid "Recreate Picking"
msgstr "Recreate Picking"
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "Order quantity cannot be negative or zero !"
#. module: nan_mrp_without_internal_picking
#: code:addons/nan_mrp_without_internal_picking/mrp.py:109
@ -36,8 +46,3 @@ msgstr "Recreate Picking"
msgid "Manufacturing order '%s' is scheduled for the %s."
msgstr "Manufacturing order '%s' is scheduled for the %s."
#. module: nan_mrp_without_internal_picking
#: constraint:mrp.production:0
msgid "Order quantity cannot be negative or zero !"
msgstr "Order quantity cannot be negative or zero !"

41
mrp.py
View File

@ -147,8 +147,8 @@ class mrp_production(osv.osv):
def action_produce(self, cr, uid, production_id, production_qty,
production_mode, context=None):
res = super(mrp_production,self).action_produce(cr, uid, production_id,
production_qty, production_mode, context)
res = super(mrp_production,self).action_produce(cr, uid,
production_id, production_qty, production_mode, context)
production = self.browse(cr, uid, production_id, context)
move_ids = [x.id for x in production.move_lines]
@ -159,6 +159,43 @@ class mrp_production(osv.osv):
return res
# mrp.production
def cancel_availability(self,cr, uid, ids, context):
wf_service = netsvc.LocalService("workflow")
stock_obj = self.pool.get('stock.move')
procurement_obj = self.pool.get('procurement.order')
move_line_ids = []
procurement_ids = []
for production in self.browse(cr, uid, ids, context):
move_line_ids += [x.id for x in production.move_lines]
procurement_ids += procurement_obj.search(cr, uid,
[('origin_production_id','in',ids),
('procure_method','=','make_to_stock')],
context=context)
self.write(cr, uid, ids, {'state':'confirmed'}, context=context)
for p_id in ids:
wf_service.trg_validate(uid, 'mrp.production', p_id,
'action_cancel', cr)
wf_service.trg_delete(uid, 'mrp.production', p_id, cr)
wf_service.trg_create(uid, 'mrp.production', p_id, cr)
stock_obj.write(cr, uid, move_line_ids, {'state':'confirmed'},
context)
procurement_obj.write(cr, uid, procurement_ids, {
'state':'draft'}, context=context)
for proc in self.browse(cr, uid, procurement_ids, context=context):
wf_service.trg_delete(uid, 'procurement.order', proc.id, cr)
wf_service.trg_create(uid, 'procurement.order', proc.id, cr)
wf_service.trg_validate(uid, 'procurement.order',
proc.id, 'button_confirm', cr )
return True
# mrp.production
def force_production(self, cr, uid, ids, *args):
""" Assigns products.

View File

@ -8,7 +8,10 @@
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<button name="button_recreate" states="picking_except" string="Recreate Picking" icon="terp-document-new" position="replace">
<button name="check_production" states="confirmed,picking_except" string="Check Availability" type="object" icon="gtk-jump-to"/>
<group col="2">
<button name="check_production" states="confirmed,picking_except" string="Check Availability" type="object" icon="gtk-jump-to"/>
<button name="cancel_availability" states="ready" string="Cancel Availability" type="object" icon="gtk-jump-to"/>
</group>
</button>
</field>
</record>