crm_claim_rma: v9 migration

This commit is contained in:
Cyril Gaudin
2016-06-07 10:52:26 +02:00
parent 2b76897d21
commit c6f2d8da77
36 changed files with 771 additions and 1133 deletions

View File

@@ -56,8 +56,6 @@ 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_claim_rma%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
@@ -74,6 +72,7 @@ Contributors:
* Javier Carrasco <javier.carrasco@eezee-it.com>
* Yanina Aular <yanina.aular@vauxoo.com>
* Osval Reyes <osval@vauxoo.com>
* Cyril Gaudin <cyril.gaudin@camptocamp.com>
Maintainer
----------

View File

@@ -1,28 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2015 Eezee-It
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Joel Grand-Guillaume
# 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
from . import wizards

View File

@@ -1,32 +1,12 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2015 Eezee-It
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume,
# 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/>.
#
##############################################################################
# © 2015 Vauxoo
# © 2015 Eezee-It
# © 2009-2013 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'RMA Claim (Product Return Management)',
'version': '8.0.1.1.1',
'version': '9.0.1.0.0',
'category': 'Generic Modules/CRM & SRM',
'author': "Akretion, Camptocamp, Eezee-it, MONK Software, Vauxoo, "
"Odoo Community Association (OCA)",
@@ -45,8 +25,8 @@
],
'data': [
'data/ir_sequence_type.xml',
'data/crm_case_section.xml',
'data/crm_case_categ.xml',
'data/crm_team.xml',
'data/crm_claim_category.xml',
'views/account_invoice.xml',
'wizards/claim_make_picking.xml',
'views/crm_claim.xml',
@@ -55,15 +35,10 @@
'views/stock_view.xml',
'security/ir.model.access.csv',
],
'demo': [
'demo/account_invoice.xml',
'demo/account_invoice_line.xml',
'demo/crm_claim.xml',
'demo/claim_line.xml',
],
'demo': [],
'test': [
'test/test_invoice_refund.yml'
],
'installable': False,
'installable': True,
'auto_install': False,
}

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="categ_claim10" model="crm.case.categ">
<field name="name">No Inventory</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim11" model="crm.case.categ">
<field name="name">Customer Return</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim12" model="crm.case.categ">
<field name="name">Buyer Cancelled</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim13" model="crm.case.categ">
<field name="name">General Adjustement</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim14" model="crm.case.categ">
<field name="name">Could Not Ship</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim15" model="crm.case.categ">
<field name="name">Different Item</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim16" model="crm.case.categ">
<field name="name">Merchandise Not Received</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim17" model="crm.case.categ">
<field name="name">Merchandise Not As Described</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim18" model="crm.case.categ">
<field name="name">Pricing Error</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim19" model="crm.case.categ">
<field name="name">Shipping Address Undeliverable</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim20" model="crm.case.categ">
<field name="name">Delivered Late by Carrier</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record id="categ_claim21" model="crm.case.categ">
<field name="name">Missed Fulfilment Promise</field>
<field name="section_id" ref="section_after_sales_service"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
</data>
</openerp>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="section_after_sales_service" model="crm.case.section">
<field name="name">After Sales Service</field>
<field name="code">ASV</field>
<field name="parent_id" ref="sales_team.section_sales_department"/>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<record id="categ_claim10" model="crm.claim.category">
<field name="name">No Inventory</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim11" model="crm.claim.category">
<field name="name">Customer Return</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim12" model="crm.claim.category">
<field name="name">Buyer Cancelled</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim13" model="crm.claim.category">
<field name="name">General Adjustement</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim14" model="crm.claim.category">
<field name="name">Could Not Ship</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim15" model="crm.claim.category">
<field name="name">Different Item</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim16" model="crm.claim.category">
<field name="name">Merchandise Not Received</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim17" model="crm.claim.category">
<field name="name">Merchandise Not As Described</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim18" model="crm.claim.category">
<field name="name">Pricing Error</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim19" model="crm.claim.category">
<field name="name">Shipping Address Undeliverable</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim20" model="crm.claim.category">
<field name="name">Delivered Late by Carrier</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
<record id="categ_claim21" model="crm.claim.category">
<field name="name">Missed Fulfilment Promise</field>
<field name="team_id" ref="team_after_sales_service"/>
</record>
</odoo>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<record id="team_after_sales_service" model="crm.team">
<field name="name">After Sales Service</field>
<field name="code">ASV</field>
</record>
</odoo>

View File

@@ -1,16 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="seq_type_claim" model="ir.sequence.type">
<field name="name">CRM Claim</field>
<field name="code">crm.claim.rma</field>
</record>
<record id="seq_claim" model="ir.sequence">
<field name="name">CRM Claim</field>
<field name="code">crm.claim.rma</field>
<field eval="5" name="padding"/>
<field name="prefix">RMA-%(year)s/</field>
</record>
</data>
</openerp>
<odoo noupdate="1">
<record id="seq_claim" model="ir.sequence">
<field name="name">CRM Claim</field>
<field name="code">crm.claim.rma</field>
<field eval="5" name="padding"/>
<field name="prefix">RMA-%(year)s/</field>
</record>
</odoo>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<record id="crm_rma_invoice_001" model="account.invoice">
<field name="currency_id" ref="base.EUR"/>
<field name="company_id" ref="base.main_company"/>
<field name="journal_id" ref="account.sales_journal"/>
<field name="state">draft</field>
<field name="type">out_invoice</field>
<field name="account_id" ref="account.a_recv"/>
<field name="partner_id" ref="base.res_partner_9"/>
</record>
</data>
</openerp>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<record id="crm_rma_invoice_1_line_1" model="account.invoice.line">
<field name="product_id" ref="product.product_product_8"/>
<field name="invoice_id" ref="crm_rma_invoice_001"/>
<field name="account_id" ref="account.a_sale"/>
<field name="name">iMac</field>
<field name="price_unit">1799</field>
<field name="quantity">3</field>
</record>
<record id="crm_rma_invoice_1_line_2" model="account.invoice.line">
<field name="product_id" ref="product.product_product_3"/>
<field name="invoice_id" ref="crm_rma_invoice_001"/>
<field name="account_id" ref="account.a_sale"/>
<field name="name">PC Assemble</field>
<field name="price_unit">450</field>
<field name="quantity">1</field>
</record>
</data>
</openerp>

View File

@@ -1,28 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<record id="claim_line_1" model="claim.line">
<field name="name">Claim Line 1 of Claim 6</field>
<field name="claim_id" ref="crm_claim.crm_claim_6"/>
<field name="claim_origin">legal</field>
<field name="invoice_line_id" ref="crm_rma_invoice_1_line_1"/>
<field name="product_id" ref="product.product_product_8"/>
<field name="product_returned_quantity">1</field>
<field name="unit_sale_price">1799</field>
<field name="location_dest_id" search="[('name','=','Stock'),('company_id', '=', 1)]" />
<field name="number">00013</field>
</record>
<record id="claim_line_2" model="claim.line">
<field name="name">Claim Line 2 of Claim 6</field>
<field name="claim_id" ref="crm_claim.crm_claim_6"/>
<field name="claim_origin">damaged</field>
<field name="invoice_line_id" ref="crm_rma_invoice_1_line_2"/>
<field name="product_id" ref="product.product_product_3"/>
<field name="product_returned_quantity">1</field>
<field name="unit_sale_price">450</field>
<field name="location_dest_id" search="[('name','=','Stock'),('company_id', '=', 1)]" />
<field name="number">00012</field>
</record>
</data>
</openerp>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<record id="crm_claim.crm_claim_6" model="crm.claim">
<field name="invoice_id" ref="crm_rma_invoice_001"/>
<field name="delivery_address_id" ref="base.res_partner_9"/>
</record>
</data>
</openerp>

