From f9f0b1dded25d27471f3bddf21f86b80a913f987 Mon Sep 17 00:00:00 2001 From: Osval Reyes Date: Wed, 28 Oct 2015 21:03:56 -0430 Subject: [PATCH 1/7] [ADD] new module crm_rma_location --- crm_rma_location/README.rst | 72 +++++++ crm_rma_location/__init__.py | 33 ++++ crm_rma_location/__openerp__.py | 39 ++++ .../i18n/crm_rma_location_rma.pot | 84 ++++++++ crm_rma_location/i18n/es.po | 84 ++++++++ crm_rma_location/i18n/es_MX.po | 16 ++ crm_rma_location/i18n/es_PA.po | 16 ++ crm_rma_location/i18n/es_VE.po | 16 ++ crm_rma_location/models/__init__.py | 23 +++ crm_rma_location/models/stock_warehouse.py | 183 ++++++++++++++++++ crm_rma_location/tests/__init__.py | 22 +++ crm_rma_location/tests/test_location_rma.py | 46 +++++ crm_rma_location/views/stock_warehouse.xml | 21 ++ 13 files changed, 655 insertions(+) create mode 100644 crm_rma_location/README.rst create mode 100644 crm_rma_location/__init__.py create mode 100644 crm_rma_location/__openerp__.py create mode 100644 crm_rma_location/i18n/crm_rma_location_rma.pot create mode 100644 crm_rma_location/i18n/es.po create mode 100644 crm_rma_location/i18n/es_MX.po create mode 100644 crm_rma_location/i18n/es_PA.po create mode 100644 crm_rma_location/i18n/es_VE.po create mode 100644 crm_rma_location/models/__init__.py create mode 100644 crm_rma_location/models/stock_warehouse.py create mode 100644 crm_rma_location/tests/__init__.py create mode 100644 crm_rma_location/tests/test_location_rma.py create mode 100644 crm_rma_location/views/stock_warehouse.xml diff --git a/crm_rma_location/README.rst b/crm_rma_location/README.rst new file mode 100644 index 00000000..38d7eb5f --- /dev/null +++ b/crm_rma_location/README.rst @@ -0,0 +1,72 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +================ +CRM RMA Location +================ + +This module adds a warehouse's stock location for RMA movements in the warehouse and 3 picking types for RMA operations, these picking types are one for Incoming Picking, another for Internal and the third for Outgoing picking. Creating it also document sequences for each of them. + +Installation +============ + +To install this module, just select it from available modules + +Configuration +============= + +No extra configuration is added to this module + +Usage +===== + +* Go to Warehouses > Configuration > Warehouses and create a new one +* Then go to Warehouse > Configuration > Types of Operation, and confirm that it + have been created the three mentioned picking types. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/145/8.0 + +For further information, please visit: + +* https://www.odoo.com/forum/help-1 + +Known issues / Roadmap +====================== + +* No issues are known yet + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + + +Credits +======= + +Contributors +------------ + +* Osval Reyes +* Yanina Aular + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/crm_rma_location/__init__.py b/crm_rma_location/__init__.py new file mode 100644 index 00000000..3cb92eb9 --- /dev/null +++ b/crm_rma_location/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2015 Vauxoo +# Author: Yanina Aular +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import models +from openerp import SUPERUSER_ID + + +def post_init_hook(cr, registry): + stock_wh = registry['stock.warehouse'] + for wh_id in stock_wh.browse(cr, SUPERUSER_ID, + stock_wh.search(cr, SUPERUSER_ID, [])): + vals = stock_wh.create_locations_rma(cr, SUPERUSER_ID, wh_id) + stock_wh.write(cr, SUPERUSER_ID, wh_id.id, vals) + vals = stock_wh.create_sequences_picking_types(cr, SUPERUSER_ID, wh_id) + stock_wh.write(cr, SUPERUSER_ID, wh_id.id, vals) diff --git a/crm_rma_location/__openerp__.py b/crm_rma_location/__openerp__.py new file mode 100644 index 00000000..08527cf5 --- /dev/null +++ b/crm_rma_location/__openerp__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2015 Vauxoo +# Author: Yanina Aular +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': 'RMA Location', + 'version': '8.0.1.0.0', + 'author': "Vauxoo, Odoo Community Association (OCA)", + 'license': 'AGPL-3', + 'website': 'http://www.camptocamp.com,http://www.vauxoo.com', + 'category': 'Generic Modules/CRM & SRM', + 'depends': [ + 'stock', + 'procurement', + ], + 'data': [ + 'views/stock_warehouse.xml', + ], + 'post_init_hook': 'post_init_hook', + 'installable': True, + 'auto_install': False, +} diff --git a/crm_rma_location/i18n/crm_rma_location_rma.pot b/crm_rma_location/i18n/crm_rma_location_rma.pot new file mode 100644 index 00000000..73baa75e --- /dev/null +++ b/crm_rma_location/i18n/crm_rma_location_rma.pot @@ -0,0 +1,84 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-17 19:39+0000\n" +"PO-Revision-Date: 2015-07-17 19:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:60 +#, python-format +msgid " Sequence in" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:72 +#, python-format +msgid " Sequence internal" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:66 +#, python-format +msgid " Sequence out" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:166 +#, python-format +msgid "RMA" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:120 +#, python-format +msgid "RMA Delivery Orders" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_in_type_id:0 +msgid "RMA In Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:134 +#, python-format +msgid "RMA Internal Transfers" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_int_type_id:0 +msgid "RMA Internal Type" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,lot_rma_id:0 +msgid "RMA Location" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_out_type_id:0 +msgid "RMA Out Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:108 +#, python-format +msgid "RMA Receipts" +msgstr "" + +#. module: crm_rma_location +#: model:ir.model,name:crm_rma_location.model_stock_warehouse +msgid "Warehouse" +msgstr "" + diff --git a/crm_rma_location/i18n/es.po b/crm_rma_location/i18n/es.po new file mode 100644 index 00000000..27daafb3 --- /dev/null +++ b/crm_rma_location/i18n/es.po @@ -0,0 +1,84 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-17 19:39+0000\n" +"PO-Revision-Date: 2015-07-17 19:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:60 +#, python-format +msgid " Sequence in" +msgstr "Secuencia de entrada" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:72 +#, python-format +msgid " Sequence internal" +msgstr "Secuencia interna" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:66 +#, python-format +msgid " Sequence out" +msgstr "Secuencia de salida" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:166 +#, python-format +msgid "RMA" +msgstr "RMA" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:120 +#, python-format +msgid "RMA Delivery Orders" +msgstr "Órdenes de envío de RMA" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_in_type_id:0 +msgid "RMA In Type" +msgstr "Entradas en RMA" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:134 +#, python-format +msgid "RMA Internal Transfers" +msgstr "Transferencias internas en RMA" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_int_type_id:0 +msgid "RMA Internal Type" +msgstr "Internos en RMA" + +#. module: crm_rma_location +#: field:stock.warehouse,lot_rma_id:0 +msgid "RMA Location" +msgstr "Locación de RMA" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_out_type_id:0 +msgid "RMA Out Type" +msgstr "Salidas en RMA" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/stock.py:108 +#, python-format +msgid "RMA Receipts" +msgstr "Recepciones de RMA" + +#. module: crm_rma_location +#: model:ir.model,name:crm_rma_location.model_stock_warehouse +msgid "Warehouse" +msgstr "Almacén" + diff --git a/crm_rma_location/i18n/es_MX.po b/crm_rma_location/i18n/es_MX.po new file mode 100644 index 00000000..2eb952f5 --- /dev/null +++ b/crm_rma_location/i18n/es_MX.po @@ -0,0 +1,16 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-17 19:39+0000\n" +"PO-Revision-Date: 2015-07-17 19:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/crm_rma_location/i18n/es_PA.po b/crm_rma_location/i18n/es_PA.po new file mode 100644 index 00000000..2eb952f5 --- /dev/null +++ b/crm_rma_location/i18n/es_PA.po @@ -0,0 +1,16 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-17 19:39+0000\n" +"PO-Revision-Date: 2015-07-17 19:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/crm_rma_location/i18n/es_VE.po b/crm_rma_location/i18n/es_VE.po new file mode 100644 index 00000000..2eb952f5 --- /dev/null +++ b/crm_rma_location/i18n/es_VE.po @@ -0,0 +1,16 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-17 19:39+0000\n" +"PO-Revision-Date: 2015-07-17 19:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/crm_rma_location/models/__init__.py b/crm_rma_location/models/__init__.py new file mode 100644 index 00000000..59059dd4 --- /dev/null +++ b/crm_rma_location/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2013 Camptocamp +# Copyright 2015 Vauxoo +# Author: Yanina Aular +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import stock_warehouse diff --git a/crm_rma_location/models/stock_warehouse.py b/crm_rma_location/models/stock_warehouse.py new file mode 100644 index 00000000..479bbc79 --- /dev/null +++ b/crm_rma_location/models/stock_warehouse.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2013 Camptocamp +# Copyright 2015 Vauxoo +# Author: Yanina Aular +# Osval Reyes +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import _, api, fields, models + + +class StockWarehouse(models.Model): + + _inherit = "stock.warehouse" + + lot_rma_id = fields.Many2one('stock.location', 'RMA Location') + rma_out_type_id = fields.Many2one('stock.picking.type', 'RMA Out Type') + rma_in_type_id = fields.Many2one('stock.picking.type', 'RMA In Type') + rma_int_type_id = fields.Many2one('stock.picking.type', + 'RMA Internal Type') + + def compute_next_color(self): + """ + Choose the next available color for + the picking types of this warehouse + """ + available_colors = [c % 9 for c in range(3, 12)] + all_used_colors = self.env['stock.picking.type'].\ + search_read([('warehouse_id', '!=', False), + ('color', '!=', False)], + ['color'], order='color') + for col in all_used_colors: + if col['color'] in available_colors: + available_colors.remove(col['color']) + + return available_colors[0] if available_colors else 0 + + def create_sequence(self, warehouse_id, name, prefix, padding): + return self.env['ir.sequence'].sudo().\ + create(values={ + 'name': warehouse_id.name + name, + 'prefix': warehouse_id.code + prefix, + 'padding': padding, + 'company_id': warehouse_id.company_id.id + }) + + @api.model + def create_sequences_picking_types(self, warehouse): + """ + Takes care of create picking types for internal, + incoming and outgoing RMA + """ + picking_type = self.env['stock.picking.type'] + + # create new sequences + if not warehouse.rma_in_type_id: + in_seq_id = self.create_sequence( + warehouse, _(' Sequence in'), '/RMA/IN/', 5 + ) + + if not warehouse.rma_out_type_id: + out_seq_id = self.create_sequence( + warehouse, _(' Sequence out'), '/RMA/OUT/', 5 + ) + + if not warehouse.rma_int_type_id: + int_seq_id = self.create_sequence( + warehouse, _(' Sequence internal'), '/RMA/INT/', 5 + ) + + wh_stock_loc = warehouse.lot_rma_id + + # fetch customer and supplier locations, for references + customer_loc, supplier_loc = self._get_partner_locations() + + color = self.compute_next_color() + + # order the picking types with a sequence + # allowing to have the following suit for + # each warehouse: reception, internal, pick, pack, ship. + max_sequence = self.env['stock.picking.type'].\ + search_read([], ['sequence'], order='sequence desc') + max_sequence = max_sequence and max_sequence[0]['sequence'] or 0 + + in_type_id = warehouse.rma_in_type_id + if not in_type_id: + in_type_id = picking_type.create(vals={ + 'name': _('RMA Receipts'), + 'warehouse_id': warehouse.id, + 'code': 'incoming', + 'sequence_id': in_seq_id.id, + 'default_location_src_id': customer_loc.id, + 'default_location_dest_id': wh_stock_loc.id, + 'sequence': max_sequence + 4, + 'color': color}) + + out_type_id = warehouse.rma_out_type_id + if not out_type_id: + out_type_id = picking_type.create(vals={ + 'name': _('RMA Delivery Orders'), + 'warehouse_id': warehouse.id, + 'code': 'outgoing', + 'sequence_id': out_seq_id.id, + 'return_picking_type_id': in_type_id.id, + 'default_location_src_id': wh_stock_loc.id, + 'default_location_dest_id': supplier_loc.id, + 'sequence': max_sequence + 1, + 'color': color}) + in_type_id.write({'return_picking_type_id': out_type_id.id}) + + int_type_id = warehouse.rma_int_type_id + if not int_type_id: + int_type_id = picking_type.create(vals={ + 'name': _('RMA Internal Transfers'), + 'warehouse_id': warehouse.id, + 'code': 'internal', + 'sequence_id': int_seq_id.id, + 'default_location_src_id': wh_stock_loc.id, + 'default_location_dest_id': wh_stock_loc.id, + 'active': True, + 'sequence': max_sequence + 2, + 'color': color}) + + # write picking types on WH + vals = { + 'rma_in_type_id': in_type_id.id, + 'rma_out_type_id': out_type_id.id, + 'rma_int_type_id': int_type_id.id, + } + return vals + + @api.model + def create_locations_rma(self, warehouse_id): + """ + Create a RMA location for RMA movements that takes place when internal, + outgoing or incoming pickings are made from/to this location + """ + vals = {} + + location_obj = self.env['stock.location'] + context_with_inactive = self.env.context.copy() + context_with_inactive['active_test'] = False + + if not warehouse_id.lot_rma_id: + loc_vals = { + 'name': _('RMA'), + 'usage': 'internal', + 'location_id': warehouse_id.view_location_id.id, + 'company_id': warehouse_id.company_id.id, + 'active': True, + } + location_id = location_obj.with_context(context_with_inactive).\ + create(loc_vals) + vals['lot_rma_id'] = location_id.id + + return vals + + @api.model + def create(self, vals): + """ + Create Locations and picking types for warehouse + """ + warehouse_id = super(StockWarehouse, self).create(vals=vals) + new_vals = self.create_locations_rma(warehouse_id) + warehouse_id.write(vals=new_vals) + new_vals = self.create_sequences_picking_types(warehouse_id) + warehouse_id.write(vals=new_vals) + return warehouse_id diff --git a/crm_rma_location/tests/__init__.py b/crm_rma_location/tests/__init__.py new file mode 100644 index 00000000..ed9b4717 --- /dev/null +++ b/crm_rma_location/tests/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2015 Vauxoo +# Author: Osval Reyes +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import test_location_rma diff --git a/crm_rma_location/tests/test_location_rma.py b/crm_rma_location/tests/test_location_rma.py new file mode 100644 index 00000000..77c3e64c --- /dev/null +++ b/crm_rma_location/tests/test_location_rma.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2015 Vauxoo +# Author: Osval Reyes +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.tests.common import TransactionCase + + +class TestLocationRma(TransactionCase): + + def setUp(self): + super(TestLocationRma, self).setUp() + self.warehouse = self.env['stock.warehouse'] + + def test_01_create_warehouse(self): + """ + Check if picking types were created + """ + + warehouse_id = self.warehouse.create({ + 'name': 'BrandNew WH', + 'code': 'NEWWH' + }) + + self.assertTrue(warehouse_id.rma_in_type_id and + warehouse_id.rma_out_type_id.code and + warehouse_id.rma_int_type_id.code) + self.assertEqual(warehouse_id.rma_in_type_id.code, 'incoming') + self.assertEqual(warehouse_id.rma_out_type_id.code, 'outgoing') + self.assertEqual(warehouse_id.rma_int_type_id.code, 'internal') diff --git a/crm_rma_location/views/stock_warehouse.xml b/crm_rma_location/views/stock_warehouse.xml new file mode 100644 index 00000000..cdaddeb9 --- /dev/null +++ b/crm_rma_location/views/stock_warehouse.xml @@ -0,0 +1,21 @@ + + + + + view_warehouse_form + stock.warehouse + + + + + + + + + + + + + + + From 4ffadfaded620828fe8efe2573676d9aa85625b4 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Mon, 30 Nov 2015 13:05:46 -0500 Subject: [PATCH 2/7] OCA Transbot updated translations from Transifex --- crm_rma_location/i18n/es.po | 33 +++++++------- crm_rma_location/i18n/fr.po | 85 +++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 16 deletions(-) create mode 100644 crm_rma_location/i18n/fr.po diff --git a/crm_rma_location/i18n/es.po b/crm_rma_location/i18n/es.po index 27daafb3..2b4adfa4 100644 --- a/crm_rma_location/i18n/es.po +++ b/crm_rma_location/i18n/es.po @@ -1,46 +1,48 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * crm_rma_location -# +# * crm_rma_location +# +# Translators: msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: rma (8.0)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-07-17 19:39+0000\n" -"PO-Revision-Date: 2015-07-17 19:39+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" +"POT-Creation-Date: 2015-11-24 16:07+0000\n" +"PO-Revision-Date: 2015-11-03 17:06+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-rma-8-0/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" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: crm_rma_location -#: code:addons/crm_rma_location/stock.py:60 +#: code:addons/crm_rma_location/models/stock_warehouse.py:73 #, python-format msgid " Sequence in" msgstr "Secuencia de entrada" #. module: crm_rma_location -#: code:addons/crm_rma_location/stock.py:72 +#: code:addons/crm_rma_location/models/stock_warehouse.py:83 #, python-format msgid " Sequence internal" msgstr "Secuencia interna" #. module: crm_rma_location -#: code:addons/crm_rma_location/stock.py:66 +#: code:addons/crm_rma_location/models/stock_warehouse.py:78 #, python-format msgid " Sequence out" msgstr "Secuencia de salida" #. module: crm_rma_location -#: code:addons/crm_rma_location/stock.py:166 +#: code:addons/crm_rma_location/models/stock_warehouse.py:161 #, python-format msgid "RMA" msgstr "RMA" #. module: crm_rma_location -#: code:addons/crm_rma_location/stock.py:120 +#: code:addons/crm_rma_location/models/stock_warehouse.py:115 #, python-format msgid "RMA Delivery Orders" msgstr "Órdenes de envío de RMA" @@ -51,7 +53,7 @@ msgid "RMA In Type" msgstr "Entradas en RMA" #. module: crm_rma_location -#: code:addons/crm_rma_location/stock.py:134 +#: code:addons/crm_rma_location/models/stock_warehouse.py:129 #, python-format msgid "RMA Internal Transfers" msgstr "Transferencias internas en RMA" @@ -72,7 +74,7 @@ msgid "RMA Out Type" msgstr "Salidas en RMA" #. module: crm_rma_location -#: code:addons/crm_rma_location/stock.py:108 +#: code:addons/crm_rma_location/models/stock_warehouse.py:103 #, python-format msgid "RMA Receipts" msgstr "Recepciones de RMA" @@ -81,4 +83,3 @@ msgstr "Recepciones de RMA" #: model:ir.model,name:crm_rma_location.model_stock_warehouse msgid "Warehouse" msgstr "Almacén" - diff --git a/crm_rma_location/i18n/fr.po b/crm_rma_location/i18n/fr.po new file mode 100644 index 00000000..31f643e9 --- /dev/null +++ b/crm_rma_location/i18n/fr.po @@ -0,0 +1,85 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: rma (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-24 16:07+0000\n" +"PO-Revision-Date: 2015-11-03 17:05+0000\n" +"Last-Translator: <>\n" +"Language-Team: French (http://www.transifex.com/oca/OCA-rma-8-0/language/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:73 +#, python-format +msgid " Sequence in" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:83 +#, python-format +msgid " Sequence internal" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:78 +#, python-format +msgid " Sequence out" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:161 +#, python-format +msgid "RMA" +msgstr "RMA" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:115 +#, python-format +msgid "RMA Delivery Orders" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_in_type_id:0 +msgid "RMA In Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:129 +#, python-format +msgid "RMA Internal Transfers" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_int_type_id:0 +msgid "RMA Internal Type" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,lot_rma_id:0 +msgid "RMA Location" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_out_type_id:0 +msgid "RMA Out Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:103 +#, python-format +msgid "RMA Receipts" +msgstr "" + +#. module: crm_rma_location +#: model:ir.model,name:crm_rma_location.model_stock_warehouse +msgid "Warehouse" +msgstr "Entrepôt" From 029d66aa75febcee7ff9925a4beaeced183c27ba Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Sat, 12 Dec 2015 17:51:26 -0500 Subject: [PATCH 3/7] OCA Transbot updated translations from Transifex --- crm_rma_location/i18n/sl.po | 85 +++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 crm_rma_location/i18n/sl.po diff --git a/crm_rma_location/i18n/sl.po b/crm_rma_location/i18n/sl.po new file mode 100644 index 00000000..93400b20 --- /dev/null +++ b/crm_rma_location/i18n/sl.po @@ -0,0 +1,85 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: rma (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-12-05 22:30+0000\n" +"PO-Revision-Date: 2015-11-03 17:05+0000\n" +"Last-Translator: <>\n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-rma-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:73 +#, python-format +msgid " Sequence in" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:83 +#, python-format +msgid " Sequence internal" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:78 +#, python-format +msgid " Sequence out" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:161 +#, python-format +msgid "RMA" +msgstr "Pooblastilo vračila blaga" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:115 +#, python-format +msgid "RMA Delivery Orders" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_in_type_id:0 +msgid "RMA In Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:129 +#, python-format +msgid "RMA Internal Transfers" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_int_type_id:0 +msgid "RMA Internal Type" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,lot_rma_id:0 +msgid "RMA Location" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_out_type_id:0 +msgid "RMA Out Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:103 +#, python-format +msgid "RMA Receipts" +msgstr "" + +#. module: crm_rma_location +#: model:ir.model,name:crm_rma_location.model_stock_warehouse +msgid "Warehouse" +msgstr "" From c28bed1d3609c59d87d473b8b2d8c420f0d9cba3 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Sat, 19 Dec 2015 18:04:30 -0500 Subject: [PATCH 4/7] OCA Transbot updated translations from Transifex --- crm_rma_location/i18n/sl.po | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/crm_rma_location/i18n/sl.po b/crm_rma_location/i18n/sl.po index 93400b20..79bce187 100644 --- a/crm_rma_location/i18n/sl.po +++ b/crm_rma_location/i18n/sl.po @@ -3,13 +3,14 @@ # * crm_rma_location # # Translators: +# Matjaž Mozetič , 2015 msgid "" msgstr "" "Project-Id-Version: rma (8.0)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-05 22:30+0000\n" -"PO-Revision-Date: 2015-11-03 17:05+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2015-12-12 22:57+0000\n" +"PO-Revision-Date: 2015-12-13 06:20+0000\n" +"Last-Translator: Matjaž Mozetič \n" "Language-Team: Slovenian (http://www.transifex.com/oca/OCA-rma-8-0/language/sl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -21,65 +22,65 @@ msgstr "" #: code:addons/crm_rma_location/models/stock_warehouse.py:73 #, python-format msgid " Sequence in" -msgstr "" +msgstr "Vhodno zaporedje" #. module: crm_rma_location #: code:addons/crm_rma_location/models/stock_warehouse.py:83 #, python-format msgid " Sequence internal" -msgstr "" +msgstr "Interno zaporedje" #. module: crm_rma_location #: code:addons/crm_rma_location/models/stock_warehouse.py:78 #, python-format msgid " Sequence out" -msgstr "" +msgstr "Izhodno zaporedje" #. module: crm_rma_location #: code:addons/crm_rma_location/models/stock_warehouse.py:161 #, python-format msgid "RMA" -msgstr "Pooblastilo vračila blaga" +msgstr "Pooblastilo vračila blaga - PVB" #. module: crm_rma_location #: code:addons/crm_rma_location/models/stock_warehouse.py:115 #, python-format msgid "RMA Delivery Orders" -msgstr "" +msgstr "PVB dobavni nalogi" #. module: crm_rma_location #: field:stock.warehouse,rma_in_type_id:0 msgid "RMA In Type" -msgstr "" +msgstr "PVB vhodni tip" #. module: crm_rma_location #: code:addons/crm_rma_location/models/stock_warehouse.py:129 #, python-format msgid "RMA Internal Transfers" -msgstr "" +msgstr "PVB interni transferji" #. module: crm_rma_location #: field:stock.warehouse,rma_int_type_id:0 msgid "RMA Internal Type" -msgstr "" +msgstr "PVB interni tip" #. module: crm_rma_location #: field:stock.warehouse,lot_rma_id:0 msgid "RMA Location" -msgstr "" +msgstr "PVB lokacija" #. module: crm_rma_location #: field:stock.warehouse,rma_out_type_id:0 msgid "RMA Out Type" -msgstr "" +msgstr "PVB izhodni tip" #. module: crm_rma_location #: code:addons/crm_rma_location/models/stock_warehouse.py:103 #, python-format msgid "RMA Receipts" -msgstr "" +msgstr "PVB prejemi" #. module: crm_rma_location #: model:ir.model,name:crm_rma_location.model_stock_warehouse msgid "Warehouse" -msgstr "" +msgstr "Skladišče" From bcfbceaebc63ffea9b84fba5b891abe2526650ba Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Sat, 30 Jan 2016 20:10:31 -0500 Subject: [PATCH 5/7] OCA Transbot updated translations from Transifex --- crm_rma_location/i18n/de.po | 86 +++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 crm_rma_location/i18n/de.po diff --git a/crm_rma_location/i18n/de.po b/crm_rma_location/i18n/de.po new file mode 100644 index 00000000..63c9520a --- /dev/null +++ b/crm_rma_location/i18n/de.po @@ -0,0 +1,86 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +# Translators: +# Rudolf Schnapka , 2016 +msgid "" +msgstr "" +"Project-Id-Version: rma (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-01-19 12:26+0000\n" +"PO-Revision-Date: 2016-01-18 10:19+0000\n" +"Last-Translator: Rudolf Schnapka \n" +"Language-Team: German (http://www.transifex.com/oca/OCA-rma-8-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:73 +#, python-format +msgid " Sequence in" +msgstr "Eingangsfolge" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:83 +#, python-format +msgid " Sequence internal" +msgstr "Interne Folge" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:78 +#, python-format +msgid " Sequence out" +msgstr "Ausgangsfolge" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:161 +#, python-format +msgid "RMA" +msgstr "RMA" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:115 +#, python-format +msgid "RMA Delivery Orders" +msgstr "RMA-Lieferscheine" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_in_type_id:0 +msgid "RMA In Type" +msgstr "RMA aus Art" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:129 +#, python-format +msgid "RMA Internal Transfers" +msgstr "RMA interne Umbuchungen" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_int_type_id:0 +msgid "RMA Internal Type" +msgstr "Interne RMA-Art" + +#. module: crm_rma_location +#: field:stock.warehouse,lot_rma_id:0 +msgid "RMA Location" +msgstr "RMA-Anschrift" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_out_type_id:0 +msgid "RMA Out Type" +msgstr "Art Ausgehender RMA" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:103 +#, python-format +msgid "RMA Receipts" +msgstr "RMA-Eingänge" + +#. module: crm_rma_location +#: model:ir.model,name:crm_rma_location.model_stock_warehouse +msgid "Warehouse" +msgstr "Warenlager" From 09805bf635cfe6a4432ff3be468f25df4fbde03d Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Sun, 13 Mar 2016 00:06:26 -0500 Subject: [PATCH 6/7] OCA Transbot updated translations from Transifex --- crm_rma_location/i18n/pt_BR.po | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 crm_rma_location/i18n/pt_BR.po diff --git a/crm_rma_location/i18n/pt_BR.po b/crm_rma_location/i18n/pt_BR.po new file mode 100644 index 00000000..d8e8eebc --- /dev/null +++ b/crm_rma_location/i18n/pt_BR.po @@ -0,0 +1,86 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_rma_location +# +# Translators: +# danimaribeiro , 2016 +msgid "" +msgstr "" +"Project-Id-Version: rma (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-01-19 12:26+0000\n" +"PO-Revision-Date: 2016-03-08 03:12+0000\n" +"Last-Translator: danimaribeiro \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-rma-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:73 +#, python-format +msgid " Sequence in" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:83 +#, python-format +msgid " Sequence internal" +msgstr "Sequência interna" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:78 +#, python-format +msgid " Sequence out" +msgstr "Sequência de saida" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:161 +#, python-format +msgid "RMA" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:115 +#, python-format +msgid "RMA Delivery Orders" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_in_type_id:0 +msgid "RMA In Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:129 +#, python-format +msgid "RMA Internal Transfers" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_int_type_id:0 +msgid "RMA Internal Type" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,lot_rma_id:0 +msgid "RMA Location" +msgstr "" + +#. module: crm_rma_location +#: field:stock.warehouse,rma_out_type_id:0 +msgid "RMA Out Type" +msgstr "" + +#. module: crm_rma_location +#: code:addons/crm_rma_location/models/stock_warehouse.py:103 +#, python-format +msgid "RMA Receipts" +msgstr "" + +#. module: crm_rma_location +#: model:ir.model,name:crm_rma_location.model_stock_warehouse +msgid "Warehouse" +msgstr "" From ecef773cb876760346c2cd108654f88e64ccad96 Mon Sep 17 00:00:00 2001 From: Cyril Gaudin Date: Mon, 9 May 2016 11:07:56 +0200 Subject: [PATCH 7/7] crm_rma_location: v9 migration --- crm_rma_location/README.rst | 4 +- crm_rma_location/__init__.py | 35 +-- crm_rma_location/__openerp__.py | 23 +- crm_rma_location/models/__init__.py | 23 +- crm_rma_location/models/stock_warehouse.py | 225 +++++++++----------- crm_rma_location/tests/__init__.py | 19 -- crm_rma_location/tests/test_location_rma.py | 21 +- crm_rma_location/views/stock_warehouse.xml | 36 ++-- 8 files changed, 136 insertions(+), 250 deletions(-) diff --git a/crm_rma_location/README.rst b/crm_rma_location/README.rst index 38d7eb5f..bb964b8a 100644 --- a/crm_rma_location/README.rst +++ b/crm_rma_location/README.rst @@ -27,7 +27,7 @@ Usage .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/145/8.0 + :target: https://runbot.odoo-community.org/runbot/145/9.0 For further information, please visit: @@ -44,8 +44,6 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. - Credits ======= diff --git a/crm_rma_location/__init__.py b/crm_rma_location/__init__.py index 3cb92eb9..92b1a87d 100644 --- a/crm_rma_location/__init__.py +++ b/crm_rma_location/__init__.py @@ -1,33 +1,16 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright 2015 Vauxoo -# Author: Yanina Aular -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Yanina Aular, Vauxoo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models + from openerp import SUPERUSER_ID +from openerp.api import Environment def post_init_hook(cr, registry): - stock_wh = registry['stock.warehouse'] - for wh_id in stock_wh.browse(cr, SUPERUSER_ID, - stock_wh.search(cr, SUPERUSER_ID, [])): - vals = stock_wh.create_locations_rma(cr, SUPERUSER_ID, wh_id) - stock_wh.write(cr, SUPERUSER_ID, wh_id.id, vals) - vals = stock_wh.create_sequences_picking_types(cr, SUPERUSER_ID, wh_id) - stock_wh.write(cr, SUPERUSER_ID, wh_id.id, vals) + env = Environment(cr, SUPERUSER_ID, {}) + + warehouses = env['stock.warehouse'].search([]) + warehouses.create_locations_rma() + warehouses.create_sequences_picking_types() diff --git a/crm_rma_location/__openerp__.py b/crm_rma_location/__openerp__.py index 08527cf5..8eed2270 100644 --- a/crm_rma_location/__openerp__.py +++ b/crm_rma_location/__openerp__.py @@ -1,27 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright 2015 Vauxoo -# Author: Yanina Aular -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © Guewen Yanina Aular, Vauxoo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'RMA Location', - 'version': '8.0.1.0.0', + 'version': '9.0.1.0.0', 'author': "Vauxoo, Odoo Community Association (OCA)", 'license': 'AGPL-3', 'website': 'http://www.camptocamp.com,http://www.vauxoo.com', diff --git a/crm_rma_location/models/__init__.py b/crm_rma_location/models/__init__.py index 59059dd4..ebf0dc55 100644 --- a/crm_rma_location/models/__init__.py +++ b/crm_rma_location/models/__init__.py @@ -1,23 +1,6 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright 2013 Camptocamp -# Copyright 2015 Vauxoo -# Author: Yanina Aular -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2013 Camptocamp +# © 2015 Yanina Aular, Vauxoo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import stock_warehouse diff --git a/crm_rma_location/models/stock_warehouse.py b/crm_rma_location/models/stock_warehouse.py index 479bbc79..6a52109b 100644 --- a/crm_rma_location/models/stock_warehouse.py +++ b/crm_rma_location/models/stock_warehouse.py @@ -1,25 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright 2013 Camptocamp -# Copyright 2015 Vauxoo -# Author: Yanina Aular -# Osval Reyes -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2013 Camptocamp +# © 2015 Osval Reyes, Yanina Aular, Vauxoo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import _, api, fields, models @@ -50,134 +32,129 @@ class StockWarehouse(models.Model): return available_colors[0] if available_colors else 0 - def create_sequence(self, warehouse_id, name, prefix, padding): + def create_sequence(self, name, prefix, padding): + self.ensure_one() return self.env['ir.sequence'].sudo().\ create(values={ - 'name': warehouse_id.name + name, - 'prefix': warehouse_id.code + prefix, + 'name': self.name + name, + 'prefix': self.code + prefix, 'padding': padding, - 'company_id': warehouse_id.company_id.id + 'company_id': self.company_id.id }) - @api.model - def create_sequences_picking_types(self, warehouse): + @api.multi + def create_sequences_picking_types(self): """ Takes care of create picking types for internal, incoming and outgoing RMA """ - picking_type = self.env['stock.picking.type'] + picking_type_model = self.env['stock.picking.type'] - # create new sequences - if not warehouse.rma_in_type_id: - in_seq_id = self.create_sequence( - warehouse, _(' Sequence in'), '/RMA/IN/', 5 + for warehouse in self: + # create new sequences + if not warehouse.rma_in_type_id: + in_seq_id = warehouse.create_sequence( + _(' Sequence in'), '/RMA/IN/', 5 + ) + + if not warehouse.rma_out_type_id: + out_seq_id = warehouse.create_sequence( + _(' Sequence out'), '/RMA/OUT/', 5 + ) + + if not warehouse.rma_int_type_id: + int_seq_id = warehouse.create_sequence( + _(' Sequence internal'), '/RMA/INT/', 5 + ) + + wh_stock_loc = warehouse.lot_rma_id + + # fetch customer and supplier locations, for references + customer_loc, supplier_loc = self._get_partner_locations() + + color = self.compute_next_color() + + # order the picking types with a sequence + # allowing to have the following suit for + # each warehouse: reception, internal, pick, pack, ship. + max_sequence = picking_type_model.search_read( + [], ['sequence'], order='sequence desc' ) + max_sequence = max_sequence and max_sequence[0]['sequence'] or 0 - if not warehouse.rma_out_type_id: - out_seq_id = self.create_sequence( - warehouse, _(' Sequence out'), '/RMA/OUT/', 5 - ) + in_type_id = warehouse.rma_in_type_id + if not in_type_id: + in_type_id = picking_type_model.create(vals={ + 'name': _('RMA Receipts'), + 'warehouse_id': warehouse.id, + 'code': 'incoming', + 'sequence_id': in_seq_id.id, + 'default_location_src_id': customer_loc.id, + 'default_location_dest_id': wh_stock_loc.id, + 'sequence': max_sequence + 4, + 'color': color}) - if not warehouse.rma_int_type_id: - int_seq_id = self.create_sequence( - warehouse, _(' Sequence internal'), '/RMA/INT/', 5 - ) + out_type_id = warehouse.rma_out_type_id + if not out_type_id: + out_type_id = picking_type_model.create(vals={ + 'name': _('RMA Delivery Orders'), + 'warehouse_id': warehouse.id, + 'code': 'outgoing', + 'sequence_id': out_seq_id.id, + 'return_picking_type_id': in_type_id.id, + 'default_location_src_id': wh_stock_loc.id, + 'default_location_dest_id': supplier_loc.id, + 'sequence': max_sequence + 1, + 'color': color}) + in_type_id.write({'return_picking_type_id': out_type_id.id}) - wh_stock_loc = warehouse.lot_rma_id + int_type_id = warehouse.rma_int_type_id + if not int_type_id: + int_type_id = picking_type_model.create(vals={ + 'name': _('RMA Internal Transfers'), + 'warehouse_id': warehouse.id, + 'code': 'internal', + 'sequence_id': int_seq_id.id, + 'default_location_src_id': wh_stock_loc.id, + 'default_location_dest_id': wh_stock_loc.id, + 'active': True, + 'sequence': max_sequence + 2, + 'color': color}) - # fetch customer and supplier locations, for references - customer_loc, supplier_loc = self._get_partner_locations() + # write picking types on WH + warehouse.write({ + 'rma_in_type_id': in_type_id.id, + 'rma_out_type_id': out_type_id.id, + 'rma_int_type_id': int_type_id.id, + }) - color = self.compute_next_color() - - # order the picking types with a sequence - # allowing to have the following suit for - # each warehouse: reception, internal, pick, pack, ship. - max_sequence = self.env['stock.picking.type'].\ - search_read([], ['sequence'], order='sequence desc') - max_sequence = max_sequence and max_sequence[0]['sequence'] or 0 - - in_type_id = warehouse.rma_in_type_id - if not in_type_id: - in_type_id = picking_type.create(vals={ - 'name': _('RMA Receipts'), - 'warehouse_id': warehouse.id, - 'code': 'incoming', - 'sequence_id': in_seq_id.id, - 'default_location_src_id': customer_loc.id, - 'default_location_dest_id': wh_stock_loc.id, - 'sequence': max_sequence + 4, - 'color': color}) - - out_type_id = warehouse.rma_out_type_id - if not out_type_id: - out_type_id = picking_type.create(vals={ - 'name': _('RMA Delivery Orders'), - 'warehouse_id': warehouse.id, - 'code': 'outgoing', - 'sequence_id': out_seq_id.id, - 'return_picking_type_id': in_type_id.id, - 'default_location_src_id': wh_stock_loc.id, - 'default_location_dest_id': supplier_loc.id, - 'sequence': max_sequence + 1, - 'color': color}) - in_type_id.write({'return_picking_type_id': out_type_id.id}) - - int_type_id = warehouse.rma_int_type_id - if not int_type_id: - int_type_id = picking_type.create(vals={ - 'name': _('RMA Internal Transfers'), - 'warehouse_id': warehouse.id, - 'code': 'internal', - 'sequence_id': int_seq_id.id, - 'default_location_src_id': wh_stock_loc.id, - 'default_location_dest_id': wh_stock_loc.id, - 'active': True, - 'sequence': max_sequence + 2, - 'color': color}) - - # write picking types on WH - vals = { - 'rma_in_type_id': in_type_id.id, - 'rma_out_type_id': out_type_id.id, - 'rma_int_type_id': int_type_id.id, - } - return vals - - @api.model - def create_locations_rma(self, warehouse_id): + @api.multi + def create_locations_rma(self): """ Create a RMA location for RMA movements that takes place when internal, outgoing or incoming pickings are made from/to this location """ - vals = {} - location_obj = self.env['stock.location'] - context_with_inactive = self.env.context.copy() - context_with_inactive['active_test'] = False - if not warehouse_id.lot_rma_id: - loc_vals = { - 'name': _('RMA'), - 'usage': 'internal', - 'location_id': warehouse_id.view_location_id.id, - 'company_id': warehouse_id.company_id.id, - 'active': True, - } - location_id = location_obj.with_context(context_with_inactive).\ - create(loc_vals) - vals['lot_rma_id'] = location_id.id - - return vals + for warehouse in self: + if not warehouse.lot_rma_id: + location_id = location_obj.with_context( + active_test=False + ).create({ + 'name': _('RMA'), + 'usage': 'internal', + 'location_id': warehouse.view_location_id.id, + 'company_id': warehouse.company_id.id, + 'active': True, + }) + warehouse.lot_rma_id = location_id @api.model def create(self, vals): """ Create Locations and picking types for warehouse """ - warehouse_id = super(StockWarehouse, self).create(vals=vals) - new_vals = self.create_locations_rma(warehouse_id) - warehouse_id.write(vals=new_vals) - new_vals = self.create_sequences_picking_types(warehouse_id) - warehouse_id.write(vals=new_vals) - return warehouse_id + warehouse = super(StockWarehouse, self).create(vals=vals) + warehouse.create_locations_rma() + warehouse.create_sequences_picking_types() + return warehouse diff --git a/crm_rma_location/tests/__init__.py b/crm_rma_location/tests/__init__.py index ed9b4717..342ce3b2 100644 --- a/crm_rma_location/tests/__init__.py +++ b/crm_rma_location/tests/__init__.py @@ -1,22 +1,3 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright 2015 Vauxoo -# Author: Osval Reyes -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## from . import test_location_rma diff --git a/crm_rma_location/tests/test_location_rma.py b/crm_rma_location/tests/test_location_rma.py index 77c3e64c..4c04bcc6 100644 --- a/crm_rma_location/tests/test_location_rma.py +++ b/crm_rma_location/tests/test_location_rma.py @@ -1,23 +1,6 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright 2015 Vauxoo -# Author: Osval Reyes -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Osval Reyes, Vauxoo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp.tests.common import TransactionCase diff --git a/crm_rma_location/views/stock_warehouse.xml b/crm_rma_location/views/stock_warehouse.xml index cdaddeb9..e3716b20 100644 --- a/crm_rma_location/views/stock_warehouse.xml +++ b/crm_rma_location/views/stock_warehouse.xml @@ -1,21 +1,19 @@ - - - - view_warehouse_form - stock.warehouse - - - - - - - - - - - - - - + + + view_warehouse_form + stock.warehouse + + + + + + + + + + + + +