[MERGE]: Merge with lp:~openerp-dev/openobject-addons/ksa-addons2
bzr revid: rpa@tinyerp.com-20110217132643-q29xoiy6f7izcl3e
This commit is contained in:
commit
2fa50661c7
|
@ -38,7 +38,7 @@ class RPCProxyOne(object):
|
|||
self.rpc = xmlrpclib.ServerProxy(local_url)
|
||||
self.ressource = ressource
|
||||
def __getattr__(self, name):
|
||||
return lambda cr, uid, *args, **kwargs: self.rpc.execute(self.server.server_db, self.uid, self.server.password, self.ressource, name, *args, **kwargs)
|
||||
return lambda cr, uid, *args, **kwargs: self.rpc.execute(self.server.server_db, self.uid, self.server.password, self.ressource, name, *args)
|
||||
|
||||
class RPCProxy(object):
|
||||
def __init__(self, server):
|
||||
|
@ -79,6 +79,7 @@ class base_synchro(osv.osv_memory):
|
|||
eval(object.domain),
|
||||
{'action':'d'}
|
||||
)
|
||||
|
||||
if object.action in ('u','b'):
|
||||
ids += pool2.get('base.synchro.obj').get_ids(cr, uid,
|
||||
object.model_id.model,
|
||||
|
@ -102,7 +103,7 @@ class base_synchro(osv.osv_memory):
|
|||
if object.model_id.model=='crm.case.history':
|
||||
fields = ['email','description','log_id']
|
||||
value = pool_src.get(object.model_id.model).read(cr, uid, [id], fields)[0]
|
||||
value = self.data_transform(cr, uid, pool_src, pool_dest, object.model_id.model, value, action)
|
||||
value = self.data_transform(cr, uid, pool_src, pool_dest, object.model_id.model, value, action, context=context)
|
||||
id2 = self.get_id(cr, uid, object.id, id, action, context)
|
||||
#
|
||||
# Transform value
|
||||
|
@ -110,7 +111,6 @@ class base_synchro(osv.osv_memory):
|
|||
#tid=pool_dest.get(object.model_id.model).name_search(cr, uid, value['name'],[],'=',)
|
||||
if not (iii%50):
|
||||
print 'Record', iii
|
||||
|
||||
# Filter fields to not sync
|
||||
for field in object.avoid_ids:
|
||||
if field.name in value:
|
||||
|
@ -133,7 +133,7 @@ class base_synchro(osv.osv_memory):
|
|||
})
|
||||
self.report_total+=1
|
||||
self.report_create+=1
|
||||
self.meta = {}
|
||||
self.meta = {}
|
||||
return True
|
||||
|
||||
def get_id(self, cr, uid, object_id, id, action, context=None):
|
||||
|
@ -216,16 +216,16 @@ class base_synchro(osv.osv_memory):
|
|||
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
|
||||
syn_obj = self.browse(cr, uid, ids, context=context)[0]
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
server = pool.get('base.synchro.server').browse(cr, uid, ids, context=context)[0]
|
||||
server = pool.get('base.synchro.server').browse(cr, uid, syn_obj.server_url.id, context=context)
|
||||
for object in server.obj_ids:
|
||||
dt = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
self.synchronize(cr, uid, server, object, context)
|
||||
self.synchronize(cr, uid, server, object, context=context)
|
||||
if object.action=='b':
|
||||
time.sleep(1)
|
||||
dt = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
self.pool.get('base.synchro.obj').write(cr, uid, [object.id], {'synchronize_date': dt})
|
||||
end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
|
||||
if 'user_id' in syn_obj.user_id:
|
||||
if syn_obj.user_id:
|
||||
request = pooler.get_pool(cr.dbname).get('res.request')
|
||||
if not self.report:
|
||||
self.report.append('No exception.')
|
||||
|
@ -244,7 +244,7 @@ Exceptions:
|
|||
request.create(cr, uid, {
|
||||
'name' : "Synchronization report",
|
||||
'act_from' : uid,
|
||||
'act_to' : syn_obj.user_id,
|
||||
'act_to' : syn_obj.user_id.id,
|
||||
'body': summary,
|
||||
})
|
||||
return True
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<field name="res_model">base.synchro</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_base_synchro"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -406,6 +406,8 @@
|
|||
<field name="date_stop"/>
|
||||
<field name="product_rounding"/>
|
||||
<field name="product_efficiency" groups="base.group_extended"/>
|
||||
<separator string="Properties" colspan="4"/>
|
||||
<newline/>
|
||||
<field colspan="4" name="property_ids" nolabel="2" groups="base.group_extended"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
|
|
@ -245,7 +245,8 @@ class product_pricelist(osv.osv):
|
|||
if sinfo:
|
||||
qty_in_product_uom = qty
|
||||
product_default_uom = product_obj.read(cr, uid, [tmpl_id], ['uom_id'])[0]['uom_id'][0]
|
||||
seller_uom = supplierinfo_obj.read(cr, uid, sinfo, ['product_uom'])[0]['product_uom'][0]
|
||||
supplier = supplierinfo_obj.browse(cr, uid, sinfo, context=context)
|
||||
seller_uom = supplier[0].product_uom and supplier[0].product_uom.id or False
|
||||
if seller_uom and product_default_uom and product_default_uom != seller_uom:
|
||||
uom_price_already_computed = True
|
||||
qty_in_product_uom = product_uom_obj._compute_qty(cr, uid, product_default_uom, qty, to_uom_id=seller_uom)
|
||||
|
|
|
@ -482,7 +482,7 @@ class product_product(osv.osv):
|
|||
'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'),
|
||||
'name_template': fields.related('product_tmpl_id', 'name', string="Name", type='char', size=128, store=True),
|
||||
}
|
||||
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
unlink_ids = []
|
||||
unlink_product_tmpl_ids = []
|
||||
|
@ -715,10 +715,10 @@ class product_supplierinfo(osv.osv):
|
|||
result[supplier_info.id]['qty'] = qty
|
||||
return result
|
||||
|
||||
def _get_uom_id(self, cr, uid, *args):
|
||||
cr.execute('select id from product_uom order by id limit 1')
|
||||
res = cr.fetchone()
|
||||
return res and res[0] or False
|
||||
def _get_uom_id(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
return context.get('uom_id', False)
|
||||
|
||||
_columns = {
|
||||
'name' : fields.many2one('res.partner', 'Supplier', required=True,domain = [('supplier','=',True)], ondelete='cascade', help="Supplier of this product"),
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
|
||||
</page>
|
||||
<page string="Suppliers">
|
||||
<field colspan="4" name="seller_ids" nolabel="1"/>
|
||||
<field colspan="4" name="seller_ids" nolabel="1" context="{'uom_id': uom_id}"/>
|
||||
</page>
|
||||
<page string="Descriptions">
|
||||
<separator string="Description"/>
|
||||
|
|
|
@ -29,65 +29,68 @@ class stock_inventory_line_split(osv.osv_memory):
|
|||
_name = "stock.inventory.line.split"
|
||||
_description = "Split inventory lines"
|
||||
|
||||
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
""" To check the availability of production lot.
|
||||
""" To check the availability of production lot.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
record_id = context and context.get('active_id',False)
|
||||
res = {}
|
||||
line = self.pool.get('stock.inventory.line').browse(cr, uid, record_id, context=context)
|
||||
line = self.pool.get('stock.inventory.line').browse(cr, uid, record_id, context=context)
|
||||
if 'product_id' in fields:
|
||||
res.update({'product_id':line.product_id.id})
|
||||
if 'product_uom' in fields:
|
||||
res.update({'product_uom': line.product_uom.id})
|
||||
if 'qty' in fields:
|
||||
res.update({'qty': line.product_qty})
|
||||
res.update({'qty': line.product_qty})
|
||||
return res
|
||||
|
||||
|
||||
def split(self, cr, uid, ids, line_ids, context=None):
|
||||
""" To split stock inventory lines according to production lot.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: the ID or list of IDs if we want more than one
|
||||
@param ids: the ID or list of IDs if we want more than one
|
||||
@param line_ids: the ID or list of IDs of inventory lines we want to split
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
"""
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
"""
|
||||
prodlot_obj = self.pool.get('stock.production.lot')
|
||||
ir_sequence_obj = self.pool.get('ir.sequence')
|
||||
line_obj = self.pool.get('stock.inventory.line')
|
||||
new_line = []
|
||||
new_line = []
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
for inv_line in line_obj.browse(cr, uid, line_ids, context=context):
|
||||
line_qty = inv_line.product_qty
|
||||
quantity_rest = inv_line.product_qty
|
||||
new_line = []
|
||||
quantity_rest = inv_line.product_qty
|
||||
new_line = []
|
||||
if data.use_exist:
|
||||
lines = [l for l in data.line_exist_ids if l]
|
||||
else:
|
||||
lines = [l for l in data.line_ids if l]
|
||||
lines = [l for l in data.line_ids if l]
|
||||
for line in lines:
|
||||
quantity = line.quantity
|
||||
if quantity <= 0 or line_qty == 0:
|
||||
continue
|
||||
quantity_rest -= quantity
|
||||
if quantity_rest <= 0:
|
||||
quantity_rest -= quantity
|
||||
if quantity_rest < 0:
|
||||
quantity_rest = quantity
|
||||
break
|
||||
default_val = {
|
||||
'product_qty': quantity,
|
||||
'product_qty': quantity,
|
||||
}
|
||||
current_line = line_obj.copy(cr, uid, inv_line.id, default_val)
|
||||
new_line.append(current_line)
|
||||
if quantity_rest > 0:
|
||||
current_line = line_obj.copy(cr, uid, inv_line.id, default_val)
|
||||
new_line.append(current_line)
|
||||
if quantity_rest == 0:
|
||||
current_line = inv_line.id
|
||||
prodlot_id = False
|
||||
if data.use_exist:
|
||||
prodlot_id = line.prodlot_id.id
|
||||
|
@ -97,13 +100,13 @@ class stock_inventory_line_split(osv.osv_memory):
|
|||
'product_id': inv_line.product_id.id},
|
||||
context=context)
|
||||
line_obj.write(cr, uid, [current_line], {'prod_lot_id': prodlot_id})
|
||||
prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
|
||||
|
||||
prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
|
||||
|
||||
update_val = {}
|
||||
if quantity_rest > 0:
|
||||
update_val['product_qty'] = quantity_rest
|
||||
if quantity_rest > 0:
|
||||
update_val['product_qty'] = quantity_rest
|
||||
line_obj.write(cr, uid, [inv_line.id], update_val)
|
||||
|
||||
|
||||
return new_line
|
||||
stock_inventory_line_split()
|
||||
|
||||
|
|
Loading…
Reference in New Issue