[[ repeatIn(o.lines,'line') ]]
- [[ len(line.product_id.name) > 39 and line.product_id.name[:39] + '...' or line.product_id.name ]]
-
+ [[ line.product_id.name ]]
[[o.state=='cancel' and o.statement_ids and '-' or '']][['%.f' % line.qty ]]
diff --git a/addons/point_of_sale/wizard/pos_add_product.xml b/addons/point_of_sale/wizard/pos_add_product.xml
index f465f97f097..966a21baa4b 100644
--- a/addons/point_of_sale/wizard/pos_add_product.xml
+++ b/addons/point_of_sale/wizard/pos_add_product.xml
@@ -14,7 +14,7 @@
-
diff --git a/addons/point_of_sale/wizard/pos_close_statement.py b/addons/point_of_sale/wizard/pos_close_statement.py
index 7f2323683a0..ca07180974b 100644
--- a/addons/point_of_sale/wizard/pos_close_statement.py
+++ b/addons/point_of_sale/wizard/pos_close_statement.py
@@ -37,14 +37,26 @@ class pos_close_statement(osv.osv_memory):
@return : Blank Dictionary
"""
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
+ list_statement = []
statement_obj = self.pool.get('account.bank.statement')
journal_obj = self.pool.get('account.journal')
journal_lst = journal_obj.search(cr, uid, [('company_id', '=', company_id), ('auto_cash', '=', True), ('check_dtls', '=', False)])
journal_ids = journal_obj.browse(cr, uid, journal_lst)
for journal in journal_ids:
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])
- statement_obj.button_confirm(cr, uid, ids)
- return {}
+ list_statement = ids
+ statement_obj.button_confirm(cr, uid, ids, context)
+ if not list_statement:
+ return {}
+ return {
+ 'domain': "[('id','in', list_statement)]",
+ 'name': 'Close Statements',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.bank.statement',
+ 'view_id': False,
+ 'type': 'ir.actions.act_window'
+}
pos_close_statement()
diff --git a/addons/point_of_sale/wizard/pos_close_statement.xml b/addons/point_of_sale/wizard/pos_close_statement.xml
index fed3518b706..e46231fa993 100644
--- a/addons/point_of_sale/wizard/pos_close_statement.xml
+++ b/addons/point_of_sale/wizard/pos_close_statement.xml
@@ -9,10 +9,9 @@
form
@@ -37,4 +36,4 @@
new
-
\ No newline at end of file
+
diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py
index 6605f3e46e8..57274c89d74 100644
--- a/addons/point_of_sale/wizard/pos_open_statement.py
+++ b/addons/point_of_sale/wizard/pos_open_statement.py
@@ -37,9 +37,11 @@ class pos_open_statement(osv.osv_memory):
@param context: A standard dictionary
@return : Blank Directory
"""
+ list_statement = []
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
statement_obj = self.pool.get('account.bank.statement')
singer_obj = self.pool.get('singer.statement')
+ sequence_obj = self.pool.get('ir.sequence')
journal_obj = self.pool.get('account.journal')
journal_lst = journal_obj.search(cr, uid, [('company_id', '=', company_id), ('auto_cash', '=', True)])
journal_ids = journal_obj.browse(cr, uid, journal_lst)
@@ -54,7 +56,6 @@ class pos_open_statement(osv.osv_memory):
cr.execute(sql)
st_id = cr.fetchone()
number = ''
- sequence_obj = self.pool.get('ir.sequence')
if journal.statement_sequence_id:
number = sequence_obj.get_id(cr, uid, journal.id)
else:
@@ -74,6 +75,7 @@ class pos_open_statement(osv.osv_memory):
statement_id = cr.fetchone()[0]
if st_id:
statemt_id = statement_obj.browse(cr, uid, st_id[0])
+ list_statement.append(statemt_id.id)
if statemt_id and statemt_id.ending_details_ids:
statement_obj.write(cr, uid, [statement_id], {
'balance_start': statemt_id.balance_end,
@@ -86,7 +88,15 @@ class pos_open_statement(osv.osv_memory):
'number': i.number,
'starting_id': statement_id,
})
- cr.commit()
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str,list_statement))+"])]",
+ 'name': 'Open Statement',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.bank.statement',
+ 'view_id': False, # TODO: REFERENCE RIGHT VIEWS
+ 'type': 'ir.actions.act_window'
+}
return {}
pos_open_statement()
diff --git a/addons/point_of_sale/wizard/pos_open_statement.xml b/addons/point_of_sale/wizard/pos_open_statement.xml
index 9b80a7ec60d..a8956575a36 100644
--- a/addons/point_of_sale/wizard/pos_open_statement.xml
+++ b/addons/point_of_sale/wizard/pos_open_statement.xml
@@ -9,12 +9,11 @@
form
@@ -36,4 +35,4 @@
-
\ No newline at end of file
+
diff --git a/addons/point_of_sale/wizard/pos_receipt_view.xml b/addons/point_of_sale/wizard/pos_receipt_view.xml
index 44b07502f3e..a9796eff886 100644
--- a/addons/point_of_sale/wizard/pos_receipt_view.xml
+++ b/addons/point_of_sale/wizard/pos_receipt_view.xml
@@ -10,6 +10,7 @@
form
+
Products Categories
ir.actions.act_window
diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml
index 764e1277c93..dffeafb47fc 100644
--- a/addons/product/security/product_security.xml
+++ b/addons/product/security/product_security.xml
@@ -11,14 +11,14 @@
- Product multi-company
+ Product multi-company
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
- Product / Variant
+ Useability / Product Variant
diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py
index fd22ecff8b6..ad9b8252d49 100644
--- a/addons/product_expiry/product_expiry.py
+++ b/addons/product_expiry/product_expiry.py
@@ -37,7 +37,6 @@ class stock_production_lot(osv.osv):
result.append((line.id, line.name))
return result
-
def _get_date(dtype):
"""Return a function to compute the limit date for this type"""
def calc_date(self, cr, uid, context=None):
diff --git a/addons/product_expiry/wizard/stock_partial.py b/addons/product_expiry/wizard/stock_partial.py
index 94adaa63452..6af52951613 100644
--- a/addons/product_expiry/wizard/stock_partial.py
+++ b/addons/product_expiry/wizard/stock_partial.py
@@ -26,55 +26,45 @@ from tools.translate import _
import netsvc
import pooler
import time
-import datetime
+import datetime, time
import wizard
-class stock_partial_lot_picking(osv.osv_memory):
- _inherit = "stock.partial.picking"
- _name = "stock.partial.picking"
- _description = "Partial Picking"
-
- def do_partial(self, cr, uid, ids, context):
- res = super(stock_partial_lot_picking, self).do_partial(cr, uid, ids, context=context)
+class stock_production_lot(osv.osv):
+ _inherit = "stock.production.lot"
+ def create(self, cr, uid, vals, context={}):
+ new_id = super(stock_production_lot, self).create(cr, uid, vals, context=context)
prodlot_obj = self.pool.get('stock.production.lot')
- pick_obj = self.pool.get('stock.picking')
- picking_ids = context.get('active_ids', False)
- partial = self.browse(cr, uid, ids[0], context)
- for pick in pick_obj.browse(cr, uid, picking_ids):
- for m in pick.move_lines:
- for pick in pick_obj.browse(cr, uid, picking_ids):
- for m in pick.move_lines:
- res = {}
- if (pick.type == 'in') and m.prodlot_id:
- if not m.prodlot_id.life_date:
- date_life = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.life_time))
- res['life_date'] = date_life.strftime('%Y-%m-%d')
- if not m.prodlot_id.use_date:
- date_use = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.use_time))
- res['use_date'] = date_use.strftime('%Y-%m-%d')
- if not m.prodlot_id.removal_date:
- date_removal = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.removal_time))
- res['removal_date'] = date_removal.strftime('%Y-%m-%d')
- if not m.prodlot_id.alert_date:
- date_alert = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.alert_time))
- res['alert_date'] = date_alert.strftime('%Y-%m-%d')
- prodlot_obj.write(cr, uid, [m.prodlot_id.id], res)
- return res
-stock_partial_lot_picking()
+ prod = prodlot_obj.browse(cr, uid, new_id, context=context)
+ res = {}
+ current_date = time.strftime('%Y-%m-%d %H:%M:%S')
+ if not prod.life_date:
+ date_life = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.life_time))
+ res['life_date'] = date_life.strftime('%Y-%m-%d')
+ if not prod.use_date:
+ date_use = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.use_time))
+ res['use_date'] = date_use.strftime('%Y-%m-%d')
+ if not prod.removal_date:
+ date_removal = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.removal_time))
+ res['removal_date'] = date_removal.strftime('%Y-%m-%d')
+ if not prod.alert_date:
+ date_alert = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.alert_time))
+ res['alert_date'] = date_alert.strftime('%Y-%m-%d')
+ prodlot_obj.write(cr, uid, [prod.id], res)
+ return new_id
+stock_production_lot()
class stock_move_split_lines_exist(osv.osv_memory):
- _name = "stock.move.split.lines.exist"
- _inherit = "stock.move.split.lines.exist"
+ _inherit = "stock.move.split.lines"
_columns = {
'date': fields.date('Expiry Date'),
}
+ # TODO: use this date instead of default one
def on_change_product(self, cr, uid, ids, product_id):
if not product_id:
return {'value':{'date': False}}
day_life = self.pool.get('product.product').browse(cr, uid, product_id).life_time
date_life = (datetime.datetime.now() + datetime.timedelta(days=day_life))
- return {'value':{'date': date_life.strftime('%Y-%m-%d')
-}}
-
-
+ return {'value':
+ {'date': date_life.strftime('%Y-%m-%d')}
+ }
stock_move_split_lines_exist()
diff --git a/addons/product_expiry/wizard/stock_partial_view.xml b/addons/product_expiry/wizard/stock_partial_view.xml
index ca3554ea900..b42ea07ba40 100644
--- a/addons/product_expiry/wizard/stock_partial_view.xml
+++ b/addons/product_expiry/wizard/stock_partial_view.xml
@@ -1,22 +1,22 @@
-
-
+
+
- Split in lots
- stock.move.split
- form
+ Split in lots
+ stock.move.split
+ form
-
-
+
+
-
+
-
-
+
+
diff --git a/addons/product_manufacturer/security/ir.model.access.csv b/addons/product_manufacturer/security/ir.model.access.csv
index 9a65d0355ff..1d3f9af7a2b 100644
--- a/addons/product_manufacturer/security/ir.model.access.csv
+++ b/addons/product_manufacturer/security/ir.model.access.csv
@@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_product_manufacturer_attribute","product.manufacturer.attribute","model_product_manufacturer_attribute","product.group_uos",1,0,0,0
+"access_product_manufacturer_attribute","product.manufacturer.attribute","model_product_manufacturer_attribute",,1,0,0,0
"access_product_manufacturer_attribute_manager","product.manufacturer.attribute","model_product_manufacturer_attribute","product.group_product_manager",1,1,1,1
-"access_partner_manufacturer","res.partner.manufacturer","model_res_partner_manufacturer","product.group_uos",1,0,0,0
-"access_partner_manufacturer_manager","res.partner.manufacturer","model_res_partner_manufacturer","product.group_uos",1,1,1,1
+"access_partner_manufacturer","res.partner.manufacturer","model_res_partner_manufacturer",,1,0,0,0
+"access_partner_manufacturer_manager","res.partner.manufacturer","model_res_partner_manufacturer","product.group_product_manager",1,1,1,1
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 1b31ccc11fd..139082d6d75 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -148,20 +148,22 @@ class purchase_order(osv.osv):
return res
_columns = {
- 'name': fields.char('Order Reference', size=64, required=True, select=True),
- 'origin': fields.char('Source Document', size=64,
+ 'name': fields.char('Order Reference', size=64, required=True, select=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
+ 'origin': fields.char('Source Document', size=64, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
help="Reference of the document that generated this purchase order request."
),
- 'partner_ref': fields.char('Supplier Reference', size=64),
+ 'partner_ref': fields.char('Supplier Reference', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, size=64),
'date_order':fields.date('Date Ordered', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}, help="Date on which this document has been created."),
'date_approve':fields.date('Date Approved', readonly=1),
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
- 'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, states={'posted':[('readonly',True)]}),
- 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', states={'posted':[('readonly',True)]},
+ 'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True,
+ states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
+ 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',
+ states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
help="Put an address if you want to deliver directly from the supplier to the customer." \
"In this case, it will remove the warehouse link and set the customer location."
),
- 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', states={'posted':[('readonly',True)]}),
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')]),
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
'state': fields.selection([('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Waiting Supplier Ack'), ('approved', 'Approved'),('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True),
@@ -180,7 +182,7 @@ class purchase_order(osv.osv):
"From Picking: a draft invoice will be pre-generated based on validated receptions.\n" \
"Manual: no invoice will be pre-generated. The accountant will have to encode manually."
),
- 'minimum_planned_date':fields.function(_minimum_planned_date, fnct_inv=_set_minimum_planned_date, method=True,store=True, string='Expected Date', type='datetime', help="This is computed as the minimum scheduled date of all purchase order lines' products."),
+ 'minimum_planned_date':fields.function(_minimum_planned_date, fnct_inv=_set_minimum_planned_date, method=True,store=True, string='Expected Date', type='date', help="This is computed as the minimum scheduled date of all purchase order lines' products."),
'amount_untaxed': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Purchase Price'), string='Untaxed Amount',
store={
'purchase.order.line': (_get_order, None, 10),
@@ -596,7 +598,7 @@ class purchase_order_line(osv.osv):
_columns = {
'name': fields.char('Description', size=256, required=True),
'product_qty': fields.float('Quantity', required=True, digits=(16,2)),
- 'date_planned': fields.datetime('Scheduled date', required=True),
+ 'date_planned': fields.date('Scheduled date', required=True),
'taxes_id': fields.many2many('account.tax', 'purchase_order_taxe', 'ord_id', 'tax_id', 'Taxes'),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True),
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 814009529e7..4e5bdc8a4ab 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -1,8 +1,6 @@
-
@@ -347,7 +342,7 @@
-->
- Lines To Invoices
+ Purchase Lines not Invoiced
ir.actions.act_window
purchase.order.line
[('state','in',('confirmed','done')), ('invoiced','=',False)]
@@ -367,8 +362,12 @@
-
+
-
-
+
+
Consume Move
stock.move.consume
form
@@ -64,27 +64,27 @@
form
new
-
+
Scrap Move
stock.move.scrap
form
@@ -97,12 +97,12 @@
form
new
-
+
- Split in lots
- stock.move.split
- form
-
+ Split in lots
+ stock.move.split
+ form
+
-
-
-
-
- Split in lots
- ir.actions.act_window
- stock.move.split
- form
- form
- new
-
+
+
+
+
+
+
+
-
-
+
+ Split in lots
+ ir.actions.act_window
+ stock.move.split
+ form
+ form
+ new
+
+
+
+
diff --git a/addons/stock/wizard/stock_partial_move.py b/addons/stock/wizard/stock_partial_move.py
index d9c97a5b885..67dd232c168 100644
--- a/addons/stock/wizard/stock_partial_move.py
+++ b/addons/stock/wizard/stock_partial_move.py
@@ -27,26 +27,26 @@ import pooler
import time
class stock_partial_move(osv.osv_memory):
- _name = "stock.partial.move"
- _description = "Partial Move"
+ _name = "stock.partial.move"
+ _description = "Partial Move"
_columns = {
'date': fields.datetime('Date', required=True),
'partner_id': fields.many2one('res.partner',string="Partner"),
'type': fields.char("Type", size=3),
- 'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered"),
+ 'address_id': fields.many2one('res.partner.address', 'Address', help="Address where goods are to be delivered"),
}
def view_init(self, cr, uid, fields_list, context=None):
res = super(stock_partial_move, self).view_init(cr, uid, fields_list, context=context)
- move_obj = self.pool.get('stock.move')
+ move_obj = self.pool.get('stock.move')
if not context:
context={}
moveids = []
- for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
+ for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if m.state in ('done', 'cancel'):
raise osv.except_osv(_('Invalid action !'), _('Cannot delivery products which are already delivered !'))
-
+
if 'move%s_product_id'%(m.id) not in self._columns:
self._columns['move%s_product_id'%(m.id)] = fields.many2one('product.product',string="Product")
if 'move%s_product_qty'%(m.id) not in self._columns:
@@ -59,59 +59,59 @@ class stock_partial_move(osv.osv_memory):
self._columns['move%s_product_price'%(m.id)] = fields.float("Price")
if 'move%s_product_currency'%(m.id) not in self._columns:
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency',string="Currency")
- return res
+ return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
- result = super(stock_partial_move, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
+ result = super(stock_partial_move, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
move_obj = self.pool.get('stock.move')
- move_ids = context.get('active_ids', False)
+ move_ids = context.get('active_ids', False)
move_ids = move_obj.search(cr, uid, [('id','in',move_ids)])
_moves_arch_lst = """
-
-
-
-
+
+
+
+
- """
+ """
_moves_fields = result['fields']
- if move_ids and view_type in ['form']:
- for m in move_obj.browse(cr, uid, move_ids, context):
+ if move_ids and view_type in ['form']:
+ for m in move_obj.browse(cr, uid, move_ids, context):
if m.state in ('done', 'cancel'):
continue
_moves_fields.update({
'move%s_product_id'%(m.id) : {
'string': _('Product'),
- 'type' : 'many2one',
- 'relation': 'product.product',
- 'required' : True,
- 'readonly' : True,
+ 'type' : 'many2one',
+ 'relation': 'product.product',
+ 'required' : True,
+ 'readonly' : True,
},
'move%s_product_qty'%(m.id) : {
'string': _('Quantity'),
'type' : 'float',
- 'required': True,
+ 'required': True,
},
'move%s_product_uom'%(m.id) : {
'string': _('Product UOM'),
- 'type' : 'many2one',
- 'relation': 'product.uom',
- 'required' : True,
- 'readonly' : True,
+ 'type' : 'many2one',
+ 'relation': 'product.uom',
+ 'required' : True,
+ 'readonly' : True,
}
- })
-
+ })
+
_moves_arch_lst += """
"""%(m.id, m.id, m.id)
- if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
+ if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
_moves_fields.update({
'move%s_product_price'%(m.id) : {
'string': _('Price'),
@@ -119,9 +119,9 @@ class stock_partial_move(osv.osv_memory):
},
'move%s_product_currency'%(m.id): {
'string': _('Currency'),
- 'type' : 'float',
- 'type' : 'many2one',
- 'relation': 'res.currency',
+ 'type' : 'float',
+ 'type' : 'many2one',
+ 'relation': 'res.currency',
}
})
_moves_arch_lst += """
@@ -135,14 +135,14 @@ class stock_partial_move(osv.osv_memory):
-
-
-
+
+
+
"""
result['arch'] = _moves_arch_lst
- result['fields'] = _moves_fields
+ result['fields'] = _moves_fields
return result
def default_get(self, cr, uid, fields, context=None):
@@ -150,13 +150,13 @@ class stock_partial_move(osv.osv_memory):
@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.
+ """
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
- move_obj = self.pool.get('stock.move')
+ move_obj = self.pool.get('stock.move')
if not context:
context={}
moveids = address_delivery = address_default = []
@@ -164,7 +164,7 @@ class stock_partial_move(osv.osv_memory):
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
move_ids = context.get('active_ids', [])
move_ids = move_obj.search(cr, uid, [('id','in',move_ids)])
- for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
+ for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if m.state in ('done', 'cancel'):
continue
res['type'] = m.picking_id and m.picking_id.type or ''
@@ -173,7 +173,7 @@ class stock_partial_move(osv.osv_memory):
if len(address_ids1) == 1:
if m.picking_id and m.picking_id.type=='out':
res['address_id'] = address_ids[0][0] or False
- res['partner_id'] = address_ids[0][1] or False
+ res['partner_id'] = address_ids[0][1] or False
if m.picking_id and m.picking_id.type=='in':
res['partner_id'] = m.company_id.partner_id.id or False
if m.company_id.partner_id:
@@ -199,7 +199,7 @@ class stock_partial_move(osv.osv_memory):
currency = False
if hasattr(m.picking_id, 'sale_id') and m.picking_id.sale_id:
currency = m.picking_id.sale_id.pricelist_id.currency_id.id
-
+
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:
@@ -213,38 +213,38 @@ class stock_partial_move(osv.osv_memory):
currency = False
if hasattr(m.picking_id, 'purchase_id') and m.picking_id.purchase_id:
currency = m.picking_id.purchase_id.pricelist_id.currency_id.id
-
+
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:
res['move%s_product_currency'%(m.id)] = currency
- return res
+ return res
def do_partial(self, cr, uid, ids, context):
""" Makes partial moves and pickings done.
@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.
+ """
+
rec_id = context and context.get('active_id', False)
- tracking_lot = context.get('tracking_lot', False)
- if tracking_lot:
- tracking = self.pool.get('stock.tracking')
- tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
- context ['tracking_lot'] = tracking_lot
- move_obj = self.pool.get('stock.move')
+ #tracking_lot = context.get('tracking_lot', False)
+ #if tracking_lot:
+ # tracking = self.pool.get('stock.tracking')
+ # tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
+ # context ['tracking_lot'] = tracking_lot
+ move_obj = self.pool.get('stock.move')
move_ids = context.get('active_ids', False)
partial = self.browse(cr, uid, ids[0], context)
partial_datas = {
'partner_id' : partial.partner_id and partial.partner_id.id or False,
'address_id' : partial.address_id and partial.address_id.id or False,
- 'delivery_date' : partial.date
+ 'delivery_date' : partial.date
}
- for m in move_obj.browse(cr, uid, move_ids):
+ for m in move_obj.browse(cr, uid, move_ids):
if m.state in ('done', 'cancel'):
continue
partial_datas['move%s'%(m.id)] = {
@@ -253,15 +253,15 @@ class stock_partial_move(osv.osv_memory):
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id
}
- if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
- partial_datas['move%s'%(m.id)].update({
+ if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
+ partial_datas['move%s'%(m.id)].update({
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
- })
+ })
res = move_obj.do_partial(cr, uid, move_ids, partial_datas, context=context)
return {}
-
-stock_partial_move()
+
+stock_partial_move()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py
index 40bffae7654..4083785a8d1 100644
--- a/addons/stock/wizard/stock_partial_picking.py
+++ b/addons/stock/wizard/stock_partial_picking.py
@@ -34,11 +34,11 @@ class stock_partial_picking(osv.osv_memory):
def view_init(self, cr, uid, fields_list, context=None):
res = super(stock_partial_picking, self).view_init(cr, uid, fields_list, context=context)
- pick_obj = self.pool.get('stock.picking')
+ pick_obj = self.pool.get('stock.picking')
if not context:
context={}
moveids = []
- for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
+ for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
for m in pick.move_lines:
if m.state in ('done', 'cancel'):
continue
@@ -54,18 +54,18 @@ class stock_partial_picking(osv.osv_memory):
self._columns['move%s_product_price'%(m.id)] = fields.float("Price")
if 'move%s_product_currency'%(m.id) not in self._columns:
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency',string="Currency")
- return res
+ return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
- result = super(stock_partial_picking, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
+ result = super(stock_partial_picking, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
pick_obj = self.pool.get('stock.picking')
- picking_ids = context.get('active_ids', False)
+ picking_ids = context.get('active_ids', False)
_moves_arch_lst = """
- """
+ """
_moves_fields = result['fields']
if picking_ids and view_type in ['form']:
for pick in pick_obj.browse(cr, uid, picking_ids, context):
@@ -75,32 +75,32 @@ class stock_partial_picking(osv.osv_memory):
_moves_fields.update({
'move%s_product_id'%(m.id) : {
'string': _('Product'),
- 'type' : 'many2one',
- 'relation': 'product.product',
- 'required' : True,
- 'readonly' : True,
+ 'type' : 'many2one',
+ 'relation': 'product.product',
+ 'required' : True,
+ 'readonly' : True,
},
'move%s_product_qty'%(m.id) : {
'string': _('Quantity'),
'type' : 'float',
- 'required': True,
+ 'required': True,
},
'move%s_product_uom'%(m.id) : {
'string': _('Product UOM'),
- 'type' : 'many2one',
- 'relation': 'product.uom',
- 'required' : True,
- 'readonly' : True,
+ 'type' : 'many2one',
+ 'relation': 'product.uom',
+ 'required' : True,
+ 'readonly' : True,
}
- })
-
+ })
+
_moves_arch_lst += """
"""%(m.id, m.id, m.id)
- if (m.product_id.cost_method == 'average'):
+ if (m.product_id.cost_method == 'average'):
_moves_fields.update({
'move%s_product_price'%(m.id) : {
'string': _('Price'),
@@ -108,9 +108,9 @@ class stock_partial_picking(osv.osv_memory):
},
'move%s_product_currency'%(m.id): {
'string': _('Currency'),
- 'type' : 'float',
- 'type' : 'many2one',
- 'relation': 'res.currency',
+ 'type' : 'float',
+ 'type' : 'many2one',
+ 'relation': 'res.currency',
}
})
_moves_arch_lst += """
@@ -124,14 +124,14 @@ class stock_partial_picking(osv.osv_memory):
-
-
-
+
+
+
"""
result['arch'] = _moves_arch_lst
- result['fields'] = _moves_fields
+ result['fields'] = _moves_fields
return result
def default_get(self, cr, uid, fields, context=None):
@@ -139,13 +139,13 @@ class stock_partial_picking(osv.osv_memory):
@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.
+ """
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
- pick_obj = self.pool.get('stock.picking')
+ pick_obj = self.pool.get('stock.picking')
if not context:
context={}
moveids = []
@@ -179,22 +179,22 @@ class stock_partial_picking(osv.osv_memory):
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:
res['move%s_product_currency'%(m.id)] = currency
- return res
+ return res
- def do_partial(self, cr, uid, ids, context):
+ def do_partial(self, cr, uid, ids, context):
""" Makes partial moves and pickings done.
@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.
- """
- pick_obj = self.pool.get('stock.picking')
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+ @return: A dictionary which of fields with values.
+ """
+ pick_obj = self.pool.get('stock.picking')
picking_ids = context.get('active_ids', False)
partial = self.browse(cr, uid, ids[0], context)
partial_datas = {
- 'delivery_date' : partial.date
+ 'delivery_date' : partial.date
}
for pick in pick_obj.browse(cr, uid, picking_ids):
for m in pick.move_lines:
@@ -206,15 +206,15 @@ class stock_partial_picking(osv.osv_memory):
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id
}
- if (m.product_id.cost_method == 'average'):
- partial_datas['move%s'%(m.id)].update({
+ if (m.product_id.cost_method == 'average'):
+ partial_datas['move%s'%(m.id)].update({
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
- })
+ })
res = pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
return {}
-
-stock_partial_picking()
+
+stock_partial_picking()
diff --git a/addons/stock/wizard/stock_splitinto.py b/addons/stock/wizard/stock_splitinto.py
index 9c01f380247..0e27ae6561f 100644
--- a/addons/stock/wizard/stock_splitinto.py
+++ b/addons/stock/wizard/stock_splitinto.py
@@ -26,52 +26,39 @@ from tools.translate import _
class stock_split_into(osv.osv_memory):
_name = "stock.split.into"
_description = "Split into"
-
- def default_get(self, cr, uid, fields, context=None):
- """ Get default values
- @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 default value
- @param context: A standard dictionary
- @return: Default values of fields
- """
- res = super(stock_split_into, self).default_get(cr, uid, fields, context=context)
- move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
- if 'quantity' in fields:
- res.update({'quantity': move.product_qty})
- return res
-
_columns = {
- 'quantity': fields.integer('Quantity'),
+ 'quantity': fields.float('Quantity', digits=(16,2)),
}
_defaults = {
- 'quantity': lambda *x: 1,
+ 'quantity': lambda *x: 0,
}
def split(self, cr, uid, data, context=None):
rec_id = context and context.get('active_ids', False)
move_obj = self.pool.get('stock.move')
- new_move = []
- update_val = {}
- value_to_split = self.browse(cr, uid, data[0], context)
- quantity = value_to_split.quantity or 0.0
- ir_sequence_obj = self.pool.get('ir.sequence')
track_obj = self.pool.get('stock.tracking')
+
+ quantity = self.browse(cr, uid, data[0], context).quantity or 0.0
for move in move_obj.browse(cr, uid, rec_id):
move_qty = move.product_qty
uos_qty_rest = move.product_uos_qty
quantity_rest = move_qty - quantity
if (quantity_rest == 0) or (quantity <= 0) :
continue
- sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.tracking')
- tracking_id = track_obj.create(cr, uid, {'name': sequence}, {'product_id': move.product_id.id})
- uos_qty = quantity / move_qty * move.product_uos_qty
- uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
+ move_obj.setlast_tracking(cr, uid, [move.id], context=context)
+ move_obj.write(cr, uid, [move.id], {
+ 'product_qty': quantity,
+ 'product_uos_qty': quantity,
+ 'product_uos': move.product_uom.id,
+ })
+ quantity_rest = move.product_qty - quantity
+ tracking_id = track_obj.create(cr, uid, {})
default_val = {
'product_qty': quantity_rest,
- 'product_uos_qty': uos_qty,
- 'state': move.state
+ 'product_uos_qty': quantity_rest,
+ 'tracking_id': tracking_id,
+ 'state': move.state,
+ 'product_uos': move.product_uom.id
}
current_move = move_obj.copy(cr, uid, move.id, default_val)
new_move.append(current_move)