View File

@@ -1,27 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume,
# 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 account_invoice
from . import account_invoice_line
from . import claim_line

View File

@@ -1,27 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It, MONK Software, Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli
# 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/>.
#
##############################################################################
# © 2015 Eezee-It, MONK Software, Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, exceptions, fields, models
@@ -33,8 +14,7 @@ class AccountInvoice(models.Model):
claim_id = fields.Many2one('crm.claim', string='Claim')
def _refund_cleanup_lines(self, lines):
"""
Override when from claim to update the quantity and link to the
""" Override when from claim to update the quantity and link to the
claim line.
"""
@@ -71,16 +51,14 @@ class AccountInvoice(models.Model):
# TODO use custom states to show button of this wizard or
# not instead of raise an error
raise exceptions.Warning(
_('A refund has already been created for this claim !'))
raise exceptions.UserError(
_('A refund has already been created for this claim !')
)
return [(0, 0, l) for l in new_lines]
@api.model
def _prepare_refund(self, invoice, date=None, period_id=None,
description=None, journal_id=None):
result = super(AccountInvoice, self)._prepare_refund(
invoice, date=date, period_id=period_id, description=description,
journal_id=journal_id)
def _prepare_refund(self, *args, **kwargs):
result = super(AccountInvoice, self)._prepare_refund(*args, **kwargs)
if self.env.context.get('claim_id'):
result['claim_id'] = self.env.context['claim_id']

View File

@@ -1,27 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume,
# 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/>.
#
##############################################################################
# © 2015 Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models

View File

@@ -1,27 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume,
# 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/>.
#
##############################################################################
# © 2015 Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import calendar
import math
from datetime import datetime
@@ -133,7 +115,9 @@ class ClaimLine(models.Model):
@api.model
def get_warranty_return_partner(self):
return self.env['product.supplierinfo'].get_warranty_return_partner()
return self.env['product.supplierinfo']._columns[
'warranty_return_partner'
].selection
warranty_type = fields.Selection(
get_warranty_return_partner, readonly=True,
@@ -304,12 +288,14 @@ class ClaimLine(models.Model):
invoice_id, claim.claim_type,
self.product_id, claim.date)
except InvoiceNoDate:
raise exceptions.Warning(
_('Error'), _('Cannot find any date for invoice. '
'Must be a validated invoice.'))
raise exceptions.UserError(
_('Cannot find any date for invoice. '
'Must be a validated invoice.')
)
except ProductNoSupplier:
raise exceptions.Warning(
_('Error'), _('The product has no supplier configured.'))
raise exceptions.UserError(
_('The product has no supplier configured.')
)
self.write(values)
return True
@@ -326,8 +312,7 @@ class ClaimLine(models.Model):
@api.returns('stock.location')
def get_destination_location(self, product_id, warehouse_id):
"""
Compute and return the destination location to take
""" Compute and return the destination location to take
for a return. Always take 'Supplier' one when return type different
from company.
"""
@@ -343,8 +328,7 @@ class ClaimLine(models.Model):
return location_dest_id
def _warranty_return_address_values(self, product, company, warehouse):
"""
Return the partner to be used as return destination and
""" Return the partner to be used as return destination and
the destination stock location of the line in case of return.
We can have various cases here:
@@ -386,33 +370,28 @@ class ClaimLine(models.Model):
@api.multi
def set_warranty(self):
"""
Calculate warranty limit and address
""" Calculate warranty limit and address
"""
for line_id in self:
if not line_id.product_id:
raise exceptions.Warning(
_('Error'), _('Please set product first'))
raise exceptions.UserError(_('Please set product first'))
if not line_id.invoice_line_id:
raise exceptions.Warning(
_('Error'), _('Please set invoice first'))
raise exceptions.UserError(_('Please set invoice first'))
line_id.set_warranty_limit()
line_id.set_warranty_return_address()
@api.model
def _get_sequence_number(self):
"""
@return the value of the sequence for the number field in the
""" Return the value of the sequence for the number field in the
claim.line model.
"""
return self.env['ir.sequence'].get('claim.line')
return self.env['ir.sequence'].next_by_code('claim.line')
@api.model
def create(self, vals):
"""
@return write the identify number once the claim line is create.
"""Return write the identify number once the claim line is create.
"""
vals = vals or {}

View File

@@ -1,27 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It, MONK Software, Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli,
# 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/>.
#
##############################################################################
# © 2015 Eezee-It, MONK Software, Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, exceptions, fields, models
from .invoice_no_date import InvoiceNoDate
@@ -36,8 +18,9 @@ class CrmClaim(models.Model):
wh_obj = self.env['stock.warehouse']
wh = wh_obj.search([('company_id', '=', company_id)], limit=1)
if not wh:
raise exceptions.Warning(
_('There is no warehouse for the current user\'s company.'))
raise exceptions.UserError(
_('There is no warehouse for the current user\'s company.')
)
return wh
def _get_picking_ids(self):
@@ -95,8 +78,7 @@ class CrmClaim(models.Model):
@api.model
def _get_claim_type_default(self):
claim_type = self.env['crm.claim.type'].search([])
return claim_type[0] if claim_type else self.env['crm.claim.type']
return self.env.ref('crm_claim_type.crm_claim_type_customer')
claim_type = \
fields.Many2one(default=_get_claim_type_default,
@@ -107,7 +89,6 @@ class CrmClaim(models.Model):
def _onchange_invoice_warehouse_type_date(self):
context = self.env.context
claim_line = self.env['claim.line']
invoice_lines = self.invoice_id.invoice_line
if not self.warehouse_id:
self.warehouse_id = self._get_default_warehouse()
claim_type = self.claim_type
@@ -135,7 +116,7 @@ class CrmClaim(models.Model):
if create_lines: # happens when the invoice is changed
claim_lines = []
for invoice_line in invoice_lines:
for invoice_line in self.invoice_id.invoice_line_ids:
location_dest = claim_line.get_destination_location(
invoice_line.product_id, warehouse)
line = {
@@ -160,11 +141,19 @@ class CrmClaim(models.Model):
self.delivery_address_id = self.invoice_id.partner_id.id
@api.model
def message_get_reply_to(self):
""" Override to get the reply_to of the parent project. """
return [claim.section_id.message_get_reply_to()[0]
if claim.section_id else False
for claim in self.sudo()]
def message_get_reply_to(self, res_ids, default=None):
""" Override to get the reply_to of the parent project.
"""
results = dict.fromkeys(res_ids, default or False)
if res_ids:
claims = self.browse(res_ids)
results.update({
claim.id: self.env['crm.team'].message_get_reply_to(
[claim.team_id], default
)[claim.team_id] for claim in claims if claim.team_id
})
return results
@api.multi
def message_get_suggested_recipients(self):
@@ -172,13 +161,17 @@ class CrmClaim(models.Model):
try:
for claim in self:
if claim.partner_id:
self._message_add_suggested_recipient(
recipients, claim,
partner=claim.partner_id, reason=_('Customer'))
claim._message_add_suggested_recipient(
recipients,
partner=claim.partner_id,
reason=_('Customer')
)
elif claim.email_from:
self._message_add_suggested_recipient(
recipients, claim,
email=claim.email_from, reason=_('Customer Email'))
claim._message_add_suggested_recipient(
recipients,
email=claim.email_from,
reason=_('Customer Email')
)
except exceptions.AccessError:
# no read access rights -> just ignore suggested recipients
# because this imply modifying followers
@@ -190,14 +183,21 @@ class CrmClaim(models.Model):
browse(code_id).ir_sequence_id.code
sequence = self.env['ir.sequence']
return claim_type_code and sequence.get(claim_type_code) or '/'
return claim_type_code and sequence.next_by_code(
claim_type_code
) or '/'
@api.model
def create(self, values):
values = values or {}
if 'code' not in values or not values.get('code') \
or values.get('code') == '/':
values['code'] = self._get_sequence_number(values['claim_type'])
claim_type = values.get('claim_type')
if not claim_type:
claim_type = self._get_claim_type_default().id
values['code'] = self._get_sequence_number(claim_type)
return super(CrmClaim, self).create(values)

View File

@@ -1,31 +1,11 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It, MONK Software, Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli,
# 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/>.
#
##############################################################################
# © 2015 Eezee-It, MONK Software, Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
class InvoiceNoDate(Exception):
"""
Raised when a warranty cannot be computed for a claim line
""" Raised when a warranty cannot be computed for a claim line
because the invoice has no date.
"""

