mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[FIX] Errors and comments
This commit is contained in:
committed by
Maxime Chambreuil
parent
cb8ae2d63e
commit
c6403acabf
@@ -7,11 +7,11 @@
|
||||
|
||||
{
|
||||
'name': 'RMA Claim (Product Return Management)',
|
||||
'version': '9.0.1.0.0',
|
||||
'version': '10.0.1.0.0',
|
||||
'category': 'Generic Modules/CRM & SRM',
|
||||
'author': "Akretion, Camptocamp, Eezee-it, MONK Software, Vauxoo, "
|
||||
"Techspawn Solutions, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"Techspawn Solutions"
|
||||
'website': 'http://www.akretion.com, http://www.camptocamp.com, '
|
||||
'http://www.eezee-it.com, http://www.wearemonk.com, '
|
||||
'http://www.vauxoo.com',
|
||||
@@ -35,7 +35,7 @@
|
||||
"views/claim_line.xml",
|
||||
'views/res_partner.xml',
|
||||
'views/stock_view.xml',
|
||||
#'security/ir.model.access.csv',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo': [],
|
||||
'test': [
|
||||
|
||||
@@ -13,7 +13,7 @@ from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import _, api, exceptions, fields, models
|
||||
from odoo.tools import (DEFAULT_SERVER_DATE_FORMAT,
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
|
||||
from .invoice_no_date import InvoiceNoDate
|
||||
from .product_no_supplier import ProductNoSupplier
|
||||
@@ -66,7 +66,7 @@ class ClaimLine(models.Model):
|
||||
('2_high', 'High'),
|
||||
('3_very_high', 'Very High')],
|
||||
'Priority', default='0_not_define',
|
||||
#compute='_compute_priority',
|
||||
# compute='_compute_priority',
|
||||
store=True,
|
||||
readonly=False,
|
||||
help="Priority attention of claim line")
|
||||
@@ -112,12 +112,12 @@ class ClaimLine(models.Model):
|
||||
warning = fields.Selection(WARRANT_COMMENT,
|
||||
'Warranty', readonly=True,
|
||||
help="If warranty has expired")
|
||||
display_name = fields.Char('Name', compute='_get_display_name')
|
||||
display_name = fields.Char('Name', compute='_compute_display_name')
|
||||
|
||||
@api.model
|
||||
def get_warranty_return_partner(self):
|
||||
return self.env['product.supplierinfo'].warranty_return_partner
|
||||
|
||||
return self.env['product.supplierinfo'].fields_get(
|
||||
'warranty_return_partner')['warranty_return_partner']['selection']
|
||||
|
||||
warranty_type = fields.Selection(
|
||||
get_warranty_return_partner,
|
||||
@@ -127,13 +127,15 @@ class ClaimLine(models.Model):
|
||||
"manufacturer. Does not necessarily mean that the warranty "
|
||||
"to be applied is the one of the return partner (ie: can be "
|
||||
"returned to the company and be under the brand warranty")
|
||||
warranty_return_partner = fields.Many2one('res.partner', string='Warranty Address',
|
||||
help="Where the customer has to "
|
||||
"send back the product(s)")
|
||||
warranty_return_partner = fields.Many2one('res.partner',
|
||||
string='Warranty Address',
|
||||
help="Where the customer has to "
|
||||
"send back the product(s)")
|
||||
claim_id = fields.Many2one('crm.claim', string='Related claim',
|
||||
ondelete='cascade',
|
||||
help="To link to the case.claim object")
|
||||
state = fields.Selection([('draft', 'Draft'), ('refused', 'Refused'),
|
||||
state = fields.Selection([('draft', 'Draft'),
|
||||
('refused', 'Refused'),
|
||||
('confirmed', 'Confirmed, waiting for product'),
|
||||
('in_to_control', 'Received, to control'),
|
||||
('in_to_treate', 'Controlled, to treate'),
|
||||
@@ -402,7 +404,7 @@ class ClaimLine(models.Model):
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def _get_display_name(self):
|
||||
def _compute_display_name(self):
|
||||
for line_id in self:
|
||||
line_id.display_name = "%s - %s" % (
|
||||
line_id.claim_id.code, line_id.name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
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
|
||||
access_claim_line_user,claim.line.user,model_claim_line,base.group_sale_salesman,1,1,1,0
|
||||
access_substate_user_all_leads,substate.substate.user,model_substate_substate,sales_team.group_sale_salesman,1,1,1,0
|
||||
access_claim_line_user_all_leads,claim.line.user,model_claim_line,sales_team.group_sale_salesman,1,1,1,0
|
||||
access_substate_manager,substate.substate.manager,model_substate_substate,sales_team.group_sale_manager,1,1,1,1
|
||||
access_claim_line_manager,claim.line.manager,model_claim_line,sales_team.group_sale_manager,1,1,1,1
|
||||
access_substate_user,substate.substate.user,model_substate_substate,sales_team.group_sale_salesman,1,1,1,0
|
||||
access_claim_line_user,claim.line.user,model_claim_line,sales_team.group_sale_salesman,1,1,1,0
|
||||
|
@@ -1,21 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- INHERITED VIEW FOR THE OBJECT : account_invoice -->
|
||||
|
||||
<!-- 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="priority" eval="16"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<field name='origin' position="after"/>
|
||||
<xpath expr="//button[@name='action_invoice_cancel']" position="replace">
|
||||
<field name="claim_id" attrs="{'invisible':[('type','!=','out_refund')]}"/>
|
||||
<field name='origin' position="after"/>
|
||||
|
||||
<xpath expr="//button[@name='action_invoice_cancel']"
|
||||
position="replace">
|
||||
<field name="claim_id"
|
||||
attrs="{'invisible':[('type','!=','out_refund')]}"/>
|
||||
</xpath>
|
||||
|
||||
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
<menuitem
|
||||
name="Claim lines"
|
||||
id="menu_crm_case_claims_claim_lines"
|
||||
parent="crm_claim.base_menu_aftersale"
|
||||
parent="crm_claim.menu_aftersale"
|
||||
action="act_crm_case_claim_lines"
|
||||
sequence="2"/>
|
||||
</odoo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- CLAIM VIEWS -->
|
||||
<record model="ir.ui.view" id="crm_case_claims_tree_view">
|
||||
<field name="name">CRM - Claims Tree</field>
|
||||
@@ -12,6 +12,7 @@
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Crm claim Search view -->
|
||||
<record id="view_crm_case_claims_filter" model="ir.ui.view">
|
||||
<field name="name">CRM - Claims Search</field>
|
||||
@@ -26,7 +27,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Right side link to orders -->
|
||||
<act_window
|
||||
id="act_crm_claim_rma_sale_orders"
|
||||
@@ -60,7 +60,6 @@
|
||||
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>
|
||||
@@ -92,6 +91,7 @@
|
||||
'claim_id': id,
|
||||
}"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='team_id']/parent::group" position="replace">
|
||||
<group colspan="4" col="4" groups="base.group_user">
|
||||
<field name="warehouse_id"/>
|
||||
@@ -107,9 +107,11 @@
|
||||
<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>
|
||||
@@ -158,6 +160,7 @@
|
||||
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>
|
||||
@@ -225,7 +228,6 @@
|
||||
</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>
|
||||
@@ -253,7 +255,6 @@
|
||||
<xpath expr="//field[@name='date_deadline']" position="after">
|
||||
<field name="rma_number"/>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -277,7 +278,6 @@
|
||||
<field name="rma_number"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
</record>
|
||||
</data>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -73,12 +73,11 @@ class ClaimMakePicking(models.TransientModel):
|
||||
picking_type = self.env.context.get('picking_type')
|
||||
move_field = 'move_in_id' if picking_type == 'in' else 'move_out_id'
|
||||
domain = [('claim_id', '=', self.env.context['active_id'])]
|
||||
lines = self.env['claim.line'].\
|
||||
search(domain)
|
||||
lines = self.env['claim.line'].search(domain)
|
||||
if lines:
|
||||
domain = domain + ['|', (move_field, '=', False),
|
||||
(move_field + '.state', '=', 'cancel')]
|
||||
lines = lines.search(domain)
|
||||
lines = lines.filtered(
|
||||
lambda l: getattr(getattr(l, move_field), 'state') == 'cancel'
|
||||
or not getattr(l, move_field))
|
||||
if not lines:
|
||||
raise exceptions.UserError(
|
||||
_('A picking has already been created for this claim.')
|
||||
@@ -132,7 +131,7 @@ class ClaimMakePicking(models.TransientModel):
|
||||
|
||||
def _get_picking_line_data(self, claim, picking, line):
|
||||
return {
|
||||
'name': line.product_id.name_template,
|
||||
'name': line.product_id.name,
|
||||
'priority': '0',
|
||||
'date': time.strftime(DT_FORMAT),
|
||||
'date_expected': time.strftime(DT_FORMAT),
|
||||
@@ -232,7 +231,7 @@ class ClaimMakePicking(models.TransientModel):
|
||||
|
||||
for line in self.claim_line_ids:
|
||||
procurement = self.env['procurement.order'].create({
|
||||
'name': line.product_id.name_template,
|
||||
'name': line.product_id.name,
|
||||
'group_id': group.id,
|
||||
'origin': claim.code,
|
||||
'warehouse_id': self.delivery_warehouse_id.id,
|
||||
|
||||
Reference in New Issue
Block a user