diff --git a/addons/repair_module/__init__.py b/addons/repair_module/__init__.py new file mode 100644 index 00000000000..4fdb4e50e62 --- /dev/null +++ b/addons/repair_module/__init__.py @@ -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: + diff --git a/addons/repair_module/__terp__.py b/addons/repair_module/__terp__.py new file mode 100644 index 00000000000..b37fee49ac7 --- /dev/null +++ b/addons/repair_module/__terp__.py @@ -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: + diff --git a/addons/repair_module/repair_module.py b/addons/repair_module/repair_module.py new file mode 100644 index 00000000000..65b82051e8a --- /dev/null +++ b/addons/repair_module/repair_module.py @@ -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: diff --git a/addons/repair_module/repair_module_view.xml b/addons/repair_module/repair_module_view.xml new file mode 100644 index 00000000000..2203fbd88aa --- /dev/null +++ b/addons/repair_module/repair_module_view.xml @@ -0,0 +1,86 @@ + + + + + + mrp.repair.form + mrp.repair + form + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + Repair Orders + ir.actions.act_window + mrp.repair + form + form + + + + +
+
diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 8f23a0d27fd..f0c71c1199f 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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']