View File

@@ -1,32 +1,12 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2015 Eezee-It, MONK Software
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli
# Osval Reyes <osval@vauxoo.com>
#
# 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/>.
#
##############################################################################
# © 2015 Vauxoo
# © 2015 Eezee-It, MONK Software
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
class ProductNoSupplier(Exception):
"""
Raised when a warranty cannot be computed for a claim line
""" Raised when a warranty cannot be computed for a claim line
because the product has no supplier.
"""

View File

@@ -1,27 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It, MONK Software, Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli,
# 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/>.
#
##############################################################################
# © 2015 Eezee-It, MONK Software, Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
@@ -32,9 +14,8 @@ class StockMove(models.Model):
@api.model
def create(self, vals):
"""
In case of a wrong picking out, We need to create a new stock_move in a
picking already open.
""" In case of a wrong picking out,
We need to create a new stock_move in a picking already open.
To avoid having to confirm the stock_move, we override the create and
confirm it at the creation only for this case.
"""

View File

@@ -1,27 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It, MONK Software, Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli,
# 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/>.
#
##############################################################################
# © 2015 Eezee-It, MONK Software, Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models

View File

@@ -1,34 +1,14 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It, MONK Software, Vauxoo
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli,
# 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/>.
#
##############################################################################
# © 2015 Eezee-It, MONK Software, Vauxoo
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
class SubstateSubstate(models.Model):
"""
To precise a state (state=refused; substates= reason 1, 2,...)
""" To precise a state (state=refused; substates= reason 1, 2,...)
"""
_name = "substate.substate"

View File

@@ -1,6 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_substate_user,substate.substate.user,model_substate_substate,base.group_sale_salesman_all_leads,1,1,1,0
access_claim_line_user,claim.line.user,model_claim_line,base.group_sale_salesman_all_leads,1,1,1,0
access_substate_user_all_leads,substate.substate.user,model_substate_substate,base.group_sale_salesman_all_leads,1,1,1,0
access_claim_line_user_all_leads,claim.line.user,model_claim_line,base.group_sale_salesman_all_leads,1,1,1,0
access_substate_manager,substate.substate.manager,model_substate_substate,base.group_sale_manager,1,1,1,1
access_claim_line_manager,claim.line.manager,model_claim_line,base.group_sale_manager,1,1,1,1
access_substate_user,substate.substate.user,model_substate_substate,base.group_sale_salesman,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_substate_user access_substate_user_all_leads substate.substate.user model_substate_substate base.group_sale_salesman_all_leads 1 1 1 0
3 access_claim_line_user access_claim_line_user_all_leads claim.line.user model_claim_line base.group_sale_salesman_all_leads 1 1 1 0
4 access_substate_manager substate.substate.manager model_substate_substate base.group_sale_manager 1 1 1 1
5 access_claim_line_manager claim.line.manager model_claim_line base.group_sale_manager 1 1 1 1
6 access_substate_user substate.substate.user model_substate_substate base.group_sale_salesman 1 1 1 0

View File

@@ -3,12 +3,11 @@
-
I create a customer invoice
-
!record {model: account.invoice, id: account_invoice_claim_refund, view: account.invoice_form}:
payment_term: account.account_payment_term_advance
journal_id: account.sales_journal
!record {model: account.invoice, id: account_invoice_claim_refund}:
payment_term_id: account.account_payment_term_advance
partner_id: base.res_partner_3
name: 'Test Customer Invoice'
invoice_line:
invoice_line_ids:
- product_id: product.product_product_5
quantity: 10.0
- product_id: product.product_product_4
@@ -54,4 +53,3 @@
refund_lines = self.pool.get('account.invoice.line').browse(cr, uid, refund_line_ids)
assert ref('product.product_product_4') in [refund_lines[0].product_id.id, refund_lines[1].product_id.id], "First line is checked"
assert ref('product.product_product_5') in [refund_lines[0].product_id.id, refund_lines[1].product_id.id], "Second line is checked"

View File

@@ -1,21 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Vaucher
# Copyright 2014 Camptocamp SA
#
# 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_claim
from . import test_picking_creation

View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# © 2016 Cyril Gaudin (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import TransactionCase
class TestClaim(TransactionCase):
def test_create__no_claim_type(self):
# Just test the case when claim_type is not in values and default value
# is not yet filled by BaseModel.create as we override this method
# and our code need claim_type to generate code
claim = self.env['crm.claim'].create({'name': 'Test claim'})
self.assertEqual(
self.env.ref('crm_claim_type.crm_claim_type_customer'),
claim.claim_type,
)
self.assertIsNotNone(claim.code)
self.assertTrue(claim.code.startswith('RMA-C/'))
def test_create__with_claim_type(self):
supplier_type = self.env.ref('crm_claim_type.crm_claim_type_supplier')
claim = self.env['crm.claim'].create({
'name': 'Test claim',
'claim_type': supplier_type.id,
})
self.assertEqual(supplier_type, claim.claim_type)
self.assertIsNotNone(claim.code)
self.assertTrue(claim.code.startswith('RMA-V/'))

View File

@@ -1,27 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Vaucher
# Yanina Aular
# Copyright 2015 Vauxoo
# Copyright 2014 Camptocamp SA
#
# 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/>.
#
##############################################################################
# © 2015 Vauxoo
# © 2014 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
from openerp.tools.safe_eval import safe_eval
class TestPickingCreation(common.TransactionCase):
@@ -36,18 +18,37 @@ class TestPickingCreation(common.TransactionCase):
claim = self.env['crm.claim']
self.product_id = self.env.ref('product.product_product_4')
self.partner_id = self.env.ref('base.res_partner_12')
self.customer_location_id = self.env.ref(
'stock.stock_location_customers')
'stock.stock_location_customers'
)
sale_order_agrolait_demo = self.env.ref('sale.sale_order_1')
self.assertTrue(sale_order_agrolait_demo.invoice_ids,
"The Order Sale of Agrolait not have Invoice")
invoice_agrolait = sale_order_agrolait_demo.invoice_ids[0]
invoice_agrolait.\
signal_workflow('invoice_open')
uom_unit = self.env.ref('product.product_uom_unit')
self.sale_order = self.env['sale.order'].create({
'state': 'done',
'partner_id': self.env.ref('base.res_partner_2').id,
'partner_invoice_id': self.env.ref('base.res_partner_2').id,
'partner_shipping_id': self.env.ref('base.res_partner_2').id,
'pricelist_id': self.env.ref('product.list0').id,
'order_line': [
(0, False, {
'name': product.name,
'product_id': product.id,
'product_uom_qty': qty,
'qty_delivered': qty,
'product_uom': uom_unit.id,
'price_unit': product.list_price
}) for product, qty in [
(self.env.ref('product.product_product_25'), 3),
(self.env.ref('product.product_product_30'), 5),
(self.env.ref('product.product_product_33'), 2),
]
]
})
invoice_id = self.sale_order.action_invoice_create()[0]
self.invoice = self.env['account.invoice'].browse(invoice_id)
# Create the claim with a claim line
self.claim_id = claim.create(
@@ -58,7 +59,7 @@ class TestPickingCreation(common.TransactionCase):
'crm_claim_type_customer').id,
'delivery_address_id': self.partner_id.id,
'partner_id': self.env.ref('base.res_partner_2').id,
'invoice_id': invoice_agrolait.id,
'invoice_id': invoice_id,
})
self.claim_id.with_context({'create_lines': True}).\
_onchange_invoice_warehouse_type_date()
@@ -137,7 +138,6 @@ class TestPickingCreation(common.TransactionCase):
def test_02_new_product_return(self):
"""Test wizard creates a correct picking for product return
"""
wizard = self.wizard_make_picking.with_context({
'active_id': self.claim_id.id,
@@ -159,36 +159,51 @@ class TestPickingCreation(common.TransactionCase):
def test_03_invoice_refund(self):
claim_id = self.env['crm.claim'].browse(
self.ref('crm_claim.crm_claim_6'))
invoice_id = self.env['account.invoice'].browse(
self.ref('account.invoice_5'))
self.ref('crm_claim.crm_claim_6')
)
self.invoice.confirm_paid()
claim_id.write({
'invoice_id': invoice_id.id
'invoice_id': self.invoice.id
})
claim_id.with_context({'create_lines': True}).\
_onchange_invoice_warehouse_type_date()
invoice_refund_wizard_id = self.env['account.invoice.refund'].\
with_context({
'active_ids': [claim_id.invoice_id.id],
# Test that invoice_ids is correctly passed as active_ids
'invoice_ids': [claim_id.invoice_id.id],
'claim_line_ids':
[[4, cl.id, False] for cl in claim_id.claim_line_ids],
}).create({
'description': "Testing Invoice Refund for Claim"
})
'description': "Testing Invoice Refund for Claim",
}).create({})
self.assertEqual(
"Testing Invoice Refund for Claim",
invoice_refund_wizard_id.description
)
res = invoice_refund_wizard_id.invoice_refund()
self.assertTrue(res)
self.assertEquals(res['res_model'], 'account.invoice')
self.assertEquals(safe_eval(res['context'])['type'], 'out_refund')
self.assertEqual(2, len(res['domain']))
# Second leaf is ('id', 'in', [created_invoice_id])
self.assertEqual(('id', 'in'), res['domain'][1][:2])
self.assertEqual(1, len(res['domain'][1][2]))
refund_invoice = self.env['account.invoice'].browse(
res['domain'][1][2]
)
self.assertEqual('out_refund', refund_invoice.type)
def test_04_display_name(self):
"""
It tests that display_name for each line has a message for it
"""
claim_line_ids = self.env['crm.claim'].browse(
self.ref('crm_claim.crm_claim_6'))[0].claim_line_ids
self.ref('crm_claim.crm_claim_6')
)[0].claim_line_ids
all_values = sum([bool(line_id.display_name)
for line_id in claim_line_ids])

View File

@@ -1,20 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- INHERITED VIEW FOR THE OBJECT : account_invoice -->
<odoo>
<!-- INHERITED VIEW FOR THE OBJECT : account_invoice -->
<record id="invoice_form" model="ir.ui.view">
<field name="name">crm_claim_rma.invoice_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field eval="16" name="priority"/>
<field name="arch" type="xml">
<data>
<xpath expr="/form/sheet/notebook/page[@string='Other Info']/group/group/field[@name='origin']" position="after">
<field name="claim_id" attrs="{'invisible':[('type','!=','out_refund')]}"/>
</xpath>
</data>
</field>
</record>
</data>
</openerp>
<record id="invoice_form" model="ir.ui.view">
<field name="name">crm_claim_rma.invoice_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field eval="16" name="priority"/>
<field name="arch" type="xml">
<data>
<field name='origin' position="after">
<field name="claim_id" attrs="{'invisible':[('type','!=','out_refund')]}"/>
</field>
</data>
</field>
</record>
</odoo>

View File

@@ -1,109 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_crm_claim_lines_filter" model="ir.ui.view">
<field name="name">CRM - Claims Search</field>
<field name="model">claim.line</field>
<field name="arch" type="xml">
<search string="Search Claims">
<filter icon="terp-check" string="Current" name="current"
<odoo>
<record id="view_crm_claim_lines_filter" model="ir.ui.view">
<field name="name">CRM - Claims Search</field>
<field name="model">claim.line</field>
<field name="arch" type="xml">
<search string="Search Claims">
<filter icon="terp-check" string="Current" name="current"
domain="[('state','in',('draft', 'refused', 'treated'))]"
separator="1" help="Draft and Open Claims" />
<filter icon="terp-camera_test"
separator="1" help="Draft and Open Claims"/>
<filter icon="terp-camera_test"
string="In Progress"
domain="[('state','in',('confirmed','in_to_control','in_to_treate'))]"
separator="1" help="In Progress Claims"/>
<separator orientation="vertical"/>
<field name="number"/>
<field name="state" select='1'/>
<field name="substate_id" select='1'/>
<separator orientation="vertical"/>
<field name="number"/>
<field name="state" select='1'/>
<field name="substate_id" select='1'/>
<field name="name" select='1'/>
<field name="warning" select='1'/>
<field name="invoice_line_id" select='1' readonly='1'/>
<field name="product_id" select='1'/>
<field name="prodlot_id" select='1'/>
<field name="move_in_id"/>
<newline/>
<group expand="0" string="More">
<field name="last_state_change" select='1'/>
<field name="guarantee_limit" select='1'/>
<field name="return_value" select='1'/>
<field name="name" select='1'/>
<field name="warning" select='1'/>
<field name="invoice_line_id" select='1' readonly='1'/>
<field name="product_id" select='1'/>
<field name="prodlot_id" select='1'/>
<field name="move_in_id"/>
<newline/>
<group expand="0" string="More">
<field name="last_state_change" select='1'/>
<field name="guarantee_limit" select='1'/>
<field name="return_value" select='1'/>
<field name="name" select='1'/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Invoice" icon="terp-dolar"
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Invoice" icon="terp-dolar"
domain="[]" help="Invoice"
context="{'group_by':'invoice_id'}" />
context="{'group_by':'invoice_id'}"/>
<filter string="Product" icon="terp-product"
<filter string="Product" icon="terp-product"
domain="[]" help="Product"
context="{'group_by':'product_id'}" />
<separator orientation="vertical"/>
context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Substate" icon="terp-stage"
domain="[]" context="{'group_by':'substate_id'}" />
<filter string="Substate" icon="terp-stage"
domain="[]" context="{'group_by':'substate_id'}"/>
<filter string="Claim n°" icon="terp-emblem-documents"
domain="[]" context="{'group_by':'claim_id'}" />
<filter string="Claim n°" icon="terp-emblem-documents"
domain="[]" context="{'group_by':'claim_id'}"/>
<filter string="Priority"
<filter string="Priority"
name="group_by_priority"
domain="[]"
context="{'group_by':'priority'}"
help="Priority"/>
<filter string="State"
<filter string="State"
name="group_by_state"
domain="[]"
context="{'group_by':'state'}"
help="Grouping by state"/>
</group>
</search>
</field>
</record>
</group>
</search>
</field>
</record>
<record model="ir.ui.view" id="crm_claim_line_tree_view">
<field name="name">CRM - Claims Tree</field>
<field name="model">claim.line</field>
<field name="arch" type="xml">
<tree string="Claim lines">
<field name="claim_id" invisible="1"/>
<field name="number"/>
<field name="state"/>
<field name="substate_id"/>
<field name="product_id"/>
<field name="name"/>
<field name="prodlot_id"/>
<field name="warning"/>
<field name="warranty_type"/>
<field name="warranty_return_partner"/>
<button name="set_warranty" string="Compute Warranty" type="object" icon="gtk-justify-fill"/>
<field name="product_returned_quantity"/>
<field name="claim_origin"/>
<field name="claim_diagnosis"/>
<field name="refund_line_id"/>
<field name="move_in_id"/>
<field name="move_out_id"/>
<field name="priority"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_claim_line_tree_view">
<field name="name">CRM - Claims Tree</field>
<field name="model">claim.line</field>
<field name="arch" type="xml">
<tree string="Claim lines">
<field name="claim_id" invisible="1"/>
<field name="number"/>
<field name="state"/>
<field name="substate_id"/>
<field name="product_id"/>
<field name="name"/>
<field name="prodlot_id"/>
<field name="warning"/>
<field name="warranty_type"/>
<field name="warranty_return_partner"/>
<button name="set_warranty" string="Compute Warranty" type="object" icon="gtk-justify-fill"/>
<field name="product_returned_quantity"/>
<field name="claim_origin"/>
<field name="claim_diagnosis"/>
<field name="refund_line_id"/>
<field name="move_in_id"/>
<field name="move_out_id"/>
<field name="priority"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_claim_line_form_view">
<field name="name">CRM - Claim product return line Form</field>
<field name="model">claim.line</field>
<field name="arch" type="xml">
<form string="Claim Line" version="7.0">
<header>
<record model="ir.ui.view" id="crm_claim_line_form_view">
<field name="name">CRM - Claim product return line Form</field>
<field name="model">claim.line</field>
<field name="arch" type="xml">
<form string="Claim Line" version="7.0">
<header>
<button name="set_warranty" string="Calculate warranty state" type="object" class="oe_highlight"/>
<field name="state"
widget="statusbar"/>
widget="statusbar"/>
</header>
<sheet string="Claims">
<div class="oe_title" colspan="4">
<group>
<h1><field name="number" class="oe_inline"/></h1>
<h1>
<field name="number" class="oe_inline"/>
</h1>
</group>
</div>
<separator string="Problem" colspan="4"/>
@@ -140,56 +141,59 @@
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<!--
A second slightly modified form view to be used for the claim_line_ids
field in the crm.claim form view. Defining it here instead of directly
inside the field allows us to write only the changes and reference it
-->
<record id="crm_claim_line_view_form_embedded" model="ir.ui.view">
<field name="name">Claim line form view to be used inside claim tree</field>
<field name="mode">primary</field>
<field name="model">claim.line</field>
<field name="priority" eval="30"/>
<field name="inherit_id" ref="crm_claim_line_form_view"/>
<field name="arch" type="xml">
<field name="claim_id" position="attributes">
<attribute name="readonly">1</attribute>
</field>
<field name="product_id" position="attributes">
<attribute name="context">{'claim_id': parent.id, 'company_id': parent.company_id, 'warehouse_id': parent.warehouse_id, 'claim_type': parent.claim_type, 'claim_date': parent.date}</attribute>
</field>
<field name="invoice_line_id" position="attributes">
<attribute name="context">{'claim_id': parent.id, 'company_id': parent.company_id, 'warehouse_id': parent.warehouse_id, 'claim_type': parent.claim_type, 'claim_date': parent.date}</attribute>
</field>
<!--
A second slightly modified form view to be used for the claim_line_ids
field in the crm.claim form view. Defining it here instead of directly
inside the field allows us to write only the changes and reference it
-->
<record id="crm_claim_line_view_form_embedded" model="ir.ui.view">
<field name="name">Claim line form view to be used inside claim tree</field>
<field name="mode">primary</field>
<field name="model">claim.line</field>
<field name="priority" eval="30"/>
<field name="inherit_id" ref="crm_claim_line_form_view"/>
<field name="arch" type="xml">
<field name="claim_id" position="attributes">
<attribute name="readonly">1</attribute>
</field>
</record>
<!-- Claim lines action -->
<record model="ir.actions.act_window" id="act_crm_case_claim_lines">
<field name="name">Claim lines</field>
<field name="res_model">claim.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm_claim_line_tree_view"/>
<field name="search_view_id" ref="view_crm_claim_lines_filter"/>
<field name="context">{'search_default_group_by_priority': True,
'search_default_group_by_state': True}
<field name="product_id" position="attributes">
<attribute name="context">{'claim_id': parent.id, 'company_id': parent.company_id, 'warehouse_id':
parent.warehouse_id, 'claim_type': parent.claim_type, 'claim_date': parent.date}
</attribute>
</field>
</record>
<field name="invoice_line_id" position="attributes">
<attribute name="context">{'claim_id': parent.id, 'company_id': parent.company_id, 'warehouse_id':
parent.warehouse_id, 'claim_type': parent.claim_type, 'claim_date': parent.date}
</attribute>
</field>
</field>
</record>
<!-- Menu -->
<menuitem
<!-- Claim lines action -->
<record model="ir.actions.act_window" id="act_crm_case_claim_lines">
<field name="name">Claim lines</field>
<field name="res_model">claim.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm_claim_line_tree_view"/>
<field name="search_view_id" ref="view_crm_claim_lines_filter"/>
<field name="context">{'search_default_group_by_priority': True,
'search_default_group_by_state': True}
</field>
</record>
<!-- Menu -->
<menuitem
name="Claim lines"
id="menu_crm_case_claims_claim_lines"
parent="base.menu_aftersale"
action="act_crm_case_claim_lines"
sequence="2"/>
</data>
</openerp>
</odoo>

View File

@@ -1,86 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- CLAIM VIEWS -->
<record model="ir.ui.view" id="crm_case_claims_tree_view">
<field name="name">CRM - Claims Tree</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_tree_view"/>
<field name="arch" type="xml">
<field name="stage_id" position="after">
<field name="section_id"/>
</field>
<odoo>
<!-- CLAIM VIEWS -->
<record model="ir.ui.view" id="crm_case_claims_tree_view">
<field name="name">CRM - Claims Tree</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_tree_view"/>
<field name="arch" type="xml">
<field name="stage_id" position="after">
<field name="team_id"/>
</field>
</record>
<!-- Crm claim Search view -->
<record id="view_crm_case_claims_filter" model="ir.ui.view">
<field name="name">CRM - Claims Search</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.view_crm_case_claims_filter"/>
<field name="arch" type="xml">
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}" position="before">
<filter string="Sales Team" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'section_id'}"/>
</filter>
</field>
</record>
</field>
</record>
<!-- Crm claim Search view -->
<record id="view_crm_case_claims_filter" model="ir.ui.view">
<field name="name">CRM - Claims Search</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.view_crm_case_claims_filter"/>
<field name="arch" type="xml">
<xpath expr="/search/group/filter[position()=2]" position="after">
<filter string="Sales Team" icon="terp-stock_symbol-selection"
domain="[]"
context="{'group_by':'team_id'}"/>
</xpath>
</field>
</record>
<!-- Right side link to orders -->
<act_window
id="act_crm_claim_rma_sale_orders"
name="Quotations and Sales"
res_model="sale.order"
src_model="crm.claim"/>
id="act_crm_claim_rma_sale_orders"
name="Quotations and Sales"
res_model="sale.order"
src_model="crm.claim"/>
<act_window
id="act_crm_claim_rma_purchase_orders"
name="Purchases"
res_model="purchase.order"
src_model="crm.claim"/>
id="act_crm_claim_rma_purchase_orders"
name="Purchases"
res_model="purchase.order"
src_model="crm.claim"/>
<act_window
domain="[('type', 'in', ('in_invoice', 'out_invoice'))]"
id="act_crm_claim_rma_invoice"
name="Invoices"
res_model="account.invoice"
src_model="crm.claim"/>
domain="[('type', 'in', ('in_invoice', 'out_invoice'))]"
id="act_crm_claim_rma_invoice"
name="Invoices"
res_model="account.invoice"
src_model="crm.claim"/>
<act_window
id="act_crm_claim_rma_refunds"
name="Refunds"
res_model="account.invoice"
src_model="crm.claim"
domain="[('type', 'in', ('in_refund', 'out_refund'))]"/>
id="act_crm_claim_rma_refunds"
name="Refunds"
res_model="account.invoice"
src_model="crm.claim"
domain="[('type', 'in', ('in_refund', 'out_refund'))]"/>
<act_window
id="act_crm_claim_rma_picking_in"
name="Incoming Shipment and Returns"
res_model="stock.picking"
src_model="crm.claim"/>
id="act_crm_claim_rma_picking_in"
name="Incoming Shipment and Returns"
res_model="stock.picking"
src_model="crm.claim"/>
<record model="ir.ui.view" id="crm_claim_rma_form_view">
<field name="name">CRM - Claim product return Form</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<!-- Header/workflow Buttons -->
<xpath expr="//field[@name='stage_id']" position="before">
<button name="%(action_claim_picking_in)d"
<record model="ir.ui.view" id="crm_claim_rma_form_view">
<field name="name">CRM - Claim product return Form</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<!-- Header/workflow Buttons -->
<xpath expr="//field[@name='stage_id']" position="before">
<button name="%(action_claim_picking_in)d"
string="New Products Return"
class="oe_inline"
type="action" target="new"
context="{'warehouse_id': warehouse_id,
'partner_id': partner_id}"/>
<button name="%(action_claim_picking_out)d"
<button name="%(action_claim_picking_out)d"
class="oe_inline"
string="New Delivery"
type="action" target="new"
context="{'warehouse_id': warehouse_id,
'partner_id': partner_id}"/>
<button name="%(account.action_account_invoice_refund)d"
<button name="%(account.action_account_invoice_refund)d"
class="oe_inline"
type='action' string='New Refund'
context="{
@@ -89,201 +90,202 @@
'description': name,
'claim_id': id,
}"/>
</xpath>
<xpath expr="//sheet/group[2]" position="replace">
<group colspan="4" col="4" groups="base.group_user">
<field name="warehouse_id" />
<field name="date"/>
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/>
<field name="priority" widget="priority"/>
<field name="date_deadline"/>
<field name="section_id" groups="base.group_multi_salesteams"/>
</group>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<xpath expr="//field[@name='partner_phone']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<xpath expr="//field[@name='email_from']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<!-- Smart buttons -->
<xpath expr="//sheet[@string='Claims']/group[1]" position="after">
<div class="oe_right oe_button_box" name="buttons">
<button class="oe_inline oe_stat_button"
name="%(act_crm_claim_rma_sale_orders)d" type="action"
</xpath>
<xpath expr="//field[@name='team_id']/parent::group" position="replace">
<group colspan="4" col="4" groups="base.group_user">
<field name="warehouse_id"/>
<field name="date"/>
<field name="user_id"
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/>
<field name="priority" widget="priority"/>
<field name="date_deadline"/>
<field name="team_id" groups="base.group_multi_salesteams"/>
</group>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<xpath expr="//field[@name='partner_phone']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<xpath expr="//field[@name='email_from']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<!-- Smart buttons -->
<xpath expr="//field[@name='name']/parent::group" position="after">
<div class="oe_right oe_button_box" name="buttons">
<button class="oe_inline oe_stat_button"
name="%(act_crm_claim_rma_sale_orders)d"
type="action"
icon="fa-strikethrough"
string="Sales"
attrs="{'invisible': ['|',('partner_id','=', False)]}"
context="{'search_default_partner_id': [partner_id],
'search_default_user_id':False}" />
<button class="oe_inline oe_stat_button"
context="{'search_default_partner_id': [partner_id], 'search_default_user_id':False}"/>
<button class="oe_inline oe_stat_button"
name="%(act_crm_claim_rma_purchase_orders)d"
type="action"
icon="fa-shopping-cart"
string="Purchases"
attrs="{'invisible': ['|',('partner_id','=', False)]}"
context="{'search_default_partner_id': [partner_id],
'search_default_user_id':False}"
/>
<button class="oe_inline oe_stat_button"
'search_default_user_id':False}"/>
<button class="oe_inline oe_stat_button"
name="%(act_crm_claim_rma_invoice)d"
type="action"
string="Invoices"
icon="fa-pencil-square"
attrs="{'invisible': ['|',('partner_id','=', False)]}"
context="{'search_default_partner_id': [partner_id],
'group_by':'type',
'search_default_user_id':False}" />
context="{'search_default_partner_id': [partner_id], 'group_by':'type', 'search_default_user_id':False}"/>
<button class="oe_inline oe_stat_button"
<button class="oe_inline oe_stat_button"
name="%(act_crm_claim_rma_refunds)d"
type="action"
string="Refunds"
icon="fa-file-text"
attrs="{'invisible': ['|',('partner_id','=', False),
('claim_type','in', ['customer','other'])]}"
context="{'search_default_partner_id': [partner_id],
'group_by':'type',
'search_default_user_id':False}" />
<button class="oe_inline oe_stat_button"
attrs="{'invisible': ['|',('partner_id','=', False), ('claim_type','in', ['customer','other'])]}"
context="{'search_default_partner_id': [partner_id], 'group_by':'type', 'search_default_user_id':False}"/>
<button class="oe_inline oe_stat_button"
icon="fa-reply"
name="%(act_crm_claim_rma_picking_in)d"
type="action"
string="Returns"
attrs="{'invisible': ['|',('partner_id','=', False),
('claim_type','in', ['supplier','other'])]}"
context="{'search_default_claim_id': active_id,
'search_default_user_id':False}"/>
</div>
</xpath>
<xpath expr="//sheet[@string='Claims']/group[1]" position="replace">
<div class="oe_title oe_left">
<h1><field name="code"/></h1>
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1><small><field name="name"/></small></h1>
attrs="{'invisible': ['|',('partner_id','=', False), ('claim_type','in', ['supplier','other'])]}"
context="{'search_default_claim_id': active_id, 'search_default_user_id':False}"/>
</div>
</xpath>
<xpath expr="//field[@name='name']/parent::group" position="replace">
<div class="oe_title oe_left">
<h1>
<field name="code"/>
</h1>
<div class="oe_edit_only">
<label for="name"/>
</div>
</xpath>
<xpath expr="//page[@string='Claim Description']//group[1]"
position="inside">
<field name="pick" string="Pick the product in the store"/>
<field name="delivery_address_id"
string="Partner delivery address"
domain="[('id','child_of',partner_id)]"
attrs="{'invisible': ['|',('pick','=', True)],
'required': [('pick','=', False)]}"
context="{'tree_view_ref': 'crm_claim_rma.view_partner_contact_tree',
'search_default_parent_id': partner_id}"/>
<field name="invoice_id" domain="['|',('commercial_partner_id','=',partner_id),('partner_id','=',partner_id)]" context="{'create_lines': True}"/>
</xpath>
<xpath expr="//page[@string='Claim Description']//group[1]"
position="after">
<div name="serial">
<!-- Place for mass return button from crm_rma_lot_mass_return -->
</div>
<separator colspan="2" string="Product Returns"/>
<field name="claim_line_ids">
<tree string="Returned lines" create="false">
<field name="claim_id" invisible="1"/>
<field name="state"/>
<field name="product_id"/>
<h1>
<small>
<field name="name"/>
<field name="prodlot_id"/>
<field name="invoice_line_id">
<attribute name="readonly">1</attribute>
</field>
<field name="warning"/>
<field name="warranty_type"/>
<button name="set_warranty" string="Compute Warranty"
type="object" icon="gtk-justify-fill"/>
<field name="claim_origin"/>
<field name="claim_diagnosis"/>
</tree>
</field>
</xpath>
<!-- Remove domain and widget attributes -->
<field name="categ_id" widget="selection" position="replace">
<field name="categ_id"/>
</field>
<!-- New tabs for products return and generated documents -->
<page string="Follow Up" position="before">
<page string="Generated Documents">
<separator colspan="2" string="Refunds"/>
<field name="invoice_ids" colspan="4" readonly="1"/>
<separator colspan="2" string="Receptions / Deliveries"/>
<field name="picking_ids" colspan="4" readonly="1"/>
</page>
</page>
</small>
</h1>
</div>
</xpath>
<field name="email_from" position="after">
<field name="pick" string="Pick the product in the store"/>
<field name="delivery_address_id"
string="Partner delivery address"
domain="[('id','child_of',partner_id)]"
attrs="{'invisible': ['|',('pick','=', True)],
'required': [('pick','=', False)]}"
context="{'tree_view_ref': 'crm_claim_rma.view_partner_contact_tree',
'search_default_parent_id': partner_id}"/>
<field name="invoice_id"
domain="['|',('commercial_partner_id','=',partner_id),('partner_id','=',partner_id)]"
context="{'create_lines': True}"/>
</field>
</record>
<xpath expr="//field[@name='email_from']/parent::group" position="after">
<div name="serial">
<!-- Place for mass return button from crm_rma_lot_mass_return -->
</div>
<separator colspan="2" string="Product Returns"/>
<field name="claim_line_ids">
<tree string="Returned lines" create="false">
<field name="claim_id" invisible="1"/>
<field name="state"/>
<field name="product_id"/>
<field name="name"/>
<field name="prodlot_id"/>
<field name="invoice_line_id" invisible="True"/>
<field name="warning"/>
<field name="warranty_type"/>
<button name="set_warranty" string="Compute Warranty"
type="object" icon="gtk-justify-fill"/>
<field name="product_returned_quantity"/>
<field name="claim_origin"/>
<field name="claim_diagnosis"/>
<field name="location_dest_id" invisible="True"/>
</tree>
</field>
</xpath>
<!-- New tabs for products return and generated documents -->
<xpath expr="//field[@name='email_from']/ancestor::page" position="after">
<page string="Generated Documents">
<separator colspan="2" string="Refunds"/>
<field name="invoice_ids" colspan="4" readonly="1"/>
<separator colspan="2" string="Receptions / Deliveries"/>
<field name="picking_ids" colspan="4" readonly="1"/>
</page>
</xpath>
</field>
</record>
<record model="ir.actions.act_window" id="crm_claim.crm_case_categ_claim0">
<field name="context">{"search_default_user_id":uid, "stage_type":'claim'}</field>
</record>
<record model="ir.actions.act_window" id="crm_claim.crm_claim_category_claim0">
<field name="context">{"search_default_user_id":uid, "stage_type":'claim'}</field>
</record>
<!-- substates action -->
<record id="act_crm_claim_substates" model="ir.actions.act_window">
<field name="name">Claim line substates</field>
<field name="res_model">substate.substate</field>
<field name="view_type">form</field>
</record>
<!-- substates action -->
<record id="act_crm_claim_substates" model="ir.actions.act_window">
<field name="name">Claim line substates</field>
<field name="res_model">substate.substate</field>
<field name="view_type">form</field>
</record>
<menuitem
<menuitem
name="Claim line substates"
id="menu_crm_case_claims_claim_line_substates"
parent="crm_claim.menu_config_claim"
action="act_crm_claim_substates"
sequence="2"/>
<!-- Update account invoice !-->
<record id="crm_claim_rma_form" model="ir.ui.view">
<field name="name">CRM Claim RMA</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='date_deadline']" position="after">
<field name="rma_number"/>
</xpath>
</data>
</field>
</record>
<record id="search_crm_claim_rma_number" model="ir.ui.view">
<field name="name">CRM - Claims Search</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.view_crm_case_claims_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<!-- Update account invoice !-->
<record id="crm_claim_rma_form" model="ir.ui.view">
<field name="name">CRM Claim RMA</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='date_deadline']" position="after">
<field name="rma_number"/>
</xpath>
</field>
</record>
</data>
</field>
</record>
<record id="tree_crm_claim_rma_number" model="ir.ui.view">
<field name="name">CRM - Claims Tree</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="rma_number"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="crm_case_claims_form_view">
<field name="name">CRM - Claims Form</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim_type.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='claim_type']" position="attributes">
<attribute name="context">{'create_lines': False}</attribute>
</xpath>
</field>
</record>
</data>
</openerp>
<record id="search_crm_claim_rma_number" model="ir.ui.view">
<field name="name">CRM - Claims Search</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.view_crm_case_claims_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="rma_number"/>
</xpath>
</field>
</record>
<record id="tree_crm_claim_rma_number" model="ir.ui.view">
<field name="name">CRM - Claims Tree</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="rma_number"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="crm_case_claims_form_view">
<field name="name">CRM - Claims Form</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim_type.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='claim_type']" position="attributes">
<attribute name="context">{'create_lines': False}</attribute>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,24 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<odoo>
<!-- Address list with details to help shipping address selection -->
<record id="view_partner_contact_tree" model="ir.ui.view">
<field name="name">res.partner.contact.tree</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<tree string="Contacts">
<field name="name"/>
<field name="function" invisible="True"/>
<field name="street"/>
<field name="zip"/>
<field name="city"/>
<field name="email"/>
<field name="user_id" invisible="True"/>
<field name="is_company" invisible="True"/>
<field name="country_id"/>
<field name="parent_id" invisible="True"/>
</tree>
</field>
<field name="name">res.partner.contact.tree</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<tree string="Contacts">
<field name="name"/>
<field name="function" invisible="True"/>
<field name="street"/>
<field name="zip"/>
<field name="city"/>
<field name="email"/>
<field name="user_id" invisible="True"/>
<field name="is_company" invisible="True"/>
<field name="country_id"/>
<field name="parent_id" invisible="True"/>
</tree>
</field>
</record>
</data>
</openerp>
</odoo>

View File

@@ -1,41 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- INHERITED VIEW FOR THE OBJECT : stock_picking -->
<record id="picking_in_form" model="ir.ui.view">
<field name="name">crm_claim_rma.picking_in_form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='move_type']" position="after">
<field name="claim_id" />
</xpath>
</field>
</record>
<record id="stock_move_mail_thread" model="ir.ui.view">
<field name="name">stock_move_mail_thread</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_form" />
<field name="arch" type="xml">
<xpath expr="//sheet" position="after">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</xpath>
</field>
</record>
<!-- SEARCH -->
<record id="view_picking_internal_search_claim_id" model="ir.ui.view">
<field name="name">stock.picking.internal.search</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
<field name="arch" type="xml">
<xpath expr="//search[@string='Picking Lists']">
<field name="claim_id" help="Moves created from claims"/>
</xpath>
</field>
</record>
</data>
</openerp>
<odoo>
<!-- INHERITED VIEW FOR THE OBJECT : stock_picking -->
<record id="picking_in_form" model="ir.ui.view">
<field name="name">crm_claim_rma.picking_in_form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_type']" position="after">
<field name="claim_id"/>
</xpath>
</field>
</record>
<record id="stock_move_mail_thread" model="ir.ui.view">
<field name="name">stock_move_mail_thread</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="after">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</xpath>
</field>
</record>
<!-- SEARCH -->
<record id="view_picking_internal_search_claim_id" model="ir.ui.view">
<field name="name">stock.picking.internal.search</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
<field name="arch" type="xml">
<xpath expr="//search[@string='Picking Lists']">
<field name="claim_id" help="Moves created from claims"/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,26 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume
#
# 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_make_picking
from . import account_invoice_refund

View File

@@ -1,28 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2015 Eezee-It, MONK Software
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli,
# 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/>.
#
##############################################################################
# © 2015 Vauxoo
# © 2015 Eezee-It, MONK Software
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models

View File

@@ -1,26 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Eezee-It, MONK Software
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli
#
# 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/>.
#
##############################################################################
# © 2015 Eezee-It, MONK Software
# © 2013 Camptocamp
# © 2009-2013 Akretion,
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from openerp import models, fields, exceptions, api, _
@@ -33,8 +16,7 @@ class ClaimMakePicking(models.TransientModel):
@api.returns('stock.location')
def _get_common_dest_location_from_line(self, lines):
"""
If all the lines have the same destination location return that,
""" If all the lines have the same destination location return that,
else return an empty recordset
"""
dests = lines.mapped('location_dest_id')
@@ -43,8 +25,7 @@ class ClaimMakePicking(models.TransientModel):
@api.returns('res.partner')
def _get_common_partner_from_line(self, lines):
"""
If all the lines have the same warranty return partner return that,
""" If all the lines have the same warranty return partner return that,
else return an empty recordset
"""
partners = lines.mapped('warranty_return_partner')
@@ -99,9 +80,9 @@ class ClaimMakePicking(models.TransientModel):
(move_field + '.state', '=', 'cancel')]
lines = lines.search(domain)
if not lines:
raise exceptions.Warning(
_('Error'),
_('A picking has already been created for this claim.'))
raise exceptions.UserError(
_('A picking has already been created for this claim.')
)
return lines
delivery_warehouse_id = fields.Many2one(
@@ -142,7 +123,6 @@ class ClaimMakePicking(models.TransientModel):
'state': 'draft',
'date': time.strftime(DT_FORMAT),
'partner_id': partner_id,
'invoice_state': "none",
'company_id': claim.company_id.id,
'location_id': self.claim_line_source_location_id.id,
'location_dest_id': self.claim_line_dest_location_id.id,
@@ -190,21 +170,21 @@ class ClaimMakePicking(models.TransientModel):
common_dest_location = self._get_common_dest_location_from_line(
claim_lines)
if not common_dest_location:
raise exceptions.Warning(
_('Error'),
raise exceptions.UserError(
_('A product return cannot be created for various '
'destination locations, please choose line with a '
'same destination location.'))
'same destination location.')
)
claim_lines.auto_set_warranty()
common_dest_partner = self._get_common_partner_from_line(
claim_lines)
if not common_dest_partner:
raise exceptions.Warning(
_('Error'),
raise exceptions.UserError(
_('A product return cannot be created for various '
'destination addresses, please choose line with a '
'same address.'))
'same address.')
)
partner_id = common_dest_partner.id
# create picking

View File

@@ -5,55 +5,54 @@
Copyright (C) 2011 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="view_claim_picking" model="ir.ui.view">
<field name="name">claim_picking</field>
<field name="model">claim_make_picking.wizard</field>
<field name="arch" type="xml">
<form string="Select exchange lines to add in picking">
<group name="locations" string="Locations">
<field name="delivery_warehouse_id" invisible="context.get('picking_type') != 'out'" required="context.get('picking_type') == 'out'"/>
<field name="claim_line_source_location_id" invisible="context.get('picking_type') == 'out'" required="context.get('picking_type') != 'out'"/>
<field name="claim_line_dest_location_id"/>
</group>
<separator string="Select lines for picking"/>
<field name="claim_line_ids" nolabel="1"/>
<footer>
<button
<odoo>
<record id="view_claim_picking" model="ir.ui.view">
<field name="name">claim_picking</field>
<field name="model">claim_make_picking.wizard</field>
<field name="arch" type="xml">
<form string="Select exchange lines to add in picking">
<group name="locations" string="Locations">
<field name="delivery_warehouse_id" invisible="context.get('picking_type') != 'out'"
required="context.get('picking_type') == 'out'"/>
<field name="claim_line_source_location_id" invisible="context.get('picking_type') == 'out'"
required="context.get('picking_type') != 'out'"/>
<field name="claim_line_dest_location_id"/>
</group>
<separator string="Select lines for picking"/>
<field name="claim_line_ids" nolabel="1"/>
<footer>
<button
string="Create picking"
name="action_create_picking" type="object"
class="oe_highlight"/>
or
<button name="action_cancel"
string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
or
<button name="action_cancel"
string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_claim_picking_in" model="ir.actions.act_window">
<field name="name">Return Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">claim_make_picking.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'picking_type': 'in','product_return': True}</field>
</record>
<record id="action_claim_picking_in" model="ir.actions.act_window">
<field name="name">Return Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">claim_make_picking.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'picking_type': 'in','product_return': True}</field>
</record>
<record id="action_claim_picking_out" model="ir.actions.act_window">
<field name="name">Create Outgoing Shipments</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">claim_make_picking.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'picking_type': 'out'}</field>
</record>
<record id="action_claim_picking_out" model="ir.actions.act_window">
<field name="name">Create Outgoing Shipments</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">claim_make_picking.wizard</field>
<field name="src_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'picking_type': 'out'}</field>
</record>
</data>
</openerp>
</odoo>