mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
Import fields using a wide scope. Update fields declaration
This commit is contained in:
@@ -23,8 +23,7 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp.models import Model, api, _
|
from openerp.models import Model, api, _
|
||||||
from openerp.fields import (Char, Date, Float, One2many, Many2one, Selection,
|
from openerp import fields
|
||||||
Text)
|
|
||||||
from openerp.tools import (DEFAULT_SERVER_DATE_FORMAT,
|
from openerp.tools import (DEFAULT_SERVER_DATE_FORMAT,
|
||||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||||
from openerp.exceptions import except_orm, Warning, ValidationError
|
from openerp.exceptions import except_orm, Warning, ValidationError
|
||||||
@@ -92,8 +91,8 @@ class ClaimLine(Model):
|
|||||||
result = seller.get_warranty_return_partner()
|
result = seller.get_warranty_return_partner()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
name = Char(string='Description', required=True, default=None)
|
name = fields.Char(string='Description', required=True, default=None)
|
||||||
claim_origine = Selection(
|
claim_origine = fields.Selection(
|
||||||
[('none', 'Not specified'),
|
[('none', 'Not specified'),
|
||||||
('legal', 'Legal retractation'),
|
('legal', 'Legal retractation'),
|
||||||
('cancellation', 'Order cancellation'),
|
('cancellation', 'Order cancellation'),
|
||||||
@@ -105,40 +104,40 @@ class ClaimLine(Model):
|
|||||||
],
|
],
|
||||||
string='Claim Subject', required=True,
|
string='Claim Subject', required=True,
|
||||||
help="To describe the line product problem")
|
help="To describe the line product problem")
|
||||||
claim_descr = Text(
|
claim_descr = fields.Text(
|
||||||
string='Claim description',
|
string='Claim description',
|
||||||
help="More precise description of the problem")
|
help="More precise description of the problem")
|
||||||
product_id = Many2one(
|
product_id = fields.Many2one(
|
||||||
'product.product', string='Product', help="Returned product")
|
'product.product', string='Product', help="Returned product")
|
||||||
product_returned_quantity = Float(
|
product_returned_quantity = Float(
|
||||||
string='Quantity', digits=(12, 2), help="Quantity of product returned")
|
string='Quantity', digits=(12, 2), help="Quantity of product returned")
|
||||||
unit_sale_price = Float(
|
unit_sale_price = fields.Float(
|
||||||
string='Unit sale price', digits=(12, 2),
|
string='Unit sale price', digits=(12, 2),
|
||||||
help="Unit sale price of the product. Auto filled if retrun done "
|
help="Unit sale price of the product. Auto filled if retrun done "
|
||||||
"by invoice selection. Be careful and check the automatic "
|
"by invoice selection. Be careful and check the automatic "
|
||||||
"value as don't take into account previous refunds, invoice "
|
"value as don't take into account previous refunds, invoice "
|
||||||
"discount, can be for 0 if product for free,...")
|
"discount, can be for 0 if product for free,...")
|
||||||
return_value = Float(
|
return_value = fields.Float(
|
||||||
string='Total return', compute='_line_total_amount',
|
string='Total return', compute='_line_total_amount',
|
||||||
help="Quantity returned * Unit sold price",)
|
help="Quantity returned * Unit sold price",)
|
||||||
prodlot_id = Many2one(
|
prodlot_id = fields.Many2one(
|
||||||
'stock.production.lot',
|
'stock.production.lot',
|
||||||
string='Serial/Lot n°', help="The serial/lot of the returned product")
|
string='Serial/Lot n°', help="The serial/lot of the returned product")
|
||||||
applicable_guarantee = Selection(
|
applicable_guarantee = fields.Selection(
|
||||||
[('us', 'Company'),
|
[('us', 'Company'),
|
||||||
('supplier', 'Supplier'),
|
('supplier', 'Supplier'),
|
||||||
('brand', 'Brand manufacturer')],
|
('brand', 'Brand manufacturer')],
|
||||||
string='Warranty type')
|
string='Warranty type')
|
||||||
guarantee_limit = Date(
|
guarantee_limit = fields.Date(
|
||||||
string='Warranty limit',
|
string='Warranty limit',
|
||||||
readonly=True,
|
readonly=True,
|
||||||
help="The warranty limit is computed as: invoice date + warranty "
|
help="The warranty limit is computed as: invoice date + warranty "
|
||||||
"defined on selected product.")
|
"defined on selected product.")
|
||||||
warning = Char(
|
warning = fields.Char(
|
||||||
string='Warranty',
|
string='Warranty',
|
||||||
readonly=True,
|
readonly=True,
|
||||||
help="If warranty has expired")
|
help="If warranty has expired")
|
||||||
warranty_type = Selection(
|
warranty_type = fields.Selection(
|
||||||
get_warranty_return_partner,
|
get_warranty_return_partner,
|
||||||
string='Warranty type',
|
string='Warranty type',
|
||||||
readonly=True,
|
readonly=True,
|
||||||
@@ -148,15 +147,15 @@ class ClaimLine(Model):
|
|||||||
" manufacturer. Does not necessarily mean that the warranty "
|
" manufacturer. Does not necessarily mean that the warranty "
|
||||||
"to be applied is the one of the return partner (ie: can be "
|
"to be applied is the one of the return partner (ie: can be "
|
||||||
"returned to the company and be under the brand warranty")
|
"returned to the company and be under the brand warranty")
|
||||||
warranty_return_partner = Many2one(
|
warranty_return_partner = fields.Many2one(
|
||||||
'res.partner',
|
'res.partner',
|
||||||
string='Warranty Address',
|
string='Warranty Address',
|
||||||
help="Where the customer has to send back the product(s)")
|
help="Where the customer has to send back the product(s)")
|
||||||
claim_id = Many2one(
|
claim_id = fields.Many2one(
|
||||||
'crm.claim',
|
'crm.claim',
|
||||||
string='Related claim',
|
string='Related claim',
|
||||||
help="To link to the case.claim object")
|
help="To link to the case.claim object")
|
||||||
state = Selection(
|
state = fields.Selection(
|
||||||
[('draft', 'Draft'),
|
[('draft', 'Draft'),
|
||||||
('refused', 'Refused'),
|
('refused', 'Refused'),
|
||||||
('confirmed', 'Confirmed, waiting for product'),
|
('confirmed', 'Confirmed, waiting for product'),
|
||||||
@@ -165,33 +164,33 @@ class ClaimLine(Model):
|
|||||||
('treated', 'Treated')],
|
('treated', 'Treated')],
|
||||||
string='State',
|
string='State',
|
||||||
default="draft")
|
default="draft")
|
||||||
substate_id = Many2one(
|
substate_id = fields.Many2one(
|
||||||
'substate.substate',
|
'substate.substate',
|
||||||
string='Sub state',
|
string='Sub state',
|
||||||
help="Select a sub state to precise the standard state. Example 1:"
|
help="Select a sub state to precise the standard state. Example 1:"
|
||||||
" state = refused; substate could be warranty over, not in "
|
" state = refused; substate could be warranty over, not in "
|
||||||
"warranty, no problem,... . Example 2: state = to treate; "
|
"warranty, no problem,... . Example 2: state = to treate; "
|
||||||
"substate could be to refund, to exchange, to repair,...")
|
"substate could be to refund, to exchange, to repair,...")
|
||||||
last_state_change = Date(
|
last_state_change = fields.Date(
|
||||||
string='Last change',
|
string='Last change',
|
||||||
help="To set the last state / substate change")
|
help="To set the last state / substate change")
|
||||||
invoice_line_id = Many2one(
|
invoice_line_id = fields.Many2one(
|
||||||
'account.invoice.line',
|
'account.invoice.line',
|
||||||
string='Invoice Line',
|
string='Invoice Line',
|
||||||
help='The invoice line related to the returned product')
|
help='The invoice line related to the returned product')
|
||||||
refund_line_id = Many2one(
|
refund_line_id = fields.Many2one(
|
||||||
'account.invoice.line',
|
'account.invoice.line',
|
||||||
string='Refund Line',
|
string='Refund Line',
|
||||||
help='The refund line related to the returned product')
|
help='The refund line related to the returned product')
|
||||||
move_in_id = Many2one(
|
move_in_id = fields.Many2one(
|
||||||
'stock.move',
|
'stock.move',
|
||||||
string='Move Line from picking in',
|
string='Move Line from picking in',
|
||||||
help='The move line related to the returned product')
|
help='The move line related to the returned product')
|
||||||
move_out_id = Many2one(
|
move_out_id = fields.Many2one(
|
||||||
'stock.move',
|
'stock.move',
|
||||||
string='Move Line from picking out',
|
string='Move Line from picking out',
|
||||||
help='The move line related to the returned product')
|
help='The move line related to the returned product')
|
||||||
location_dest_id = Many2one(
|
location_dest_id = fields.Many2one(
|
||||||
'stock.location',
|
'stock.location',
|
||||||
string='Return Stock Location',
|
string='Return Stock Location',
|
||||||
help='The return stock location of the returned product')
|
help='The return stock location of the returned product')
|
||||||
@@ -452,13 +451,13 @@ class CrmClaim(Model):
|
|||||||
return super(CrmClaim, self).copy_data(cr, uid, id, std_default,
|
return super(CrmClaim, self).copy_data(cr, uid, id, std_default,
|
||||||
context=context)
|
context=context)
|
||||||
|
|
||||||
number = Char(
|
number = fields.Char(
|
||||||
string='Number', readonly=True,
|
string='Number', readonly=True,
|
||||||
required=True,
|
required=True,
|
||||||
select=True,
|
select=True,
|
||||||
default='/',
|
default='/',
|
||||||
help="Company internal claim unique number")
|
help="Company internal claim unique number")
|
||||||
claim_type = Selection(
|
claim_type = fields.Selection(
|
||||||
[('customer', 'Customer'),
|
[('customer', 'Customer'),
|
||||||
('supplier', 'Supplier'),
|
('supplier', 'Supplier'),
|
||||||
('other', 'Other')],
|
('other', 'Other')],
|
||||||
@@ -467,23 +466,25 @@ class CrmClaim(Model):
|
|||||||
default='customer',
|
default='customer',
|
||||||
help="Customer: from customer to company.\n "
|
help="Customer: from customer to company.\n "
|
||||||
"Supplier: from company to supplier.")
|
"Supplier: from company to supplier.")
|
||||||
claim_line_ids = One2many('claim.line', 'claim_id', string='Return lines')
|
claim_line_ids = fields.One2many('claim.line', 'claim_id',
|
||||||
planned_revenue = Float(string='Expected revenue')
|
string='Return lines')
|
||||||
planned_cost = Float(string='Expected cost')
|
planned_revenue = fields.Float(string='Expected revenue')
|
||||||
real_revenue = Float(string='Real revenue')
|
planned_cost = fields.Float(string='Expected cost')
|
||||||
real_cost = Float(string='Real cost')
|
real_revenue = fields.Float(string='Real revenue')
|
||||||
invoice_ids = One2many('account.invoice', 'claim_id', string='Refunds')
|
real_cost = fields.Float(string='Real cost')
|
||||||
picking_ids = One2many('stock.picking', 'claim_id', string='RMA')
|
invoice_ids = fields.One2many('account.invoice', 'claim_id',
|
||||||
invoice_id = Many2one(
|
string='Refunds')
|
||||||
|
picking_ids = fields.One2many('stock.picking', 'claim_id', string='RMA')
|
||||||
|
invoice_id = fields.Many2one(
|
||||||
'account.invoice',
|
'account.invoice',
|
||||||
string='Invoice',
|
string='Invoice',
|
||||||
help='Related original Customer invoice')
|
help='Related original Customer invoice')
|
||||||
delivery_address_id = Many2one(
|
delivery_address_id = fields.Many2one(
|
||||||
'res.partner',
|
'res.partner',
|
||||||
string='Partner delivery address',
|
string='Partner delivery address',
|
||||||
help="This address will be used to deliver repaired or replacement"
|
help="This address will be used to deliver repaired or replacement"
|
||||||
"products.")
|
"products.")
|
||||||
warehouse_id = Many2one(
|
warehouse_id = fields.Many2one(
|
||||||
'stock.warehouse',
|
'stock.warehouse',
|
||||||
string='Warehouse',
|
string='Warehouse',
|
||||||
default=_get_default_warehouse,
|
default=_get_default_warehouse,
|
||||||
|
|||||||
Reference in New Issue
Block a user