diff --git a/mrp_repair_discount/README.rst b/mrp_repair_discount/README.rst new file mode 100644 index 000000000..64b0b05eb --- /dev/null +++ b/mrp_repair_discount/README.rst @@ -0,0 +1,55 @@ +... 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 + +=================== +MRP Repair Discount +=================== + +This module extends the functionality of mrp repair adding +new field discount on operation's lines + +.. 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/8.0 + + +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 +`_. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Nicola Malcontenti + +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 https://odoo-community.org. \ No newline at end of file diff --git a/mrp_repair_discount/__init__.py b/mrp_repair_discount/__init__.py new file mode 100644 index 000000000..421162bb0 --- /dev/null +++ b/mrp_repair_discount/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2015 Nicola Malcontenti - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mrp_repair_discount/__openerp__.py b/mrp_repair_discount/__openerp__.py new file mode 100644 index 000000000..c5494d5df --- /dev/null +++ b/mrp_repair_discount/__openerp__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# © 2015 Nicola Malcontenti - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "MRP Repair Discount", + "version": "8.0.1.0.0", + "category": "Manufactoring", + "license": "AGPL-3", + "author": "Agile Business Group, Odoo Community Association (OCA)", + "website": "http://www.agilebg.com", + "contributors": [ + "Nicola Malcontenti ", + ], + 'depends': ['mrp_repair'], + "data": ["views/mrp_repair_view.xml"], + "installable": True, +} diff --git a/mrp_repair_discount/models/__init__.py b/mrp_repair_discount/models/__init__.py new file mode 100644 index 000000000..a84a56b6f --- /dev/null +++ b/mrp_repair_discount/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2015 Nicola Malcontenti - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import mrp_repair diff --git a/mrp_repair_discount/models/mrp_repair.py b/mrp_repair_discount/models/mrp_repair.py new file mode 100644 index 000000000..49e9c7395 --- /dev/null +++ b/mrp_repair_discount/models/mrp_repair.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# © 2015 Nicola Malcontenti - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import fields, models +from openerp.osv import orm + + +class MrpRepairLine(models.Model): + _inherit = 'mrp.repair.line' + + discount = fields.Float(string='Discount (%)') + + +class MrpRepair(orm.Model): + _inherit = 'mrp.repair' + + def action_invoice_create(self, cr, uid, ids, group=False, context=None): + res = super(MrpRepair, self).action_invoice_create( + cr, uid, ids, group, context) + repair_obj = self.browse(cr, uid, ids, context=context) + for op in repair_obj.operations: + op.invoice_line_id.discount = op.discount + return res diff --git a/mrp_repair_discount/views/mrp_repair_view.xml b/mrp_repair_discount/views/mrp_repair_view.xml new file mode 100644 index 000000000..13d5c7365 --- /dev/null +++ b/mrp_repair_discount/views/mrp_repair_view.xml @@ -0,0 +1,15 @@ + + + + + mrp.repair.discount.form + mrp.repair + + + + + + + + +