[ADD] add module mrp_discount

This commit is contained in:
Nicola Malcontenti
2016-03-01 09:31:22 +01:00
parent e7a1f30ab8
commit c070c93b8d
6 changed files with 122 additions and 0 deletions

View File

@@ -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
<https://github.com/OCA/manufacture/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
<https://github.com/OCA/
manufacture/issues/new?body=module:%20
mrp_repair_discount%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
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.

View File

@@ -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

View File

@@ -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 <nicola.malcontenti@gmail.com>",
],
'depends': ['mrp_repair'],
"data": ["views/mrp_repair_view.xml"],
"installable": True,
}

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_repair_order_discount_form" model="ir.ui.view">
<field name="name">mrp.repair.discount.form</field>
<field name="model">mrp.repair</field>
<field name="inherit_id" ref="mrp_repair.view_repair_order_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='operations']/tree/field[@name='price_subtotal']" position='before'>
<field name="discount"/>
</xpath>
</field>
</record>
</data>
</openerp>