Created
January 7, 2015 21:52
-
-
Save eLBati/b8c4e8639eecb9aa7f61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/stock_cancel/AUTHORS.txt b/stock_cancel/AUTHORS.txt | |
new file mode 100644 | |
index 0000000..80efd15 | |
--- /dev/null | |
+++ b/stock_cancel/AUTHORS.txt | |
@@ -0,0 +1,2 @@ | |
+Andrea Cometa (<http://www.andreacometa.it>) | |
+Agile Business Group sagl (<http://www.agilebg.com>) | |
diff --git a/stock_cancel/__init__.py b/stock_cancel/__init__.py | |
index 4e47a48..d223c77 100644 | |
--- a/stock_cancel/__init__.py | |
+++ b/stock_cancel/__init__.py | |
@@ -2,7 +2,7 @@ | |
############################################################################## | |
# | |
# OpenERP, Open Source Management Solution | |
-# Copyright (c) 2012 Andrea Cometa All Rights Reserved. | |
+# Copyright (c) 2014 Andrea Cometa All Rights Reserved. | |
# www.andreacometa.it | |
# openerp@andreacometa.it | |
# | |
diff --git a/stock_cancel/__openerp__.py b/stock_cancel/__openerp__.py | |
index ced6c7f..2a5f667 100644 | |
--- a/stock_cancel/__openerp__.py | |
+++ b/stock_cancel/__openerp__.py | |
@@ -2,7 +2,7 @@ | |
############################################################################## | |
# | |
# OpenERP, Open Source Management Solution | |
-# Copyright (c) 2012 Andrea Cometa All Rights Reserved. | |
+# Copyright (c) 2014 Andrea Cometa All Rights Reserved. | |
# www.andreacometa.it | |
# openerp@andreacometa.it | |
# | |
@@ -32,7 +32,7 @@ picking to draft state""", | |
'depends': ['stock_picking_invoice_link'], | |
'data': [ | |
'stock_view.xml', | |
- ], | |
+ ], | |
'installable': True, | |
'active': False, | |
'images': ['images/stock_picking.jpg'], | |
diff --git a/stock_cancel/stock.py b/stock_cancel/stock.py | |
index 8887517..9d7760c 100644 | |
--- a/stock_cancel/stock.py | |
+++ b/stock_cancel/stock.py | |
@@ -22,16 +22,14 @@ | |
# | |
############################################################################## | |
-from openerp.osv import orm | |
-from openerp.tools.translate import _ | |
-import netsvc | |
+from openerp import models, _, netsvc, exceptions | |
-class stock_picking(orm.Model): | |
+class stock_picking(models.Model): | |
_inherit = 'stock.picking' | |
def has_valuation_moves(self, cr, uid, move): | |
- return self.pool.get('account.move').search(cr, uid, [ | |
+ return self.pool['account.move'].search(cr, uid, [ | |
('ref', '=', move.picking_id.name), | |
]) | |
@@ -41,7 +39,7 @@ class stock_picking(orm.Model): | |
for picking in self.browse(cr, uid, ids, context): | |
for line in picking.move_lines: | |
if self.has_valuation_moves(cr, uid, line): | |
- raise orm.except_orm( | |
+ raise exceptions.Warning( | |
_('Error'), | |
_('Line %s has valuation moves (%s). \ | |
Remove them first') % (line.name, | |
@@ -61,21 +59,3 @@ class stock_picking(orm.Model): | |
) % (name,) | |
self.log(cr, uid, id, message) | |
return True | |
- | |
- | |
-class stock_picking_out(orm.Model): | |
- _inherit = 'stock.picking.out' | |
- | |
- def action_revert_done(self, cr, uid, ids, context=None): | |
- # override in order to redirect to stock.picking object | |
- return self.pool.get('stock.picking').action_revert_done( | |
- cr, uid, ids, context=context) | |
- | |
- | |
-class stock_picking_in(orm.Model): | |
- _inherit = 'stock.picking.in' | |
- | |
- def action_revert_done(self, cr, uid, ids, context=None): | |
- # override in order to redirect to stock.picking object | |
- return self.pool.get('stock.picking').action_revert_done( | |
- cr, uid, ids, context=context) | |
diff --git a/stock_cancel/stock_view.xml b/stock_cancel/stock_view.xml | |
index 9eea397..2f82f7d 100644 | |
--- a/stock_cancel/stock_view.xml | |
+++ b/stock_cancel/stock_view.xml | |
@@ -2,38 +2,16 @@ | |
<openerp> | |
<data> | |
- <record id="stock_picking_cancel_out_form" model="ir.ui.view"> | |
- <field name="name">stock.picking.cancel.out.form</field> | |
- <field name="model">stock.picking.out</field> | |
- <field name="inherit_id" ref="stock.view_picking_out_form"/> | |
+ <record id="stock_picking_cancel_form" model="ir.ui.view"> | |
+ <field name="name">stock.picking.cancel.form</field> | |
+ <field name="model">stock.picking</field> | |
+ <field name="inherit_id" ref="stock.view_picking_form"/> | |
<field name="arch" type="xml"> | |
- <button name="%(stock.act_stock_return_picking)d" position="after"> | |
+ <field name="state" position="before"> | |
<button name="action_revert_done" string="Reopen" states="done,cancel" type="object" icon="gtk-cancel" confirm="Are you sure you want to reopen this stock picking?"/> | |
- </button> | |
+ </field> | |
</field> | |
- </record> | |
- | |
- <record id="stock_picking_cancel_in_form" model="ir.ui.view"> | |
- <field name="name">stock.picking.cancel.in.form</field> | |
- <field name="model">stock.picking.in</field> | |
- <field name="inherit_id" ref="stock.view_picking_in_form"/> | |
- <field name="arch" type="xml"> | |
- <button name="%(stock.act_stock_return_picking)d" position="after"> | |
- <button name="action_revert_done" string="Reopen" states="done,cancel" type="object" icon="gtk-cancel" confirm="Are you sure you want to reopen this stock picking?"/> | |
- </button> | |
- </field> | |
- </record> | |
- | |
- <record id="stock_picking_cancel_form" model="ir.ui.view"> | |
- <field name="name">stock.picking.cancel.form</field> | |
- <field name="model">stock.picking</field> | |
- <field name="inherit_id" ref="stock.view_picking_form"/> | |
- <field name="arch" type="xml"> | |
- <button name="%(stock.action_stock_invoice_onshipping)d" position="after"> | |
- <button name="action_revert_done" string="Reopen" states="done,cancel" type="object" icon="gtk-cancel" confirm="Are you sure you want to reopen this stock picking?"/> | |
- </button> | |
- </field> | |
- </record> | |
+ </record> | |
</data> | |
</openerp> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment