Added new module repair_module to manage all products repairs
bzr revid: ruchakpatel@gmail.com-20081013133156-frp4xzt60diwywds
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import repair_module
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
###############################################################################
|
||||
# -*- encoding: utf-8 -*-
|
||||
{
|
||||
"name":"Products Repairs Module",
|
||||
"version":"1.0",
|
||||
"author":"Tiny",
|
||||
"description": """
|
||||
The aim is to have a complete module to manage all products repairs. The following topics
|
||||
should be covered by this module:
|
||||
Add/remove products in the reparation
|
||||
|
||||
Impact for stocks
|
||||
|
||||
Invoicing (products and/or services)
|
||||
|
||||
Warrenty concept
|
||||
|
||||
Repair quotation report
|
||||
|
||||
Notes for the technician and for the final customer
|
||||
|
||||
(Link to Cases) (option)
|
||||
""",
|
||||
|
||||
"category":"Custom",
|
||||
"depends":["sale","account"],
|
||||
"demo_xml":[],
|
||||
"update_xml":["repair_module_view.xml"],
|
||||
"active": False,
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from osv import fields,osv
|
||||
import netsvc
|
||||
|
||||
class mrp_repair(osv.osv):
|
||||
_name = 'mrp.repair'
|
||||
|
||||
_columns = {
|
||||
'product_id': fields.many2one('product.product', string='Product to Repair', required=True ,domain=[('sale_ok','=',True)]),
|
||||
'partner_id' : fields.many2one('res.partner', 'Partner', select=True),
|
||||
'address_id': fields.many2one('res.partner.address', 'Delivery Address', domain="[('partner_id','=',partner_id)]"),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number', select=True, domain="[('product_id','=',product_id)]"),
|
||||
'state': fields.selection([
|
||||
('draft','Quotation'),
|
||||
('confirmed','Confirmed'),
|
||||
('2binvoiced','To be Invoiced'),
|
||||
('done','Done'),
|
||||
('cancel','Cancel')
|
||||
], 'State', readonly=True, help="Gives the state of the Repairs Order"),
|
||||
'location_id': fields.many2one('stock.location', 'Current Location', required=True, select=True),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Delivery Location'),
|
||||
'move_id': fields.many2one('stock.move', 'Move',required=True,domain="[('product_id','=',product_id)]"),#,('prodlot_id','=',prodlot_id)
|
||||
'limit': fields.date('Guarantee limit', readonly=True),
|
||||
'operations' : fields.one2many('repair.operation', 'repair_id', 'Operation Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist'),
|
||||
'partner_invoice_id':fields.many2one('res.partner.address', 'Invoice to', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'invoice_method':fields.selection([
|
||||
("none","No Invoice"),
|
||||
("b4repair","Before Repair"),
|
||||
("after_repair","After Repair")
|
||||
], "Invoice Method",
|
||||
select=True),
|
||||
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
|
||||
'fees_lines' : fields.one2many('sale.order.line', 'order_id', 'Fees Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'internal_notes' : fields.text('Internal Notes'),
|
||||
'quotation_notes' : fields.text('Quotation Notes'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'state': lambda *a: 'draft',
|
||||
}
|
||||
|
||||
mrp_repair()
|
||||
|
||||
|
||||
class repair_operation(osv.osv):
|
||||
_name = 'repair.operation'
|
||||
_description = 'Repair Operation'
|
||||
_columns = {
|
||||
'repair_id': fields.many2one('mrp.repair', 'Repair Order Ref', required=True, ondelete='cascade', select=True),
|
||||
'name': fields.selection([('add','Add'),('remove','Remove')],'Type', required=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)]),
|
||||
'invoice': fields.boolean('Invoice', readonly=True),
|
||||
'price_unit': fields.float('Price', required=True),
|
||||
'product_qty': fields.float('Quantity', digits=(16,2), required=True),
|
||||
'product_uom': fields.many2one('product.uom', 'UoM', required=True),
|
||||
'location_id': fields.many2one('stock.location', 'Source Location', select=True),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', select=True),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Lot Nb.', select=True),
|
||||
}
|
||||
|
||||
repair_operation()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_repair_order_form" model="ir.ui.view">
|
||||
<field name="name">mrp.repair.form</field>
|
||||
<field name="model">mrp.repair</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sales order">
|
||||
<group col="4" colspan="4">
|
||||
<field name="product_id" select="1" />
|
||||
<field name="prodlot_id" select="2"/>
|
||||
<field name="partner_id" select="2"/>
|
||||
<field name="address_id"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Products">
|
||||
<field name="location_id"/>
|
||||
<field name="move_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
<field name="limit"/>
|
||||
<newline/>
|
||||
<separator colspan="4" string="Operations"/>
|
||||
<field colspan="4" mode="tree,form" name="operations" nolabel="1" widget="one2many_list">
|
||||
<form string="Operations">
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" string="Qty"/>
|
||||
<field name="product_uom" string="UoM"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="prodlot_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="invoice"/>
|
||||
</form>
|
||||
<tree string="Operations lines">
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" string="Qty"/>
|
||||
<field name="product_uom" string="UoM"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="prodlot_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="invoice"/>
|
||||
</tree>
|
||||
</field>
|
||||
<newline/>
|
||||
<group col="13" colspan="4">
|
||||
<field name="state" select="2"/>
|
||||
<!--<button name="repair_confirm" states="draft" string="Confirm Repair"/>
|
||||
<button name="cancel" states="confirmed" string="Repair Done"/>
|
||||
<button name="cancel" states="draft,confirmed,2binvoiced" string="Cancel Repair"/>
|
||||
<button name="cancel" states="2binvoiced" string="Make Invoice"/> -->
|
||||
</group>
|
||||
</page>
|
||||
<page string="Invoicing">
|
||||
<field name="pricelist_id"/>
|
||||
<field name="partner_invoice_id"/>
|
||||
<field name="invoice_method"/>
|
||||
<field name="invoice_id"/>
|
||||
<separator colspan="4" string="Fees"/>
|
||||
<field colspan="4" name="fees_lines" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Quality">
|
||||
<separator colspan="4" string="Internal Notes"/>
|
||||
<field colspan="4" name="internal_notes" nolabel="1"/>
|
||||
<separator colspan="4" string="Quotation Notes"/>
|
||||
<field colspan="4" name="quotation_notes" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_repair_order_form" model="ir.actions.act_window">
|
||||
<field name="name">Repair Orders</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.repair</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_repair_order_form" id="menu_repair_order" parent="mrp.menu_mrp_root"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
+3
-33
@@ -320,34 +320,26 @@ class stock_picking(osv.osv):
|
||||
_description = "Packing list"
|
||||
def _set_maximum_date(self, cr, uid, ids, name, value, arg, context):
|
||||
if not value: return False
|
||||
<<<<<<< TREE
|
||||
for pick in self.browse(cr, uid, [ids], context):
|
||||
=======
|
||||
if isinstance(ids, (int, long)):
|
||||
ids=[ids]
|
||||
for pick in self.browse(cr, uid, ids, context):
|
||||
>>>>>>> MERGE-SOURCE
|
||||
cr.execute("""update stock_move set
|
||||
date_planned=%s
|
||||
where
|
||||
picking_id=%d and
|
||||
(date_planned>%s)""", (value,pick.id,value))
|
||||
(date_planned=%s or date_planned>%s)""", (value,pick.id,pick.max_date,value))
|
||||
return True
|
||||
|
||||
def _set_minimum_date(self, cr, uid, ids, name, value, arg, context):
|
||||
if not value: return False
|
||||
<<<<<<< TREE
|
||||
for pick in self.browse(cr, uid,[ids], context):
|
||||
=======
|
||||
if isinstance(ids, (int, long)):
|
||||
ids=[ids]
|
||||
for pick in self.browse(cr, uid, ids, context):
|
||||
>>>>>>> MERGE-SOURCE
|
||||
cr.execute("""update stock_move set
|
||||
date_planned=%s
|
||||
where
|
||||
picking_id=%d and
|
||||
(date_planned<%s)""", (value,pick.id,value))
|
||||
(date_planned=%s or date_planned<%s)""", (value,pick.id,pick.min_date,value))
|
||||
return True
|
||||
|
||||
def get_min_max_date(self, cr, uid, ids, field_name, arg, context={}):
|
||||
@@ -418,17 +410,7 @@ class stock_picking(osv.osv):
|
||||
#def copy(self, cr, uid, id, data=None, context={}):
|
||||
# data = data or {}
|
||||
# return super(stock_picking, self).copy(cr, uid, id, data, context)
|
||||
def unlink(self, cr, uid, ids):
|
||||
pickings = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
for s in pickings:
|
||||
if s['state'] in ['draft','cancel']:
|
||||
unlink_ids.append(s['id'])
|
||||
else:
|
||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Picking(s) which are in %s State!' % s['state']))
|
||||
osv.osv.unlink(self, cr, uid, unlink_ids)
|
||||
return True
|
||||
|
||||
|
||||
def onchange_partner_in(self, cr, uid, context, partner_id=None):
|
||||
sid = self.pool.get('res.partner.address').browse(cr, uid, partner_id, context).partner_id.property_stock_supplier.id
|
||||
return { }
|
||||
@@ -890,7 +872,6 @@ class stock_move(osv.osv):
|
||||
'state': fields.selection([('draft','Draft'),('waiting','Waiting'),('confirmed','Confirmed'),('assigned','Assigned'),('done','Done'),('cancel','cancel')], 'Status', readonly=True, select=True),
|
||||
'price_unit': fields.float('Unit Price',
|
||||
digits=(16, int(config['price_accuracy']))),
|
||||
'partner_id':fields.related('picking_id','address_id',type='many2one',relation='res.partner.address', string='Partner'),
|
||||
}
|
||||
|
||||
_constraints = [
|
||||
@@ -901,17 +882,6 @@ class stock_move(osv.osv):
|
||||
'You try to assign a lot which is not from the same product',
|
||||
['prodlot_id'])]
|
||||
|
||||
# def unlink(self, cr, uid, ids):
|
||||
# moves = self.read(cr, uid, ids, ['state'])
|
||||
# unlink_ids = []
|
||||
# for s in moves:
|
||||
# if s['state'] in ['draft','cancel']:
|
||||
# unlink_ids.append(s['id'])
|
||||
# else:
|
||||
# raise osv.except_osv(_('Invalid action !'), _('Cannot delete Stock Move(s) which are in %s State!' % s['state']))
|
||||
# osv.osv.unlink(self, cr, uid, unlink_ids)
|
||||
# return True
|
||||
|
||||
def _default_location_destination(self, cr, uid, context={}):
|
||||
if context.get('move_line', []):
|
||||
return context['move_line'][0][2]['location_dest_id']
|
||||
|
||||
Reference in New Issue
Block a user