diff --git a/crm_claim_product_supplier/README.rst b/crm_claim_product_supplier/README.rst new file mode 100644 index 00000000..d02af3f1 --- /dev/null +++ b/crm_claim_product_supplier/README.rst @@ -0,0 +1,75 @@ +.. 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 Claim Product Supplier +========================== + +This module adds information in claim lines to keep supplier and supplier +invoice when creating/editing a claim. + +As this module shows, this is not used directly be the end user, it may be used +as complementary for another modules to explode information stored by this one. + +Installation +============ + +To install this module, just select it from available modules + +Configuration +============= + +Aditional configuration is not needed + +Usage +===== + +* End-user direct usage is not possible, all the functionality contained in this + module is done under the hood and no view is included + +.. 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 exists 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 +------------ + +* Yanina Aular +* Osval Reyes + +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_claim_product_supplier/__init__.py b/crm_claim_product_supplier/__init__.py new file mode 100644 index 00000000..8fdccbce --- /dev/null +++ b/crm_claim_product_supplier/__init__.py @@ -0,0 +1,22 @@ +# -*- 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 diff --git a/crm_claim_product_supplier/__openerp__.py b/crm_claim_product_supplier/__openerp__.py new file mode 100644 index 00000000..a548cbd4 --- /dev/null +++ b/crm_claim_product_supplier/__openerp__.py @@ -0,0 +1,34 @@ +# -*- 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': 'CRM Claim Product Supplier', + 'version': '8.0.1.0.0', + 'author': 'Vauxoo, Odoo Community Association (OCA)', + 'website': 'http://www.vauxoo.com/', + 'license': 'AGPL-3', + 'category': 'Generic Modules/CRM & SRM', + 'depends': [ + 'crm_rma_lot_mass_return', + ], + 'installable': True, + 'auto_install': False, +} diff --git a/crm_claim_product_supplier/i18n/crm_claim_product_supplier.pot b/crm_claim_product_supplier/i18n/crm_claim_product_supplier.pot new file mode 100644 index 00000000..bf1d708a --- /dev/null +++ b/crm_claim_product_supplier/i18n/crm_claim_product_supplier.pot @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_claim_product_supplier +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-08-14 19:24+0000\n" +"PO-Revision-Date: 2015-08-14 19:24+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_claim_product_supplier +#: model:ir.model,name:crm_claim_product_supplier.model_claim_line +msgid "List of product to return" +msgstr "" diff --git a/crm_claim_product_supplier/i18n/es.po b/crm_claim_product_supplier/i18n/es.po new file mode 100644 index 00000000..56a95d2e --- /dev/null +++ b/crm_claim_product_supplier/i18n/es.po @@ -0,0 +1,16 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_claim_product_supplier +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-17 18:01+0000\n" +"PO-Revision-Date: 2015-07-17 18:01+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_claim_product_supplier/models/__init__.py b/crm_claim_product_supplier/models/__init__.py new file mode 100644 index 00000000..7ee9cd84 --- /dev/null +++ b/crm_claim_product_supplier/models/__init__.py @@ -0,0 +1,21 @@ +# -*- 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 claim_line diff --git a/crm_claim_product_supplier/models/claim_line.py b/crm_claim_product_supplier/models/claim_line.py new file mode 100644 index 00000000..6f0b3a28 --- /dev/null +++ b/crm_claim_product_supplier/models/claim_line.py @@ -0,0 +1,32 @@ +# -*- 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 openerp import fields, models + + +class ClaimLine(models.Model): + + _inherit = 'claim.line' + + supplier_id = fields.Many2one(comodel_name='res.partner', + related='prodlot_id.supplier_id') + supplier_invoice_id = fields.Many2one( + comodel_name='account.invoice', + related="prodlot_id.supplier_invoice_line_id.invoice_id") diff --git a/crm_claim_product_supplier/tests/__init__.py b/crm_claim_product_supplier/tests/__init__.py new file mode 100644 index 00000000..7f6e2fcc --- /dev/null +++ b/crm_claim_product_supplier/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_crm_claim_product_supplier diff --git a/crm_claim_product_supplier/tests/test_crm_claim_product_supplier.py b/crm_claim_product_supplier/tests/test_crm_claim_product_supplier.py new file mode 100644 index 00000000..7925c207 --- /dev/null +++ b/crm_claim_product_supplier/tests/test_crm_claim_product_supplier.py @@ -0,0 +1,67 @@ +# -*- 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 TestCrmClaimProductSupplier(TransactionCase): + + def setUp(self): + super(TestCrmClaimProductSupplier, self).setUp() + self.sale_order_id = self.env.ref( + 'crm_rma_lot_mass_return.so_wizard_rma_1') + self.invoice_id = self.sale_order_id.invoice_ids[0] + self.metasearch_wizard = self.env['returned.lines.from.serial.wizard'] + self.lot_id = self.env.ref( + 'crm_rma_lot_mass_return.lot_purchase_wizard_rma_item_5') + + # Create the claim with a claim line + self.claim_id = self.env['crm.claim'].create({ + 'name': 'TEST CLAIM', + 'claim_type': self.ref('crm_claim_type.' + 'crm_claim_type_customer'), + 'partner_id': self.sale_order_id.partner_id.id, + }) + + wizard_id = self.metasearch_wizard.with_context({ + 'active_model': self.claim_id._name, + 'active_id': self.claim_id.id, + 'active_ids': [self.claim_id.id] + }).create({}) + + # Get ids for invoice lines + lines_list_id = wizard_id.onchange_load_products( + self.lot_id.name + '\n', [(6, 0, [])] + )['domain']['lines_list_id'][0][2] + + # Get ids for invoice lines + lines_list_id = self.env['claim.line.wizard'].search( + [('lot_id.name', '=', 'IPAD0001')]).mapped('id') + + wizard_id.option_ids = lines_list_id + wizard_id.lines_list_id = [(6, 0, lines_list_id)] + + wizard_id.add_claim_lines() + + def test_01_product_supplier(self): + claim_line_id = self.claim_id.claim_line_ids[0] + self.assertTrue(claim_line_id.supplier_id) + self.assertTrue(claim_line_id.supplier_invoice_id)