commit
18208eaf1e
|
@ -45,6 +45,7 @@ class mrp_repair(osv.osv):
|
|||
"""
|
||||
res = {}
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
|
||||
for repair in self.browse(cr, uid, ids):
|
||||
res[repair.id] = 0.0
|
||||
for line in repair.operations:
|
||||
|
@ -62,6 +63,7 @@ class mrp_repair(osv.osv):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
#return {}.fromkeys(ids, 0)
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
for repair in self.browse(cr, uid, ids):
|
||||
|
@ -104,6 +106,14 @@ class mrp_repair(osv.osv):
|
|||
res[data.id] = adr_id
|
||||
return res
|
||||
|
||||
def _get_lines(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = {}
|
||||
for line in self.pool.get('mrp.repair.line').browse(cr, uid, ids, context=context):
|
||||
result[line.repair_id.id] = True
|
||||
return result.keys()
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Repair Reference',size=24, required=True),
|
||||
'product_id': fields.many2one('product.product', string='Product to Repair', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -148,9 +158,21 @@ class mrp_repair(osv.osv):
|
|||
'deliver_bool': fields.boolean('Deliver', help="Check this box if you want to manage the delivery once the product is repaired. If cheked, it will create a picking with selected product. Note that you can select the locations in the Info tab, if you have the extended view."),
|
||||
'invoiced': fields.boolean('Invoiced', readonly=True),
|
||||
'repaired': fields.boolean('Repaired', readonly=True),
|
||||
'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
|
||||
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
|
||||
'amount_total': fields.function(_amount_total, method=True, string='Total'),
|
||||
'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount',
|
||||
store={
|
||||
'mrp.repair': (lambda self, cr, uid, ids, c={}: ids, ['operations'], 10),
|
||||
'mrp.repair.line': (_get_lines, ['price_unit', 'price_subtotal', 'product_id', 'tax_id', 'product_uom_qty', 'product_uom'], 10),
|
||||
}),
|
||||
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes',
|
||||
store={
|
||||
'mrp.repair': (lambda self, cr, uid, ids, c={}: ids, ['operations'], 10),
|
||||
'mrp.repair.line': (_get_lines, ['price_unit', 'price_subtotal', 'product_id', 'tax_id', 'product_uom_qty', 'product_uom'], 10),
|
||||
}),
|
||||
'amount_total': fields.function(_amount_total, method=True, string='Total',
|
||||
store={
|
||||
'mrp.repair': (lambda self, cr, uid, ids, c={}: ids, ['operations'], 10),
|
||||
'mrp.repair.line': (_get_lines, ['price_unit', 'price_subtotal', 'product_id', 'tax_id', 'product_uom_qty', 'product_uom'], 10),
|
||||
}),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -174,7 +196,6 @@ class mrp_repair(osv.osv):
|
|||
})
|
||||
return super(mrp_repair, self).copy(cr, uid, id, default, context)
|
||||
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id=None):
|
||||
""" On change of product sets some values.
|
||||
@param product_id: Changed product
|
||||
|
|
|
@ -377,23 +377,23 @@ class product_product(osv.osv):
|
|||
res[product.id] = (res[product.id] or 0.0) * (product.price_margin or 1.0) + product.price_extra
|
||||
return res
|
||||
|
||||
def _get_partner_code_name(self, cr, uid, ids, product_id, partner_id, context={}):
|
||||
product = self.browse(cr, uid, [product_id], context)[0]
|
||||
def _get_partner_code_name(self, cr, uid, ids, product, partner_id, context={}):
|
||||
for supinfo in product.seller_ids:
|
||||
if supinfo.name.id == partner_id:
|
||||
return {'code': supinfo.product_code, 'name': supinfo.product_name, 'variants': ''}
|
||||
return {'code' : product.default_code, 'name' : product.name, 'variants': product.variants}
|
||||
res = {'code': product.default_code, 'name': product.name, 'variants': product.variants}
|
||||
return res
|
||||
|
||||
def _product_code(self, cr, uid, ids, name, arg, context={}):
|
||||
res = {}
|
||||
for p in self.browse(cr, uid, ids, context):
|
||||
res[p.id] = self._get_partner_code_name(cr, uid, [], p.id, context.get('partner_id', None), context)['code']
|
||||
res[p.id] = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context)['code']
|
||||
return res
|
||||
|
||||
def _product_partner_ref(self, cr, uid, ids, name, arg, context={}):
|
||||
res = {}
|
||||
for p in self.browse(cr, uid, ids, context):
|
||||
data = self._get_partner_code_name(cr, uid, [], p.id, context.get('partner_id', None), context)
|
||||
data = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context)
|
||||
if not data['variants']:
|
||||
data['variants'] = p.variants
|
||||
if not data['code']:
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<field name="object_id" search="[('model','=','project.issue')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.resource.type" id="type2">
|
||||
<record model="crm.case.resource.type" id="type3">
|
||||
<field name="name">Version 6.0</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','project.issue')]" model="ir.model"/>
|
||||
|
|
|
@ -164,7 +164,7 @@ class wiki_wiki2(osv.osv):
|
|||
@param uid: the current user’s ID for security checks,
|
||||
@param id: Give wiki page's ID """
|
||||
|
||||
return super(Wiki, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
|
||||
return super(wiki_wiki2, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
|
||||
|
||||
def create_history(self, cr, uid, ids, vals, context=None):
|
||||
history_id = False
|
||||
|
|
Loading…
Reference in New Issue