diff --git a/.travis.yml b/.travis.yml index d0d20caaa..4c1a4ce23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,12 @@ python: addons: apt: + sources: + - pov-wkhtmltopdf packages: - expect-dev # provides unbuffer utility - python-lxml # because pip installation is slow + - wkhtmltopdf env: global: @@ -26,6 +29,10 @@ env: virtualenv: system_site_packages: true +before_install: + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + install: - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} diff --git a/mrp_production_partner_note/README.rst b/mrp_production_partner_note/README.rst index cfd676af7..66be923d6 100644 --- a/mrp_production_partner_note/README.rst +++ b/mrp_production_partner_note/README.rst @@ -1,12 +1,24 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 -Partner production notes -======================== +================================== +Partner notes in production orders +================================== This module adds the possibility of defining a note for production in the partner so when the MO is automatically created, this note will be written. +Usage +===== + +* Go to Sales > Sales > Customers +* Add a note for manufacturing in internal notes tab +* When a manufacturing order is created automatically from a sale order it will + be added that note + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/129/9.0 Bug Tracker =========== @@ -14,8 +26,7 @@ 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 `_. - +`here `_. Credits ======= diff --git a/mrp_production_partner_note/__init__.py b/mrp_production_partner_note/__init__.py index 054c8853d..6ea76f9a8 100644 --- a/mrp_production_partner_note/__init__.py +++ b/mrp_production_partner_note/__init__.py @@ -1,6 +1,5 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# -*- coding: utf-8 -*- +# © 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models diff --git a/mrp_production_partner_note/__openerp__.py b/mrp_production_partner_note/__openerp__.py index 20531ab70..edae41847 100644 --- a/mrp_production_partner_note/__openerp__.py +++ b/mrp_production_partner_note/__openerp__.py @@ -1,24 +1,11 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# 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 http://www.gnu.org/licenses/. -# -############################################################################## +# -*- coding: utf-8 -*- +# © 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { "name": "MRP - Partner production notes", - "version": "8.0.1.0.0", + "version": "9.0.1.0.0", + "license": "AGPL-3", "author": "OdooMRP team," "AvanzOSC," "Serv. Tecnol. Avanzados - Pedro M. Baeza, " @@ -37,5 +24,8 @@ "data": [ "views/res_partner_view.xml", ], - 'installable': False + "images": [ + "images/partner_note.png", + ], + "installable": True, } diff --git a/mrp_production_partner_note/images/partner_note.png b/mrp_production_partner_note/images/partner_note.png new file mode 100644 index 000000000..2a0ac92cd Binary files /dev/null and b/mrp_production_partner_note/images/partner_note.png differ diff --git a/mrp_production_partner_note/models/__init__.py b/mrp_production_partner_note/models/__init__.py index 5c7957575..ba747d799 100644 --- a/mrp_production_partner_note/models/__init__.py +++ b/mrp_production_partner_note/models/__init__.py @@ -1,7 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# -*- coding: utf-8 -*- +# © 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import res_partner from . import procurement_order diff --git a/mrp_production_partner_note/models/procurement_order.py b/mrp_production_partner_note/models/procurement_order.py index 5229e13f0..fbfd82c01 100644 --- a/mrp_production_partner_note/models/procurement_order.py +++ b/mrp_production_partner_note/models/procurement_order.py @@ -1,7 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# -*- coding: utf-8 -*- +# © 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, api diff --git a/mrp_production_partner_note/models/res_partner.py b/mrp_production_partner_note/models/res_partner.py index 8381b6cf7..349823148 100644 --- a/mrp_production_partner_note/models/res_partner.py +++ b/mrp_production_partner_note/models/res_partner.py @@ -1,7 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# -*- coding: utf-8 -*- +# © 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, fields diff --git a/mrp_production_partner_note/tests/__init__.py b/mrp_production_partner_note/tests/__init__.py new file mode 100644 index 000000000..fc105c374 --- /dev/null +++ b/mrp_production_partner_note/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import test_mrp_production_partner_note diff --git a/mrp_production_partner_note/tests/test_mrp_production_partner_note.py b/mrp_production_partner_note/tests/test_mrp_production_partner_note.py new file mode 100644 index 000000000..9fc5fe529 --- /dev/null +++ b/mrp_production_partner_note/tests/test_mrp_production_partner_note.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# © 2016 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp.tests import common + + +class TestMrpProductionPartnerNote(common.TransactionCase): + + def setUp(self): + super(TestMrpProductionPartnerNote, self).setUp() + self.note = "This is a test production note" + self.procurement_model = self.env['procurement.order'] + self.product = self.browse_ref('product.product_product_18') + self.product.route_ids = [ + (4, self.ref('mrp.route_warehouse0_manufacture')), + (4, self.ref('stock.route_warehouse0_mto'))] + self.partner = self.browse_ref('base.res_partner_2') + self.partner.write({ + 'mrp_notes': self.note}) + + def test_production_notes(self): + sale_order = self.env['sale.order'].create({ + 'partner_id': self.partner.id, + 'partner_invoice_id': self.partner.id, + 'partner_shipping_id': self.partner.id, + 'order_line': [(0, 0, { + 'name': self.product.name, + 'product_id': self.product.id, + 'product_uom_qty': 2, + 'product_uom': self.product.uom_id.id, + 'price_unit': self.product.list_price})], + 'pricelist_id': self.env.ref('product.list0').id, + }) + sale_order.action_confirm() + procurement = self.procurement_model.search( + [('sale_line_id', 'in', sale_order.mapped('order_line').ids)]) + procurements = self.procurement_model.search( + [('group_id', '=', procurement.group_id.id)]) + procurements.run() + productions = procurements.mapped('production_id') + for note in productions.mapped('notes'): + self.assertEqual( + "

%s

" % (self.note), note, + "MO note must be the same as '%s'" % (note)) + self.assertEqual( + self.partner.mrp_notes, note, + "MO note must be taken from partner") diff --git a/mrp_production_partner_note/views/res_partner_view.xml b/mrp_production_partner_note/views/res_partner_view.xml index d0eed2fef..643b47838 100644 --- a/mrp_production_partner_note/views/res_partner_view.xml +++ b/mrp_production_partner_note/views/res_partner_view.xml @@ -1,17 +1,14 @@ - - - - res.partner.production_notes.form - res.partner - - - - - - - - - + + + res.partner.production_notes.form + res.partner + + + + + + +