[IMP] repair: renamed model names xmlid

- Also rename file references with new one.
- model renamed
	mrp.repair to repair.order
	mrp.repair.line -> repair.line
	mrp.repair.fee -> repair.fee
	mrp.repair.cancel -> repair.cancel
	mrp.repair.make_invoice -> repair.order.make_invoice
This commit is contained in:
Haresh Shyara
2018-01-10 15:30:50 +01:00
committed by Simon Lejeune
parent d20e1d30a1
commit 5f6b0a7bc5
23 changed files with 135 additions and 135 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ class ResConfigSettings(models.TransientModel):
module_mrp_plm = fields.Boolean("Product Lifecycle Management (PLM)")
module_mrp_maintenance = fields.Boolean("Maintenance")
module_mrp_workorder = fields.Boolean("Work Orders")
module_mrp_repair = fields.Boolean("Repair")
module_repair = fields.Boolean("Repair")
module_quality_control = fields.Boolean("Quality")
group_mrp_routings = fields.Boolean("MRP Work Orders",
implied_group='mrp.group_mrp_routings')
@@ -44,12 +44,12 @@
</div>
</div>
</div>
<div class="col-md-6 col-xs-12 o_setting_box" id="mrp_repair">
<div class="col-md-6 col-xs-12 o_setting_box" id="repair">
<div class="o_setting_left_pane">
<field name="module_mrp_repair"/>
<field name="module_repair"/>
</div>
<div class="o_setting_right_pane">
<label for="module_mrp_repair"/>
<label for="module_repair"/>
<div class="text-muted">
Repair products and invoice the repair orders
</div>
+8 -8
View File
@@ -25,17 +25,17 @@ The following topics are covered by this module:
'website': 'https://www.odoo.com/page/manufacturing',
'data': [
'security/ir.model.access.csv',
'security/mrp_repair_security.xml',
'wizard/mrp_repair_cancel_views.xml',
'wizard/mrp_repair_make_invoice_views.xml',
'security/repair_security.xml',
'wizard/repair_cancel_views.xml',
'wizard/repair_make_invoice_views.xml',
'wizard/stock_warn_insufficient_qty_views.xml',
'views/mrp_repair_views.xml',
'report/mrp_repair_reports.xml',
'report/mrp_repair_templates_repair_order.xml',
'views/repair_views.xml',
'report/repair_reports.xml',
'report/repair_templates_repair_order.xml',
'data/ir_sequence_data.xml',
'data/mrp_repair_data.xml',
'data/repair_data.xml',
],
'demo': ['data/mrp_repair_demo.xml'],
'demo': ['data/repair_demo.xml'],
'test': [],
'installable': True,
'auto_install': False,
+2 -2
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="seq_mrp_repair" model="ir.sequence">
<record id="seq_repair" model="ir.sequence">
<field name="name">Repair Order</field>
<field name="code">mrp.repair</field>
<field name="code">repair.order</field>
<field name="prefix">RMA/</field>
<field name="padding">5</field>
</record>
+4 -4
View File
@@ -3,13 +3,13 @@
<data noupdate="1">
<!--Email template -->
<record id="mail_template_mrp_repair_quotation" model="mail.template">
<field name="name">Mrp Repair Quotation - Send by Email</field>
<record id="mail_template_repair_quotation" model="mail.template">
<field name="name">Repair Quotation - Send by Email</field>
<field name="email_from">${(object.create_uid.email and '%s &lt;%s&gt;' % (object.create_uid.name, object.create_uid.email) or '')|safe}</field>
<field name="subject">${object.partner_id.name} Repair Orders (Ref ${object.name or 'n/a' })</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="model_id" ref="mrp_repair.model_mrp_repair"/>
<field name="report_template" ref="action_report_mrp_repair_order"/>
<field name="model_id" ref="repair.model_repair_order"/>
<field name="report_template" ref="action_report_repair_order"/>
<field name="report_name">${(object.name or '').replace('/','_')}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html" type="xml">
+9 -9
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="mrp_repair_rmrp1" model="mrp.repair">
<record id="repair_r1" model="repair.order">
<field name="address_id" ref="base.res_partner_address_1"/>
<field name="guarantee_limit" eval="datetime.today().strftime('%Y-%m-%d')"/>
<field name="invoice_method">none</field>
@@ -9,7 +9,7 @@
<field name="partner_invoice_id" ref="base.res_partner_address_1"/>
<field name="location_dest_id" ref="base.res_partner_address_1"/>
<field name="location_id" ref="stock.stock_location_stock"/>
<field name="operations" model="mrp.repair.line" eval="[(5, 0, 0), (0, 0, {
<field name="operations" model="repair.line" eval="[(5, 0, 0), (0, 0, {
'location_dest_id': obj().env.ref('stock.location_production').id,
'location_id': obj().env.ref('stock.stock_location_stock').id,
'name': '[M-Las] Mouse, Laser',
@@ -20,7 +20,7 @@
'state': 'draft',
'type': 'add',
})]"/>
<field name="fees_lines" model="mrp.repair.fee" eval="[(5, 0, 0), (0, 0, {
<field name="fees_lines" model="repair.fee" eval="[(5, 0, 0), (0, 0, {
'name': 'Laptop formatting fees',
'product_id': obj().env.ref('product.product_product_11c').id,
'product_uom_qty': 1.0,
@@ -30,7 +30,7 @@
<field name="partner_id" ref="base.res_partner_12"/>
</record>
<record id="mrp_repair_rmrp0" model="mrp.repair">
<record id="repair_r0" model="repair.order">
<field name="product_id" ref="product.product_product_5"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="address_id" ref="base.res_partner_address_1"/>
@@ -39,7 +39,7 @@
<field name="partner_invoice_id" ref="base.res_partner_address_1"/>
<field name="location_dest_id" ref="stock.stock_location_14"/>
<field name="location_id" ref="stock.stock_location_stock"/>
<field name="operations" model="mrp.repair.line" eval="[(5, 0, 0), (0, 0, {
<field name="operations" model="repair.line" eval="[(5, 0, 0), (0, 0, {
'location_dest_id': obj().env.ref('stock.location_production').id,
'location_id': obj().env.ref('stock.stock_location_stock').id,
'name': '[M-Wir] Mouse, Wireless',
@@ -50,7 +50,7 @@
'state': 'draft',
'type': 'add',
})]"/>
<field name="fees_lines" model="mrp.repair.fee" eval="[(5, 0, 0), (0, 0, {
<field name="fees_lines" model="repair.fee" eval="[(5, 0, 0), (0, 0, {
'name': 'Monitor screen repair',
'product_id': obj().env.ref('product.product_product_5c').id,
'product_uom_qty': 1.0,
@@ -60,7 +60,7 @@
<field name="partner_id" ref="base.res_partner_12"/>
</record>
<record id="mrp_repair_rmrp2" model="mrp.repair">
<record id="repair_r2" model="repair.order">
<field name="product_id" ref="product.product_product_6"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="address_id" ref="base.res_partner_address_1"/>
@@ -69,7 +69,7 @@
<field name="partner_invoice_id" ref="base.res_partner_address_1"/>
<field name="location_dest_id" ref="stock.stock_location_stock"/>
<field name="location_id" ref="stock.stock_location_14"/>
<field name="operations" model="mrp.repair.line" eval="[(5, 0, 0), (0, 0, {
<field name="operations" model="repair.line" eval="[(5, 0, 0), (0, 0, {
'location_dest_id': obj().env.ref('stock.location_production').id,
'location_id': obj().env.ref('stock.stock_location_stock').id,
'name': '[RAM-SR5] RAM DDR SR5',
@@ -80,7 +80,7 @@
'state': 'draft',
'type': 'add',
})]"/>
<field name="fees_lines" model="mrp.repair.fee" eval="[(5, 0, 0), (0, 0, {
<field name="fees_lines" model="repair.fee" eval="[(5, 0, 0), (0, 0, {
'name': 'SIM card holder repair',
'product_id': obj().env.ref('product.product_product_6c').id,
'product_uom_qty': 1.0,
+1 -1
View File
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import mrp_repair
from . import repair
from . import stock_traceability
+14 -14
View File
@@ -12,11 +12,11 @@ from odoo.tools import float_compare
class StockMove(models.Model):
_inherit = 'stock.move'
repair_id = fields.Many2one('mrp.repair')
repair_id = fields.Many2one('repair.order')
class Repair(models.Model):
_name = 'mrp.repair'
_name = 'repair.order'
_description = 'Repair Order'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'create_date desc'
@@ -30,7 +30,7 @@ class Repair(models.Model):
name = fields.Char(
'Repair Reference',
default=lambda self: self.env['ir.sequence'].next_by_code('mrp.repair'),
default=lambda self: self.env['ir.sequence'].next_by_code('repair.order'),
copy=False, required=True,
states={'confirmed': [('readonly', True)]})
product_id = fields.Many2one(
@@ -83,7 +83,7 @@ class Repair(models.Model):
help="Products repaired are all belonging to this lot", oldname="prodlot_id")
guarantee_limit = fields.Date('Warranty Expiration', states={'confirmed': [('readonly', True)]})
operations = fields.One2many(
'mrp.repair.line', 'repair_id', 'Parts',
'repair.line', 'repair_id', 'Parts',
copy=True, readonly=True, states={'draft': [('readonly', False)]})
pricelist_id = fields.Many2one(
'product.pricelist', 'Pricelist',
@@ -105,13 +105,13 @@ class Repair(models.Model):
copy=False, readonly=True, track_visibility="onchange",
help="Move created by the repair order")
fees_lines = fields.One2many(
'mrp.repair.fee', 'repair_id', 'Operations',
'repair.fee', 'repair_id', 'Operations',
copy=True, readonly=True, states={'draft': [('readonly', False)]})
internal_notes = fields.Text('Internal Notes')
quotation_notes = fields.Text('Quotation Notes')
company_id = fields.Many2one(
'res.company', 'Company',
default=lambda self: self.env['res.company']._company_default_get('mrp.repair'))
default=lambda self: self.env['res.company']._company_default_get('repair.order'))
invoiced = fields.Boolean('Invoiced', copy=False, readonly=True)
repaired = fields.Boolean('Repaired', copy=False, readonly=True)
amount_untaxed = fields.Float('Untaxed Amount', compute='_amount_untaxed', store=True)
@@ -216,7 +216,7 @@ class Repair(models.Model):
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.warn.insufficient.qty.repair',
'view_id': self.env.ref('mrp_repair.stock_warn_insufficient_qty_repair_form_view').id,
'view_id': self.env.ref('repair.stock_warn_insufficient_qty_repair_form_view').id,
'type': 'ir.actions.act_window',
'context': {
'default_product_id': self.product_id.id,
@@ -255,9 +255,9 @@ class Repair(models.Model):
@api.multi
def action_send_mail(self):
self.ensure_one()
template_id = self.env.ref('mrp_repair.mail_template_mrp_repair_quotation').id
template_id = self.env.ref('repair.mail_template_repair_quotation').id
ctx = {
'default_model': 'mrp.repair',
'default_model': 'repair.order',
'default_res_id': self.id,
'default_use_template': bool(template_id),
'default_template_id': template_id,
@@ -274,7 +274,7 @@ class Repair(models.Model):
@api.multi
def print_repair_order(self):
return self.env.ref('mrp_repair.action_report_mrp_repair_order').report_action(self)
return self.env.ref('repair.action_report_repair_order').report_action(self)
def action_repair_invoice_create(self):
for repair in self:
@@ -491,12 +491,12 @@ class Repair(models.Model):
class RepairLine(models.Model):
_name = 'mrp.repair.line'
_name = 'repair.line'
_description = 'Repair Line'
name = fields.Char('Description', required=True)
repair_id = fields.Many2one(
'mrp.repair', 'Repair Order Reference',
'repair.order', 'Repair Order Reference',
index=True, ondelete='cascade')
type = fields.Selection([
('add', 'Add'),
@@ -605,11 +605,11 @@ class RepairLine(models.Model):
class RepairFee(models.Model):
_name = 'mrp.repair.fee'
_name = 'repair.fee'
_description = 'Repair Fees Line'
repair_id = fields.Many2one(
'mrp.repair', 'Repair Order Reference',
'repair.order', 'Repair Order Reference',
index=True, ondelete='cascade', required=True)
name = fields.Char('Description', index=True, required=True)
product_id = fields.Many2one('product.product', 'Product')
+1 -1
View File
@@ -7,7 +7,7 @@ class MrpStockReport(models.TransientModel):
def get_links(self, move_line):
res_model, res_id, ref = super(MrpStockReport, self).get_links(move_line)
if move_line.move_id.repair_id:
res_model = 'mrp.repair'
res_model = 'repair.order'
res_id = move_line.move_id.repair_id.id
ref = move_line.move_id.repair_id.name
return res_model, res_id, ref
+4 -4
View File
@@ -3,10 +3,10 @@
<data>
<report
string="Quotation / Order"
id="action_report_mrp_repair_order"
model="mrp.repair"
name="mrp_repair.report_mrprepairorder2"
file="mrp_repair.report_mrprepairorder"
id="action_report_repair_order"
model="repair.order"
name="repair.report_repairorder2"
file="repair.report_repairorder"
report_type="qweb-pdf"
print_report_name="(
object.state == 'draft' and 'Repair Quotation - %s' % (object.name) or
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="report_mrprepairorder">
<template id="report_repairorder">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang': o.partner_id.lang})" />
@@ -158,10 +158,10 @@
</t>
</template>
<template id="report_mrprepairorder2">
<template id="report_repairorder2">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="mrp_repair.report_mrprepairorder" t-lang="doc.partner_id.lang"/>
<t t-call="repair.report_repairorder" t-lang="doc.partner_id.lang"/>
</t>
</t>
</template>
+8 -8
View File
@@ -1,18 +1,18 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_mrp_repair_fee_user,MRP Repair Fee user,model_mrp_repair_fee,stock.group_stock_user,1,1,1,1
access_mrp_repair_fee_manager,MRP Repair Fee manager,model_mrp_repair_fee,stock.group_stock_manager,1,0,0,0
access_mrp_repair_user,MRP Repair user,model_mrp_repair,stock.group_stock_user,1,1,1,1
access_mrp_repair_manager,MRP Repair manager,model_mrp_repair,stock.group_stock_manager,1,0,0,0
access_repair_fee_user,Repair Fee user,model_repair_fee,stock.group_stock_user,1,1,1,1
access_repair_fee_manager,Repair Fee manager,model_repair_fee,stock.group_stock_manager,1,0,0,0
access_repair_user,Repair user,model_repair_order,stock.group_stock_user,1,1,1,1
access_repair_manager,Repair manager,model_repair_order,stock.group_stock_manager,1,0,0,0
access_product_pricelist_manager,product.pricelist manager,product.model_product_pricelist,stock.group_stock_manager,1,0,0,0
access_product_pricelist_user,product.pricelist user,product.model_product_pricelist,stock.group_stock_user,1,1,1,1
access_stock_production_lot_user,stock.production.lot user,stock.model_stock_production_lot,stock.group_stock_user,1,1,1,1
access_stock_production_lot_manager,stock.production.lot manager,stock.model_stock_production_lot,stock.group_stock_manager,1,0,0,0
access_mrp_repair_line_user,mrp.repair.line user,model_mrp_repair_line,stock.group_stock_user,1,1,1,1
access_mrp_repair_line_manager,mrp.repair.line manager,model_mrp_repair_line,stock.group_stock_manager,1,0,0,0
access_repair_line_user,repair.line user,model_repair_line,stock.group_stock_user,1,1,1,1
access_repair_line_manager,repair.line manager,model_repair_line,stock.group_stock_manager,1,0,0,0
access_account_tax_user,account.tax,account.model_account_tax,stock.group_stock_user,1,1,1,1
access_account_tax_manager,account.tax manager,account.model_account_tax,stock.group_stock_manager,1,0,0,0
access_mrp_repair_fee_user_mrp,MRP Repair Fee user mrp,model_mrp_repair_fee,stock.group_stock_user,1,1,1,1
access_mrp_repair_fee_mgr,MRP Repair Fee mgr,model_mrp_repair_fee,stock.group_stock_manager,1,0,0,0
access_repair_fee_user_mrp,Repair Fee user mrp,model_repair_fee,stock.group_stock_user,1,1,1,1
access_repair_fee_mgr,Repair Fee mgr,model_repair_fee,stock.group_stock_manager,1,0,0,0
access_account_invoice_user,account.invoice,account.model_account_invoice,stock.group_stock_user,1,1,1,1
access_account_invoice_manager,account.invoice manager,account.model_account_invoice,stock.group_stock_manager,1,0,0,0
access_account_invoice_line_user,account.invoice.line,account.model_account_invoice_line,stock.group_stock_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mrp_repair_fee_user access_repair_fee_user MRP Repair Fee user Repair Fee user model_mrp_repair_fee model_repair_fee stock.group_stock_user 1 1 1 1
3 access_mrp_repair_fee_manager access_repair_fee_manager MRP Repair Fee manager Repair Fee manager model_mrp_repair_fee model_repair_fee stock.group_stock_manager 1 0 0 0
4 access_mrp_repair_user access_repair_user MRP Repair user Repair user model_mrp_repair model_repair_order stock.group_stock_user 1 1 1 1
5 access_mrp_repair_manager access_repair_manager MRP Repair manager Repair manager model_mrp_repair model_repair_order stock.group_stock_manager 1 0 0 0
6 access_product_pricelist_manager product.pricelist manager product.model_product_pricelist stock.group_stock_manager 1 0 0 0
7 access_product_pricelist_user product.pricelist user product.model_product_pricelist stock.group_stock_user 1 1 1 1
8 access_stock_production_lot_user stock.production.lot user stock.model_stock_production_lot stock.group_stock_user 1 1 1 1
9 access_stock_production_lot_manager stock.production.lot manager stock.model_stock_production_lot stock.group_stock_manager 1 0 0 0
10 access_mrp_repair_line_user access_repair_line_user mrp.repair.line user repair.line user model_mrp_repair_line model_repair_line stock.group_stock_user 1 1 1 1
11 access_mrp_repair_line_manager access_repair_line_manager mrp.repair.line manager repair.line manager model_mrp_repair_line model_repair_line stock.group_stock_manager 1 0 0 0
12 access_account_tax_user account.tax account.model_account_tax stock.group_stock_user 1 1 1 1
13 access_account_tax_manager account.tax manager account.model_account_tax stock.group_stock_manager 1 0 0 0
14 access_mrp_repair_fee_user_mrp access_repair_fee_user_mrp MRP Repair Fee user mrp Repair Fee user mrp model_mrp_repair_fee model_repair_fee stock.group_stock_user 1 1 1 1
15 access_mrp_repair_fee_mgr access_repair_fee_mgr MRP Repair Fee mgr Repair Fee mgr model_mrp_repair_fee model_repair_fee stock.group_stock_manager 1 0 0 0
16 access_account_invoice_user account.invoice account.model_account_invoice stock.group_stock_user 1 1 1 1
17 access_account_invoice_manager account.invoice manager account.model_account_invoice stock.group_stock_manager 1 0 0 0
18 access_account_invoice_line_user account.invoice.line account.model_account_invoice_line stock.group_stock_user 1 1 1 1
+3 -3
View File
@@ -3,9 +3,9 @@
<data noupdate="1">
<!-- Multi -->
<record model="ir.rule" id="mrp_repair_rule">
<field name="name">mrp_repair multi-company</field>
<field name="model_id" search="[('model','=','mrp.repair')]" model="ir.model"/>
<record model="ir.rule" id="repair_rule">
<field name="name">repair multi-company</field>
<field name="model_id" search="[('model','=','repair.order')]" model="ir.model"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
</record>
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_mrp_repair
from . import test_repair
+46 -46
View File
@@ -4,115 +4,115 @@
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
class TestMrpRepair(AccountingTestCase):
class TestRepair(AccountingTestCase):
def setUp(self):
super(TestMrpRepair, self).setUp()
super(TestRepair, self).setUp()
self.MrpRepair = self.env['mrp.repair']
self.Repair = self.env['repair.order']
self.ResUsers = self.env['res.users']
self.MrpRepairMakeInvoice = self.env['mrp.repair.make_invoice']
self.RepairMakeInvoice = self.env['repair.order.make_invoice']
self.res_group_user = self.env.ref('stock.group_stock_user')
self.res_group_manager = self.env.ref('stock.group_stock_manager')
self.mrp_repair_rmrp0 = self.env.ref('mrp_repair.mrp_repair_rmrp0')
self.mrp_repair_rmrp1 = self.env.ref('mrp_repair.mrp_repair_rmrp1')
self.mrp_repair_rmrp2 = self.env.ref('mrp_repair.mrp_repair_rmrp2')
self.repair_r0 = self.env.ref('repair.repair_r0')
self.repair_r1 = self.env.ref('repair.repair_r1')
self.repair_r2 = self.env.ref('repair.repair_r2')
self.res_mrp_repair_user = self.ResUsers.create({
'name': 'MRP User',
self.res_repair_user = self.ResUsers.create({
'name': 'Repair User',
'login': 'maru',
'password': 'maru',
'email': 'mrp_repair_user@yourcompany.com',
'email': 'repair_user@yourcompany.com',
'groups_id': [(6, 0, [self.res_group_user.id])]})
self.res_mrp_repair_manager = self.ResUsers.create({
'name': 'MRP Manager',
self.res_repair_manager = self.ResUsers.create({
'name': 'Repair Manager',
'login': 'marm',
'password': 'marm',
'email': 'mrp_repair_manager@yourcompany.com',
'email': 'repair_manager@yourcompany.com',
'groups_id': [(6, 0, [self.res_group_manager.id])]})
def test_00_mrp_repair_afterinv(self):
def test_00_repair_afterinv(self):
# I confirm Repair order taking Invoice Method 'After Repair'.
self.mrp_repair_rmrp0.sudo(self.res_mrp_repair_user.id).action_repair_confirm()
self.repair_r0.sudo(self.res_repair_user.id).action_repair_confirm()
# I check the state is in "Confirmed".
self.assertEqual(self.mrp_repair_rmrp0.state, "confirmed", 'Mrp repair order should be in "Confirmed" state.')
self.mrp_repair_rmrp0.action_repair_start()
self.assertEqual(self.repair_r0.state, "confirmed", 'Repair order should be in "Confirmed" state.')
self.repair_r0.action_repair_start()
# I check the state is in "Under Repair".
self.assertEqual(self.mrp_repair_rmrp0.state, "under_repair", 'Mrp repair order should be in "Under_repair" state.')
self.assertEqual(self.repair_r0.state, "under_repair", 'Repair order should be in "Under_repair" state.')
# Repairing process for product is in Done state and I end Repair process by clicking on "End Repair" button.
self.mrp_repair_rmrp0.action_repair_end()
self.repair_r0.action_repair_end()
# I define Invoice Method 'After Repair' option in this Repair order.so I create invoice by clicking on "Make Invoice" wizard.
mrp_make_invoice = self.MrpRepairMakeInvoice.create({
make_invoice = self.RepairMakeInvoice.create({
'group': True})
# I click on "Create Invoice" button of this wizard to make invoice.
context = {
"active_model": 'mrp_repair',
"active_ids": [self.mrp_repair_rmrp0.id],
"active_id": self.mrp_repair_rmrp0.id
"active_model": 'repair_order',
"active_ids": [self.repair_r0.id],
"active_id": self.repair_r0.id
}
mrp_make_invoice.with_context(context).make_invoices()
make_invoice.with_context(context).make_invoices()
# I check that invoice is created for this Repair order.
self.assertEqual(len(self.mrp_repair_rmrp0.invoice_id), 1, "No invoice exists for this repair order")
self.assertEqual(len(self.mrp_repair_rmrp0.move_id.move_line_ids[0].consume_line_ids), 1, "Consume lines should be set")
self.assertEqual(len(self.repair_r0.invoice_id), 1, "No invoice exists for this repair order")
self.assertEqual(len(self.repair_r0.move_id.move_line_ids[0].consume_line_ids), 1, "Consume lines should be set")
def test_01_mrp_repair_b4inv(self):
def test_01_epair_b4inv(self):
# I confirm Repair order for Invoice Method 'Before Repair'.
self.mrp_repair_rmrp2.sudo(self.res_mrp_repair_user.id).action_repair_confirm()
self.repair_r2.sudo(self.res_repair_user.id).action_repair_confirm()
# I click on "Create Invoice" button of this wizard to make invoice.
self.mrp_repair_rmrp2.action_repair_invoice_create()
self.repair_r2.action_repair_invoice_create()
# I check that invoice is created for this Repair order.
self.assertEqual(len(self.mrp_repair_rmrp2.invoice_id), 1, "No invoice exists for this repair order")
self.assertEqual(len(self.repair_r2.invoice_id), 1, "No invoice exists for this repair order")
# I start the Repairing process by clicking on "Start Repair" button.
self.mrp_repair_rmrp2.action_repair_start()
self.repair_r2.action_repair_start()
# Repairing process for this product is in Done state and I end this process by clicking on "End Repair" button for Invoice Method 'Before Repair'.
self.mrp_repair_rmrp2.action_repair_end()
self.repair_r2.action_repair_end()
def test_02_mrp_repair_noneinv(self):
def test_02_repair_noneinv(self):
# I confirm Repair order for Invoice Method 'No Invoice'.
self.mrp_repair_rmrp1.sudo(self.res_mrp_repair_user.id).action_repair_confirm()
self.repair_r1.sudo(self.res_repair_user.id).action_repair_confirm()
# I start the repairing process by clicking on "Start Repair" button for Invoice Method 'No Invoice'.
self.mrp_repair_rmrp1.action_repair_start()
self.repair_r1.action_repair_start()
# I check its state which is in "Under Repair".
self.assertEqual(self.mrp_repair_rmrp1.state, "under_repair", 'Mrp repair order should be in "Under_repair" state.')
self.assertEqual(self.repair_r1.state, "under_repair", 'Repair order should be in "Under_repair" state.')
# Repairing process for product is in Done state and I end this process by clicking on "End Repair" button.
self.mrp_repair_rmrp1.action_repair_end()
self.repair_r1.action_repair_end()
# I define Invoice Method 'No Invoice' option in this repair order.
# So, I check that Invoice has not been created for this repair order.
self.assertNotEqual(len(self.mrp_repair_rmrp1.invoice_id), 1, "Invoice should not exist for this repair order")
self.assertNotEqual(len(self.repair_r1.invoice_id), 1, "Invoice should not exist for this repair order")
def test_03_mrp_repair_fee(self):
# I check the total amount of mrp_repair_rmrp1 is 100
self.assertEqual(self.mrp_repair_rmrp1.amount_total, 100, "Amount_total should be 100")
def test_03_repair_fee(self):
# I check the total amount of repair_r1 is 100
self.assertEqual(self.repair_r1.amount_total, 100, "Amount_total should be 100")
# I add a new fee line
product_assembly = self.env.ref('product.product_product_5')
product_uom_hour = self.env.ref('product.product_uom_hour')
self.MrpRepairFee = self.env['mrp.repair.fee']
self.RepairFee = self.env['repair.fee']
self.MrpRepairFee.create({
self.RepairFee.create({
'name': 'PC Assemble + Custom (PC on Demand)',
'product_id': product_assembly.id,
'product_uom_qty': 1.0,
'product_uom': product_uom_hour.id,
'price_unit': 12.0,
'repair_id': self.mrp_repair_rmrp1.id})
# I check the total amount of mrp_repair_rmrp1 is now 112
self.assertEqual(self.mrp_repair_rmrp1.amount_total, 112, "Amount_total should be 100")
'repair_id': self.repair_r1.id})
# I check the total amount of repair_r1 is now 112
self.assertEqual(self.repair_r1.amount_total, 112, "Amount_total should be 100")
+11 -11
View File
@@ -3,8 +3,8 @@
<data>
<record id="view_repair_order_tree" model="ir.ui.view">
<field name="name">mrp.repair.tree</field>
<field name="model">mrp.repair</field>
<field name="name">repair.tree</field>
<field name="model">repair.order</field>
<field name="arch" type="xml">
<tree string="Repairs order" decoration-muted="state in ('done','cancel')" decoration-info="state=='draft'">
<field name="name" />
@@ -19,8 +19,8 @@
</record>
<record id="view_repair_order_form" model="ir.ui.view">
<field name="name">mrp.repair.form</field>
<field name="model">mrp.repair</field>
<field name="name">repair.form</field>
<field name="model">repair.order</field>
<field name="arch" type="xml">
<form string="Repair Order">
<header>
@@ -187,9 +187,9 @@
</record>
<record id="view_mrp_repair_kanban" model="ir.ui.view">
<field name="name">mrp.repair.kanban</field>
<field name="model">mrp.repair</field>
<record id="view_repair_kanban" model="ir.ui.view">
<field name="name">repair.kanban</field>
<field name="model">repair.order</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="name" />
@@ -227,8 +227,8 @@
</record>
<record id="view_repair_order_form_filter" model="ir.ui.view">
<field name="name">mrp.repair.select</field>
<field name="model">mrp.repair</field>
<field name="name">repair.select</field>
<field name="model">repair.order</field>
<field name="arch" type="xml">
<search string="Search Repair Orders">
<field name="name" string="Repair Orders"/>
@@ -268,7 +268,7 @@
<record id="action_repair_order_tree" model="ir.actions.act_window">
<field name="name">Repair Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.repair</field>
<field name="res_model">repair.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form</field>
<field name="search_view_id" ref="view_repair_order_form_filter"/>
@@ -288,7 +288,7 @@
</record>
<menuitem action="action_repair_order_tree" id="menu_repair_order" groups="stock.group_stock_user" name="Repairs" sequence="36"
web_icon="mrp_repair,static/description/icon.png"/>
web_icon="repair,static/description/icon.png"/>
</data>
</odoo>
+2 -2
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import mrp_repair_cancel
from . import mrp_repair_make_invoice
from . import repair_cancel
from . import repair_make_invoice
from . import stock_warn_insufficient_qty
+4 -4
View File
@@ -6,14 +6,14 @@ from odoo.exceptions import UserError
class RepairCancel(models.TransientModel):
_name = 'mrp.repair.cancel'
_name = 'repair.cancel'
_description = 'Cancel Repair'
@api.multi
def cancel_repair(self):
if not self._context.get('active_id'):
return {'type': 'ir.actions.act_window_close'}
repair = self.env['mrp.repair'].browse(self._context['active_id'])
repair = self.env['repair.order'].browse(self._context['active_id'])
if repair.invoiced or repair.invoice_method == 'none':
repair.action_cancel()
else:
@@ -24,10 +24,10 @@ class RepairCancel(models.TransientModel):
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
res = super(RepairCancel, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar,submenu=submenu)
repair_id = self._context.get('active_id')
if not repair_id or self._context.get('active_model') != 'mrp.repair':
if not repair_id or self._context.get('active_model') != 'repair.order':
return res
repair = self.env['mrp.repair'].browse(repair_id)
repair = self.env['repair.order'].browse(repair_id)
if not repair.invoiced:
res['arch'] = """
<form string="Cancel Repair">
+2 -2
View File
@@ -6,7 +6,7 @@
<record id="view_cancel_repair" model="ir.ui.view">
<field name="name">Cancel Repair</field>
<field name="model">mrp.repair.cancel</field>
<field name="model">repair.cancel</field>
<field name="arch" type="xml">
<form string="Cancel Repair Order">
<group>
@@ -23,7 +23,7 @@
<record id="action_cancel_repair" model="ir.actions.act_window">
<field name="name">Cancel Repair Order</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.repair.cancel</field>
<field name="res_model">repair.cancel</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
+2 -2
View File
@@ -5,7 +5,7 @@ from odoo import api, fields, models
class MakeInvoice(models.TransientModel):
_name = 'mrp.repair.make_invoice'
_name = 'repair.order.make_invoice'
_description = 'Make Invoice'
group = fields.Boolean('Group by partner invoice address')
@@ -16,7 +16,7 @@ class MakeInvoice(models.TransientModel):
return {'type': 'ir.actions.act_window_close'}
new_invoice = {}
for wizard in self:
repairs = self.env['mrp.repair'].browse(self._context['active_ids'])
repairs = self.env['repair.order'].browse(self._context['active_ids'])
new_invoice = repairs.action_invoice_create(group=wizard.group)
# We have to udpate the state of the given repairs, otherwise they remain 'to be invoiced'.
@@ -6,7 +6,7 @@
<record id="view_make_invoice" model="ir.ui.view">
<field name="name">Make Invoice</field>
<field name="model">mrp.repair.make_invoice</field>
<field name="model">repair.order.make_invoice</field>
<field name="arch" type="xml">
<form string="Create invoices">
<group string="Do you really want to create the invoice(s)?">
@@ -21,12 +21,12 @@
</record>
<act_window name="Create Invoice"
res_model="mrp.repair.make_invoice"
src_model="mrp.repair"
res_model="repair.order.make_invoice"
src_model="repair.order"
view_mode="form"
target="new"
key2="client_action_multi"
id="act_mrp_repair_invoice"
id="act_repair_invoice"
multi="True"/>
</data>
@@ -7,7 +7,7 @@ class StockWarnInsufficientQtyRepair(models.TransientModel):
_name = 'stock.warn.insufficient.qty.repair'
_inherit = 'stock.warn.insufficient.qty'
repair_id = fields.Many2one('mrp.repair', string='Repair')
repair_id = fields.Many2one('repair.order', string='Repair')
def action_done(self):
self.ensure_one()
@@ -42,7 +42,7 @@
<a t-att-data-active-id="l.res_id" t-att-data-res-model="l.res_model" class="o_stock_reports_web_action"><t t-raw="c" /></a>
</span>
</t>
<t t-if="l.res_model == 'mrp.repair' and l.reference == c">
<t t-if="l.res_model == 'repair.order' and l.reference == c">
<span t-if="c">
<a t-att-data-active-id="l.res_id" t-att-data-res-model="l.res_model" class="o_stock_reports_web_action"><t t-raw="c" /></a>
</span>