mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
Use crm_claim_code
This commit is contained in:
@@ -26,10 +26,3 @@ from . import wizard
|
||||
from . import crm_claim_rma
|
||||
from . import account_invoice
|
||||
from . import stock
|
||||
|
||||
|
||||
def fill_claim_number(cr):
|
||||
cr.execute("""
|
||||
UPDATE crm_claim SET number=id::varchar
|
||||
WHERE number is NULL OR number = '/';
|
||||
""")
|
||||
|
||||
@@ -79,6 +79,7 @@ Contributors:
|
||||
'depends': ['sale',
|
||||
'stock',
|
||||
'crm_claim',
|
||||
'crm_claim_code',
|
||||
'product_warranty',
|
||||
],
|
||||
'data': ['wizard/claim_make_picking_view.xml',
|
||||
@@ -94,7 +95,6 @@ Contributors:
|
||||
'images/return_line.png',
|
||||
'images/exchange.png',
|
||||
],
|
||||
'pre_init_hook': 'fill_claim_number',
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
||||
@@ -402,12 +402,6 @@ class ClaimLine(Model):
|
||||
class CrmClaim(Model):
|
||||
_inherit = 'crm.claim'
|
||||
|
||||
@api.model
|
||||
def _get_sequence_number(self):
|
||||
seq_obj = self.env['ir.sequence']
|
||||
res = seq_obj.get('crm.claim.rma') or '/'
|
||||
return res
|
||||
|
||||
def _get_default_warehouse(self):
|
||||
company_id = self.env.user.company_id.id
|
||||
wh_obj = self.env['stock.warehouse']
|
||||
@@ -421,36 +415,23 @@ class CrmClaim(Model):
|
||||
def name_get(self):
|
||||
res = []
|
||||
for claim in self:
|
||||
number = claim.number and str(claim.number) or ''
|
||||
res.append((claim.id, '[' + number + '] ' + claim.name))
|
||||
code = claim.code and str(claim.code) or ''
|
||||
res.append((claim.id, '[' + code + '] ' + claim.name))
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if ('number' not in vals) or (vals.get('number') == '/'):
|
||||
vals['number'] = self._get_sequence_number()
|
||||
|
||||
claim = super(CrmClaim, self).create(vals)
|
||||
return claim
|
||||
|
||||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
std_default = {
|
||||
'invoice_ids': False,
|
||||
'picking_ids': False,
|
||||
'number': self._get_sequence_number(cr, uid, context),
|
||||
'code': self.env['ir.sequence'].get('crm.claim'),
|
||||
}
|
||||
std_default.update(default)
|
||||
return super(CrmClaim, self).copy_data(cr, uid, id, std_default,
|
||||
context=context)
|
||||
|
||||
number = fields.Char(
|
||||
string='Number', readonly=True,
|
||||
required=True,
|
||||
select=True,
|
||||
default='/',
|
||||
help="Company internal claim unique number")
|
||||
|
||||
claim_type = fields.Selection(
|
||||
[('customer', 'Customer'),
|
||||
('supplier', 'Supplier'),
|
||||
@@ -484,15 +465,6 @@ class CrmClaim(Model):
|
||||
default=_get_default_warehouse,
|
||||
required=True)
|
||||
|
||||
@api.one
|
||||
@api.constrains('number')
|
||||
def _check_unq_number(self):
|
||||
if self.search([
|
||||
('company_id', '=', self.company_id.id),
|
||||
('number', '=', self.number),
|
||||
('id', '!=', self.id)]):
|
||||
raise ValidationError(_('Claim number has to be unique!'))
|
||||
|
||||
@api.onchange('invoice_id', 'warehouse_id', 'claim_type', 'date')
|
||||
def _onchange_invoice_warehouse_type_date(self):
|
||||
context = self.env.context
|
||||
|
||||
@@ -138,9 +138,6 @@
|
||||
<field name="stage_id" position="after">
|
||||
<field name="section_id" />
|
||||
</field>
|
||||
<field name="name" position="before">
|
||||
<field name="number" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -316,12 +313,6 @@
|
||||
<field name="claim_type" context="{'create_lines': False}" />
|
||||
<field name="warehouse_id" context="{'create_lines': False}"/>
|
||||
</field>
|
||||
<field name="name" position="replace">
|
||||
<div class="oe_title">
|
||||
<label for="number" class="oe_edit_only"/>
|
||||
<h1><field name="number"/></h1>
|
||||
</div>
|
||||
</field>
|
||||
<field name="date" position="replace">
|
||||
</field>
|
||||
<field name="user_id" position="before">
|
||||
@@ -389,9 +380,6 @@
|
||||
<field name="model">crm.claim</field>
|
||||
<field name="inherit_id" ref="crm_claim.view_crm_case_claims_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" string="Claims" position="before">
|
||||
<field name="number"/>
|
||||
</field>
|
||||
<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>
|
||||
|
||||
@@ -562,11 +562,6 @@ msgstr ""
|
||||
msgid "Unit sale price of the product. Auto filled if retrun done by invoice selection. Be careful and check the automatic value as don't take into account previous refunds, invoice discount, can be for 0 if product for free,..."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: sql_constraint:crm.claim:0
|
||||
msgid "Number/Reference must be unique per Company!"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: code:addons/crm_claim_rma/crm_claim_rma.py:313
|
||||
#, python-format
|
||||
@@ -625,11 +620,6 @@ msgstr ""
|
||||
msgid "Merchandise Not Received"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: help:crm.claim,number:0
|
||||
msgid "Company internal claim unique number"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.ui.menu,name:crm_claim_rma.menu_crm_case_claims_claim_line_substates
|
||||
msgid "Returned line substates"
|
||||
@@ -652,12 +642,6 @@ msgstr ""
|
||||
msgid "Source Location"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: field:crm.claim,number:0
|
||||
#: model:ir.model.fields,field_description:crm_claim_rma.field_crm_claim_number
|
||||
msgid "Number"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_picking_out
|
||||
msgid "Deliveries"
|
||||
|
||||
@@ -599,11 +599,6 @@ msgstr ""
|
||||
"automático, ya que no tiene en cuenta facturas rectificativas previas, "
|
||||
"descuento de facturas, puede ser 0 si el producto es gratuito, etc..."
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: sql_constraint:crm.claim:0
|
||||
msgid "Number/Reference must be unique per Company!"
|
||||
msgstr "El número/referencia debe ser único por compañía"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: code:addons/crm_claim_rma/crm_claim_rma.py:313
|
||||
#, python-format
|
||||
@@ -662,11 +657,6 @@ msgstr "Tratado"
|
||||
msgid "Merchandise Not Received"
|
||||
msgstr "Mercancía no recibida"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: help:crm.claim,number:0
|
||||
msgid "Company internal claim unique number"
|
||||
msgstr "Número único de reclamación interno en la compañia"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.ui.menu,name:crm_claim_rma.menu_crm_case_claims_claim_line_substates
|
||||
msgid "Returned line substates"
|
||||
@@ -689,12 +679,6 @@ msgstr "Facturas de cliente"
|
||||
msgid "Source Location"
|
||||
msgstr "Localización de origen"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: field:crm.claim,number:0
|
||||
#: model:ir.model.fields,field_description:crm_claim_rma.field_crm_claim_number
|
||||
msgid "Number"
|
||||
msgstr "Número"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_picking_out
|
||||
msgid "Deliveries"
|
||||
|
||||
@@ -592,11 +592,6 @@ msgstr ""
|
||||
"valeurs automatiques récupérée différentes des précédents avoir, réductions "
|
||||
"sur la facture,..."
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: sql_constraint:crm.claim:0
|
||||
msgid "Number/Reference must be unique per Company!"
|
||||
msgstr "La référence doit être unique par société !"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: code:addons/crm_claim_rma/crm_claim_rma.py:313
|
||||
#, python-format
|
||||
@@ -655,11 +650,6 @@ msgstr "Traité"
|
||||
msgid "Merchandise Not Received"
|
||||
msgstr "Marchandise non reçue"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: help:crm.claim,number:0
|
||||
msgid "Company internal claim unique number"
|
||||
msgstr "Numéro unique de réclamation interne à la société"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.ui.menu,name:crm_claim_rma.menu_crm_case_claims_claim_line_substates
|
||||
msgid "Returned line substates"
|
||||
@@ -682,12 +672,6 @@ msgstr "Factures client"
|
||||
msgid "Source Location"
|
||||
msgstr "Emplacement source"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: field:crm.claim,number:0
|
||||
#: model:ir.model.fields,field_description:crm_claim_rma.field_crm_claim_number
|
||||
msgid "Number"
|
||||
msgstr "Numéro"
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_picking_out
|
||||
msgid "Deliveries"
|
||||
|
||||
@@ -581,11 +581,6 @@ msgid ""
|
||||
"free,..."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: sql_constraint:crm.claim:0
|
||||
msgid "Number/Reference must be unique per Company!"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: code:addons/crm_claim_rma/crm_claim_rma.py:313
|
||||
#, python-format
|
||||
@@ -644,11 +639,6 @@ msgstr ""
|
||||
msgid "Merchandise Not Received"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: help:crm.claim,number:0
|
||||
msgid "Company internal claim unique number"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.ui.menu,name:crm_claim_rma.menu_crm_case_claims_claim_line_substates
|
||||
msgid "Returned line substates"
|
||||
@@ -671,12 +661,6 @@ msgstr ""
|
||||
msgid "Source Location"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: field:crm.claim,number:0
|
||||
#: model:ir.model.fields,field_description:crm_claim_rma.field_crm_claim_number
|
||||
msgid "Number"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_claim_rma
|
||||
#: model:ir.actions.act_window,name:crm_claim_rma.act_crm_claim_rma_picking_out
|
||||
msgid "Deliveries"
|
||||
|
||||
@@ -43,7 +43,7 @@ class test_lp_1282584(TransactionCase):
|
||||
self.claim = claim_obj.create(
|
||||
{
|
||||
'name': 'TEST CLAIM',
|
||||
'number': 'TEST CLAIM',
|
||||
'code': 'TEST CLAIM',
|
||||
'claim_type': 'customer',
|
||||
'delivery_address_id': self.partner.id,
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ class ClaimMakePicking(TransientModel):
|
||||
|
||||
# create picking
|
||||
picking = picking_obj.create(
|
||||
{'origin': claim.number,
|
||||
{'origin': claim.code,
|
||||
'picking_type_id': picking_type_id,
|
||||
'move_type': 'one', # direct
|
||||
'state': 'draft',
|
||||
|
||||
Reference in New Issue
Block a user