mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[ADD] new module crm_rma_advance_warranty
This commit is contained in:
71
crm_rma_advance_warranty/README.rst
Executable file
71
crm_rma_advance_warranty/README.rst
Executable file
@@ -0,0 +1,71 @@
|
||||
.. 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
|
||||
|
||||
========================
|
||||
CRM RMA Advance Warranty
|
||||
========================
|
||||
|
||||
This module makes improvements for warranty return address and warranty limit calculations method from **CRM Claim RMA** module using stored supplier information
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To install this module, you need to select it from available modules
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
No configuration is needed by this module
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
This module will compute return address and warranty limit automatically when
|
||||
adding/editing claim 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/145/8.0
|
||||
|
||||
For further information, please visit:
|
||||
|
||||
* https://www.odoo.com/forum/help-1
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
No issues are known yet
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/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 <https://github.com/OCA/rma/issues/new?body=module:%20crm_rma_advance_warranty%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Yanina Aular <yanina.aular@vauxoo.com>
|
||||
* Osval Reyes <osval@vauxoo.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 http://odoo-community.org.
|
||||
22
crm_rma_advance_warranty/__init__.py
Normal file
22
crm_rma_advance_warranty/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright 2015 Vauxoo
|
||||
# Author: Osval Reyes, Yanina Aular
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import models
|
||||
34
crm_rma_advance_warranty/__openerp__.py
Normal file
34
crm_rma_advance_warranty/__openerp__.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright 2015 Vauxoo
|
||||
# Author: Osval Reyes, Yanina Aular
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'CRM RMA Advance Warranty',
|
||||
'version': '8.0.1.0.0',
|
||||
'author': 'Vauxoo,Odoo Community Association (OCA)',
|
||||
'website': 'http://www.vauxoo.com/',
|
||||
'license': 'AGPL-3',
|
||||
'category': 'Generic Modules/CRM & SRM',
|
||||
'depends': [
|
||||
'crm_claim_rma',
|
||||
'crm_claim_product_supplier',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
40
crm_rma_advance_warranty/i18n/crm_rma_advance_warranty.pot
Normal file
40
crm_rma_advance_warranty/i18n/crm_rma_advance_warranty.pot
Normal file
@@ -0,0 +1,40 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * crm_rma_advance_warranty
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-21 03:06+0000\n"
|
||||
"PO-Revision-Date: 2015-07-21 03:06+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: code:addons/crm_rma_advance_warranty/models/claim_line.py:41
|
||||
#, python-format
|
||||
msgid "Cannot find any date for invoice. Must be a validated invoice."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: code:addons/crm_rma_advance_warranty/models/claim_line.py:40
|
||||
#: code:addons/crm_rma_advance_warranty/models/claim_line.py:57
|
||||
#, python-format
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: model:ir.model,name:crm_rma_advance_warranty.model_claim_line
|
||||
msgid "List of product to return"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: code:addons/crm_rma_advance_warranty/models/claim_line.py:58
|
||||
#, python-format
|
||||
msgid "The product has no supplier configured for %s."
|
||||
msgstr ""
|
||||
40
crm_rma_advance_warranty/i18n/es.po
Normal file
40
crm_rma_advance_warranty/i18n/es.po
Normal file
@@ -0,0 +1,40 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * crm_rma_advance_warranty
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-21 03:06+0000\n"
|
||||
"PO-Revision-Date: 2015-07-21 03:06+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: code:addons/crm_rma_advance_warranty/model/crm_claim_rma.py:41
|
||||
#, python-format
|
||||
msgid "Cannot find any date for invoice. Must be a validated invoice."
|
||||
msgstr "No se puede encontrar ninguna fecha para la factura. Debe ser una factura validada."
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: code:addons/crm_rma_advance_warranty/model/crm_claim_rma.py:40
|
||||
#: code:addons/crm_rma_advance_warranty/model/crm_claim_rma.py:57
|
||||
#, python-format
|
||||
msgid "Error"
|
||||
msgstr "Error"
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: model:ir.model,name:crm_rma_advance_warranty.model_claim_line
|
||||
msgid "List of product to return"
|
||||
msgstr "Lista de productos a retornar"
|
||||
|
||||
#. module: crm_rma_advance_warranty
|
||||
#: code:addons/crm_rma_advance_warranty/model/crm_claim_rma.py:58
|
||||
#, python-format
|
||||
msgid "The product has no supplier configured for %s."
|
||||
msgstr "El producto no tiene un proveedor configurado para %s"
|
||||
16
crm_rma_advance_warranty/i18n/es_MX.po
Normal file
16
crm_rma_advance_warranty/i18n/es_MX.po
Normal file
@@ -0,0 +1,16 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * crm_rma_advance_warranty
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-17 19:38+0000\n"
|
||||
"PO-Revision-Date: 2015-07-17 19:38+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
16
crm_rma_advance_warranty/i18n/es_PA.po
Normal file
16
crm_rma_advance_warranty/i18n/es_PA.po
Normal file
@@ -0,0 +1,16 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * crm_rma_advance_warranty
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-17 19:38+0000\n"
|
||||
"PO-Revision-Date: 2015-07-17 19:38+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
16
crm_rma_advance_warranty/i18n/es_VE.po
Normal file
16
crm_rma_advance_warranty/i18n/es_VE.po
Normal file
@@ -0,0 +1,16 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * crm_rma_advance_warranty
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-17 19:38+0000\n"
|
||||
"PO-Revision-Date: 2015-07-17 19:38+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
22
crm_rma_advance_warranty/models/__init__.py
Normal file
22
crm_rma_advance_warranty/models/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright 2015 Vauxoo
|
||||
# Author: Osval Reyes, Yanina Aular
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import claim_line
|
||||
119
crm_rma_advance_warranty/models/claim_line.py
Normal file
119
crm_rma_advance_warranty/models/claim_line.py
Normal file
@@ -0,0 +1,119 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright 2015 Vauxoo
|
||||
# Author: Osval Reyes, Yanina Aular
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import _, api, exceptions, models
|
||||
from datetime import datetime
|
||||
from openerp.tools import (DEFAULT_SERVER_DATE_FORMAT,
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
|
||||
|
||||
class ClaimLine(models.Model):
|
||||
|
||||
_inherit = 'claim.line'
|
||||
|
||||
@api.model
|
||||
def set_warranty_limit(self):
|
||||
"""
|
||||
Calculate warranty limit
|
||||
"""
|
||||
if not self.invoice_date:
|
||||
raise exceptions.Warning(
|
||||
_('Error'),
|
||||
_('Cannot find any date for invoice. '
|
||||
'Must be a validated invoice.'))
|
||||
warning = 'not_define'
|
||||
date_inv_at_server = datetime.strptime(self.invoice_date,
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
if self.warranty_type == 'supplier':
|
||||
if self.prodlot_id:
|
||||
supplier = self.prodlot_id.supplier_id
|
||||
if supplier not in self.product_id.mapped('seller_ids.name'):
|
||||
raise exceptions.Warning(
|
||||
_('Error'),
|
||||
_('The product has no supplier'
|
||||
' configured for %s.' % supplier.name))
|
||||
|
||||
psi_obj = self.env['product.supplierinfo']
|
||||
domain = [('name', '=', supplier.id),
|
||||
('product_tmpl_id', '=',
|
||||
self.product_id.product_tmpl_id.id)]
|
||||
seller = psi_obj.search(domain)
|
||||
|
||||
warranty_duration = seller.warranty_duration
|
||||
else:
|
||||
warranty_duration = self.product_id.warranty
|
||||
limit = self.warranty_limit(date_inv_at_server, warranty_duration)
|
||||
# If waranty period was defined
|
||||
if warranty_duration > 0:
|
||||
claim_date = datetime.strptime(self.claim_id.date,
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
if limit < claim_date:
|
||||
warning = 'expired'
|
||||
else:
|
||||
warning = 'valid'
|
||||
|
||||
self.write({
|
||||
'guarantee_limit': limit.strftime(DEFAULT_SERVER_DATE_FORMAT),
|
||||
'warning': warning
|
||||
})
|
||||
|
||||
@api.model
|
||||
def set_warranty_return_address(self):
|
||||
"""
|
||||
Set the partner to be used as return destination and
|
||||
the destination stock location of the line in case of Return.
|
||||
|
||||
We can have various case here:
|
||||
- company or other: return to company partner or
|
||||
crm_return_address_id if specified
|
||||
- supplier: return to the supplier address
|
||||
|
||||
"""
|
||||
return_address = None
|
||||
psi_obj = self.env['product.supplierinfo']
|
||||
supplier = self.prodlot_id.supplier_id if self.prodlot_id else False
|
||||
|
||||
if supplier and supplier in self.product_id.mapped('seller_ids.name'):
|
||||
domain = [('name', '=', supplier.id),
|
||||
('product_tmpl_id', '=',
|
||||
self.product_id.product_tmpl_id.id)]
|
||||
supplier = psi_obj.search(domain)
|
||||
return_address_id = \
|
||||
supplier.warranty_return_address.id
|
||||
return_type = \
|
||||
supplier.warranty_return_partner
|
||||
else:
|
||||
# when no supplier is configured, returns to the company
|
||||
company = self.claim_id.company_id
|
||||
return_address = (company.crm_return_address_id or
|
||||
company.partner_id)
|
||||
return_address_id = return_address.id
|
||||
return_type = 'company'
|
||||
|
||||
location_dest_id = self.get_destination_location(
|
||||
self.product_id,
|
||||
self.claim_id.warehouse_id).id
|
||||
|
||||
self.write({
|
||||
'warranty_return_partner': return_address_id,
|
||||
'warranty_type': return_type,
|
||||
'location_dest_id': location_dest_id
|
||||
})
|
||||
22
crm_rma_advance_warranty/tests/__init__.py
Executable file
22
crm_rma_advance_warranty/tests/__init__.py
Executable file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright 2015 Vauxoo
|
||||
# Author: Osval Reyes
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import test_crm_rma_advance_warranty
|
||||
105
crm_rma_advance_warranty/tests/test_crm_rma_advance_warranty.py
Normal file
105
crm_rma_advance_warranty/tests/test_crm_rma_advance_warranty.py
Normal file
@@ -0,0 +1,105 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright 2015 Vauxoo
|
||||
# Author: Osval Reyes,
|
||||
# Yanina Aular
|
||||
#
|
||||
# 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 versionself.
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestCrmRmaAdvanceWarranty(TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestCrmRmaAdvanceWarranty, self).setUp()
|
||||
self.claim = self.env['crm.claim']
|
||||
self.claim_line = self.env['claim.line']
|
||||
res_partner = self.env['res.partner']
|
||||
self.sale_order = self.env['sale.order']
|
||||
|
||||
self.claim_type = self.ref('crm_claim_type.crm_claim_type_customer')
|
||||
self.supplier_id = res_partner.browse(self.ref('base.res_partner_1'))
|
||||
|
||||
def get_customer_sale_order_and_invoice(self, set_supplier=False):
|
||||
sale_order_id = self.sale_order.browse(
|
||||
self.ref('sale.sale_order_7'))[0].copy()
|
||||
# remove first order line just to simplify things up
|
||||
sale_order_id.write({
|
||||
'order_line': [(3, sale_order_id.order_line[0].id)]
|
||||
})
|
||||
|
||||
if set_supplier:
|
||||
sale_order_id.write({
|
||||
'order_line': [(1, sale_order_id.order_line[0].id, {
|
||||
'supplier_id': self.supplier_id.id
|
||||
}), (1, sale_order_id.order_line[1].id, {
|
||||
'supplier_id': self.supplier_id.id
|
||||
}), (1, sale_order_id.order_line[2].id, {
|
||||
'supplier_id': self.supplier_id.id
|
||||
}), ]
|
||||
})
|
||||
|
||||
sale_order_id.action_button_confirm()
|
||||
sale_order_id.action_invoice_create()
|
||||
self.assertTrue(sale_order_id.invoice_ids)
|
||||
|
||||
invoice_id = sale_order_id.invoice_ids[0]
|
||||
invoice_id.signal_workflow('invoice_open')
|
||||
return invoice_id
|
||||
|
||||
def create_customer_claim(self, invoice_id):
|
||||
"""
|
||||
Create a customer claim with or without claim lines based
|
||||
on include_lines parameter
|
||||
"""
|
||||
customer_id = invoice_id.partner_id
|
||||
claim_id = self.claim.create({
|
||||
'name': 'Test Claim for %s' % (customer_id.name),
|
||||
'claim_type': self.claim_type,
|
||||
'partner_id': customer_id.id,
|
||||
'pick': True,
|
||||
'code': '/',
|
||||
'invoice_id': invoice_id.id,
|
||||
})
|
||||
claim_id.with_context(
|
||||
{'create_lines': True})._onchange_invoice_warehouse_type_date()
|
||||
return claim_id
|
||||
|
||||
def test_01_warranty_company_limit(self):
|
||||
invoice_id = self.get_customer_sale_order_and_invoice()
|
||||
claim_id = self.create_customer_claim(invoice_id)
|
||||
|
||||
# check if it has the same line count
|
||||
self.assertEquals(len(invoice_id.invoice_line),
|
||||
len(claim_id.claim_line_ids))
|
||||
|
||||
claim_id.claim_line_ids.set_warranty()
|
||||
|
||||
# check if warranty set is company for all of them
|
||||
wtypes = claim_id.mapped('claim_line_ids.warranty_type')
|
||||
|
||||
self.assertFalse([w for w in wtypes if w != 'company'])
|
||||
|
||||
for line_id in claim_id.claim_line_ids:
|
||||
# warranty return address values
|
||||
|
||||
self.assertTrue(line_id.warranty_return_partner
|
||||
and line_id.warranty_type
|
||||
and line_id.location_dest_id)
|
||||
# warranty limit values
|
||||
self.assertTrue(line_id.guarantee_limit
|
||||
and line_id.set_warranty_limit)
|
||||
Reference in New Issue
Block a user