diff --git a/product_warranty/__manifest__.py b/product_warranty/__manifest__.py
index b025a7a7..c9aa12b4 100644
--- a/product_warranty/__manifest__.py
+++ b/product_warranty/__manifest__.py
@@ -2,29 +2,21 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
- 'name': 'Product Warranty',
- 'version': '12.0.1.0.0',
- 'category': 'Generic Modules/Product',
- 'author': 'Akretion, Vauxoo, Odoo Community Association (OCA)',
- 'website': 'https://github.com/OCA/rma',
- 'license': 'AGPL-3',
- 'depends': [
- 'sale_management',
+ "name": "Product Warranty",
+ "version": "12.0.1.0.0",
+ "category": "Generic Modules/Product",
+ "author": "Akretion, Vauxoo, Odoo Community Association (OCA)",
+ "website": "https://github.com/OCA/rma",
+ "license": "AGPL-3",
+ "depends": ["sale_management",],
+ "data": [
+ "security/ir.model.access.csv",
+ "views/res_company.xml",
+ "views/product_warranty.xml",
+ "views/product_template.xml",
],
- 'data': [
- 'security/ir.model.access.csv',
- 'views/res_company.xml',
- 'views/product_warranty.xml',
- 'views/product_template.xml'
- ],
- 'demo': [
- 'demo/product_warranty.xml',
- 'demo/res_company.xml',
- ],
- 'images': ['images/product_warranty.png'],
- 'development_status': 'Production/Stable',
- 'maintainers': [
- 'osi-scampbell',
- 'max3903',
- ]
+ "demo": ["demo/product_warranty.xml", "demo/res_company.xml",],
+ "images": ["images/product_warranty.png"],
+ "development_status": "Production/Stable",
+ "maintainers": ["osi-scampbell", "max3903",],
}
diff --git a/product_warranty/demo/product_warranty.xml b/product_warranty/demo/product_warranty.xml
index dfd44456..db2d913b 100644
--- a/product_warranty/demo/product_warranty.xml
+++ b/product_warranty/demo/product_warranty.xml
@@ -1,6 +1,5 @@
-
+
-
Default Instruction
To return a product purchased through our
@@ -14,7 +13,6 @@
1
-
Provisional Instruction
Under the provisions of these Conditions of
@@ -29,53 +27,47 @@
entitled to charge the products or the costs of recovery.
-
-
+
5
-
-
+
other
-
+
8
-
-
+
+
5
1
-
-
+
supplier
12
-
-
+
+
5
1
-
-
+
5
-
-
+
supplier
10
-
-
+
supplier
6
-
diff --git a/product_warranty/demo/res_company.xml b/product_warranty/demo/res_company.xml
index d7382859..7ba9a9ae 100644
--- a/product_warranty/demo/res_company.xml
+++ b/product_warranty/demo/res_company.xml
@@ -1,8 +1,6 @@
-
+
-
-
+
-
diff --git a/product_warranty/models/__init__.py b/product_warranty/models/__init__.py
index 2f4c9e98..6dde5c17 100644
--- a/product_warranty/models/__init__.py
+++ b/product_warranty/models/__init__.py
@@ -1,8 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from . import (
- return_instruction,
- product_supplierinfo,
- res_company,
- product_template
-)
+from . import return_instruction, product_supplierinfo, res_company, product_template
diff --git a/product_warranty/models/product_supplierinfo.py b/product_warranty/models/product_supplierinfo.py
index 0dc7c547..97859386 100644
--- a/product_warranty/models/product_supplierinfo.py
+++ b/product_warranty/models/product_supplierinfo.py
@@ -12,10 +12,11 @@ class ProductSupplierInfo(models.Model):
@api.model
def _get_default_instructions(self):
""" Get selected lines to add to exchange """
- return self.env['return.instruction']\
- .search([('is_default', '=', True)], limit=1)
+ return self.env["return.instruction"].search(
+ [("is_default", "=", True)], limit=1
+ )
- @api.depends('warranty_return_partner')
+ @api.depends("warranty_return_partner")
def _compute_warranty_return_address(self):
""" Method to return the partner delivery address or if none, the
default address
@@ -23,47 +24,61 @@ class ProductSupplierInfo(models.Model):
for record in self:
return_partner = record.warranty_return_partner
partner_id = record.company_id.partner_id.id
- if return_partner and return_partner == 'supplier':
+ if return_partner and return_partner == "supplier":
partner_id = record.name.id
- elif return_partner and return_partner == 'company' and \
- record.company_id.crm_return_address_id:
+ elif (
+ return_partner
+ and return_partner == "company"
+ and record.company_id.crm_return_address_id
+ ):
partner_id = record.company_id.crm_return_address_id.id
- elif return_partner and return_partner == 'other' and \
- record.warranty_return_other_address:
+ elif (
+ return_partner
+ and return_partner == "other"
+ and record.warranty_return_other_address
+ ):
partner_id = record.warranty_return_other_address.id
record.warranty_return_address = partner_id
warranty_duration = fields.Float(
- 'Period',
+ "Period",
help="Warranty in month for this product/supplier relation. Only "
- "for company/supplier relation (purchase order) ; the "
- "customer/company relation (sale order) always use the "
- "product main warranty field.")
+ "for company/supplier relation (purchase order) ; the "
+ "customer/company relation (sale order) always use the "
+ "product main warranty field.",
+ )
warranty_return_partner = fields.Selection(
- [('company', 'Company'), ('supplier', 'Supplier'), ('other', 'Other')],
- string='Return type', required=True, default='company',
+ [("company", "Company"), ("supplier", "Supplier"), ("other", "Other")],
+ string="Return type",
+ required=True,
+ default="company",
help="Who is in charge of the warranty return treatment toward the "
- "end customer. Company will use the current company "
- "delivery or default address and so on for supplier and "
- "brand manufacturer. Doesn't necessarily mean that the "
- "warranty to be applied is the one of the return partner "
- "(ie: can be returned to the company and be under the "
- "brand warranty).")
+ "end customer. Company will use the current company "
+ "delivery or default address and so on for supplier and "
+ "brand manufacturer. Doesn't necessarily mean that the "
+ "warranty to be applied is the one of the return partner "
+ "(ie: can be returned to the company and be under the "
+ "brand warranty).",
+ )
return_instructions = fields.Many2one(
- 'return.instruction',
- 'Instructions',
+ "return.instruction",
+ "Instructions",
default=_get_default_instructions,
- help="Instructions for product return.")
+ help="Instructions for product return.",
+ )
active_supplier = fields.Boolean(
- help="Is this supplier still active, only for information.")
+ help="Is this supplier still active, only for information."
+ )
warranty_return_address = fields.Many2one(
- 'res.partner',
- compute='_compute_warranty_return_address',
+ "res.partner",
+ compute="_compute_warranty_return_address",
string="Return address",
help="Where the goods should be returned "
- "(computed field based on other infos.)")
+ "(computed field based on other infos.)",
+ )
warranty_return_other_address = fields.Many2one(
- 'res.partner',
- string='Return other address',
+ "res.partner",
+ string="Return other address",
help="Where the customer has to send back the product(s) "
- "if warranty return is set to 'other'.")
+ "if warranty return is set to 'other'.",
+ )
diff --git a/product_warranty/models/product_template.py b/product_warranty/models/product_template.py
index bc985aa2..c445c7c2 100644
--- a/product_warranty/models/product_template.py
+++ b/product_warranty/models/product_template.py
@@ -7,10 +7,15 @@ from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
- warranty = fields.Integer(string='Warranty Duration')
- warranty_type = fields.Selection([('day', 'Day(s)'),
- ('week', 'Week(s)'),
- ('month', 'Month(s)'),
- ('year', 'Year(s)')],
- string='Warranty Type',
- required=True, default='day')
+ warranty = fields.Integer(string="Warranty Duration")
+ warranty_type = fields.Selection(
+ [
+ ("day", "Day(s)"),
+ ("week", "Week(s)"),
+ ("month", "Month(s)"),
+ ("year", "Year(s)"),
+ ],
+ string="Warranty Type",
+ required=True,
+ default="day",
+ )
diff --git a/product_warranty/models/res_company.py b/product_warranty/models/res_company.py
index ec64c51a..8dee633b 100644
--- a/product_warranty/models/res_company.py
+++ b/product_warranty/models/res_company.py
@@ -9,8 +9,9 @@ class ResCompany(models.Model):
_inherit = "res.company"
crm_return_address_id = fields.Many2one(
- 'res.partner',
- string='Return address',
+ "res.partner",
+ string="Return address",
help="Default address where the customers has to send back the "
- "returned product. If empty, the address is the "
- "company address.")
+ "returned product. If empty, the address is the "
+ "company address.",
+ )
diff --git a/product_warranty/models/return_instruction.py b/product_warranty/models/return_instruction.py
index e9e1ca3a..db7ed798 100644
--- a/product_warranty/models/return_instruction.py
+++ b/product_warranty/models/return_instruction.py
@@ -10,12 +10,12 @@ class ReturnInstruction(models.Model):
_name = "return.instruction"
_description = "Instructions for product return"
- name = fields.Char('Title', required=True)
- instructions = fields.Text(
- 'Instructions',
- help="Instructions for product return.")
- is_default = fields.Boolean('Is default',
- help="If is default, will be use "
- "to set the default value in "
- "supplier info's. Be careful to "
- "have only one default.")
+ name = fields.Char("Title", required=True)
+ instructions = fields.Text("Instructions", help="Instructions for product return.")
+ is_default = fields.Boolean(
+ "Is default",
+ help="If is default, will be use "
+ "to set the default value in "
+ "supplier info's. Be careful to "
+ "have only one default.",
+ )
diff --git a/product_warranty/tests/test_product_warranty.py b/product_warranty/tests/test_product_warranty.py
index 7ddca775..3d6137a6 100644
--- a/product_warranty/tests/test_product_warranty.py
+++ b/product_warranty/tests/test_product_warranty.py
@@ -6,11 +6,10 @@ from odoo.tests.common import TransactionCase
class TestProductWarranty(TransactionCase):
-
def setUp(self):
super(TestProductWarranty, self).setUp()
- self.instruction_model = self.env['return.instruction']
- self.supplierinfo = self.env['product.supplierinfo']
+ self.instruction_model = self.env["return.instruction"]
+ self.supplierinfo = self.env["product.supplierinfo"]
self.create_product_supplierinfo()
def create_product_supplierinfo(self):
@@ -18,17 +17,17 @@ class TestProductWarranty(TransactionCase):
Create a record of product.supplier for next tests
"""
- product_tmpl_id = self.env.ref('product.product_product_3')
+ product_tmpl_id = self.env.ref("product.product_product_3")
- partner_id = self.env.ref('base.res_partner_4')
- other_partner = self.env.ref('base.res_partner_12')
+ partner_id = self.env.ref("base.res_partner_4")
+ other_partner = self.env.ref("base.res_partner_12")
supplierinfo_data = dict(
name=partner_id.id,
- product_name='Test SupplierInfo for display Default Instruction',
+ product_name="Test SupplierInfo for display Default Instruction",
min_qty=4,
delay=5,
- warranty_return_partner='supplier',
+ warranty_return_partner="supplier",
product_tmpl_id=product_tmpl_id.id,
warranty_return_other_address=other_partner.id,
)
@@ -43,11 +42,13 @@ class TestProductWarranty(TransactionCase):
product.supplierinfo is created
"""
- return_instructions_id = self.env.ref('product_warranty.'
- 'return_instruction_1')
+ return_instructions_id = self.env.ref(
+ "product_warranty." "return_instruction_1"
+ )
- self.assertEquals(self.supplierinfo_brw.return_instructions.id,
- return_instructions_id.id)
+ self.assertEquals(
+ self.supplierinfo_brw.return_instructions.id, return_instructions_id.id
+ )
def test_warranty_return_address(self):
"""
@@ -56,18 +57,21 @@ class TestProductWarranty(TransactionCase):
"""
self.create_product_supplierinfo()
- self.assertEquals(self.supplierinfo_brw.warranty_return_address.id,
- self.supplierinfo_brw.name.id)
+ self.assertEquals(
+ self.supplierinfo_brw.warranty_return_address.id,
+ self.supplierinfo_brw.name.id,
+ )
- self.supplierinfo_brw.write({'warranty_return_partner': 'company'})
-
- self.assertEquals(self.supplierinfo_brw.warranty_return_address.id,
- self.supplierinfo_brw.company_id.
- crm_return_address_id.id)
-
- self.supplierinfo_brw.write({'warranty_return_partner': 'other'})
+ self.supplierinfo_brw.write({"warranty_return_partner": "company"})
self.assertEquals(
self.supplierinfo_brw.warranty_return_address.id,
- self.supplierinfo_brw.warranty_return_other_address.id
+ self.supplierinfo_brw.company_id.crm_return_address_id.id,
+ )
+
+ self.supplierinfo_brw.write({"warranty_return_partner": "other"})
+
+ self.assertEquals(
+ self.supplierinfo_brw.warranty_return_address.id,
+ self.supplierinfo_brw.warranty_return_other_address.id,
)
diff --git a/product_warranty/views/product_template.xml b/product_warranty/views/product_template.xml
index 05a6839d..005dd868 100644
--- a/product_warranty/views/product_template.xml
+++ b/product_warranty/views/product_template.xml
@@ -1,24 +1,21 @@
-
+
-
product.template
-
+
-
+
-
-
+
+
-
+
-
diff --git a/product_warranty/views/product_warranty.xml b/product_warranty/views/product_warranty.xml
index 5b8afd2c..53474d94 100644
--- a/product_warranty/views/product_warranty.xml
+++ b/product_warranty/views/product_warranty.xml
@@ -1,19 +1,17 @@
-
+
-
product.return.instructions.tree
return.instruction
-
-
-
+
+
+
-
product.return.instructions.form
@@ -22,70 +20,70 @@
-
-
+
Products Return Instructions
return.instruction
form
tree,form
-
+
-
-
-
+
product.supplierinfo.warranty.tree
product.supplierinfo
-
+
-
-
-
-
-
+
+
+
+
+
-
product.supplierinfo.warranty.form
product.supplierinfo
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
diff --git a/product_warranty/views/res_company.xml b/product_warranty/views/res_company.xml
index 82153f9d..34bef43c 100644
--- a/product_warranty/views/res_company.xml
+++ b/product_warranty/views/res_company.xml
@@ -1,22 +1,22 @@
-
+
-
crm_claim_rma.company_form
res.company
-
+
-
-
+
+
-
+
-