[IMP] sale useability, fix stock, better uom handling
bzr revid: fp@tinyerp.com-20100626151523-40k3eqmegon0ovqg
This commit is contained in:
parent
e2ff3fb555
commit
7369085786
|
@ -52,7 +52,7 @@ class crm_phonecall(osv.osv, crm_case):
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
('open', 'Todo'),
|
('open', 'Todo'),
|
||||||
('cancel', 'Cancelled'),
|
('cancel', 'Cancelled'),
|
||||||
('done', 'Closed'),
|
('done', 'Done'),
|
||||||
('pending', 'Pending'),
|
('pending', 'Pending'),
|
||||||
], 'State', size=16, readonly=True,
|
], 'State', size=16, readonly=True,
|
||||||
help='The state is set to \'Draft\', when a case is created.\
|
help='The state is set to \'Draft\', when a case is created.\
|
||||||
|
@ -89,7 +89,7 @@ class crm_phonecall(osv.osv, crm_case):
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
|
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
|
||||||
'state': lambda *a: 'draft',
|
'state': lambda *a: 'open',
|
||||||
'user_id': lambda self,cr,uid,ctx: uid,
|
'user_id': lambda self,cr,uid,ctx: uid,
|
||||||
'active': lambda *a: 1,
|
'active': lambda *a: 1,
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
<field name="view_mode">tree,calendar</field>
|
<field name="view_mode">tree,calendar</field>
|
||||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||||
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone1'))+')]'"/>
|
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone1'))+')]'"/>
|
||||||
<field name="context">{'set_editable':True,'default_state':'open'}</field>
|
<field name="context">{'set_editable':True,'default_state':'open','search_default_current':1,'search_default_today':1}</field>
|
||||||
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
<field name="view_mode">tree,calendar</field>
|
<field name="view_mode">tree,calendar</field>
|
||||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||||
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone2'))+')]'"/>
|
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone2'))+')]'"/>
|
||||||
<field name="context">{'default_state':'open'}</field>
|
<field name="context">{'default_state':'open','search_default_current':1}</field>
|
||||||
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
|
@ -245,17 +245,22 @@
|
||||||
<field name="type">search</field>
|
<field name="type">search</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="Search Phonecalls">
|
<search string="Search Phonecalls">
|
||||||
|
<filter icon="terp-go-today" string="Current"
|
||||||
|
name="current"
|
||||||
|
domain="[('state','in', ('draft','open','pending'))]"/>
|
||||||
|
<separator orientation="vertical"/>
|
||||||
<filter icon="terp-go-today" string="Today"
|
<filter icon="terp-go-today" string="Today"
|
||||||
domain="[('date','<', time.strftime('%%Y-%%m-%%d 23:59:59')),\
|
domain="[('date','<', time.strftime('%%Y-%%m-%%d 23:59:59')),\
|
||||||
('date','>=',datetime.strftime('%%Y-%%m-%%d 00:00:00'))]"
|
('date','>=',datetime.strftime('%%Y-%%m-%%d 00:00:00'))]"
|
||||||
|
name="today"
|
||||||
help="Todays's Phonecalls"
|
help="Todays's Phonecalls"
|
||||||
/>
|
/>
|
||||||
<filter icon="terp-go-week"
|
<filter icon="terp-go-week"
|
||||||
string="7 Days"
|
string="7 Days"
|
||||||
help="Phonecalls during last 7 days"
|
help="Phonecalls during last 7 days"
|
||||||
domain="[('date','<', time.strftime('%%Y-%%m-%%d')),\
|
domain="[('date','>=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||||
('date','>=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<separator orientation="vertical"/>
|
<separator orientation="vertical"/>
|
||||||
<field name="name" string="Call Summary"/>
|
<field name="name" string="Call Summary"/>
|
||||||
<field name="partner_id"/>
|
<field name="partner_id"/>
|
||||||
|
|
|
@ -48,35 +48,25 @@ class product_uom(osv.osv):
|
||||||
_name = 'product.uom'
|
_name = 'product.uom'
|
||||||
_description = 'Product Unit of Measure'
|
_description = 'Product Unit of Measure'
|
||||||
|
|
||||||
def _factor(self, cursor, user, ids, name, arg, context):
|
def _factor_inv(self, cursor, user, ids, name, arg, context):
|
||||||
res = {}
|
res = {}
|
||||||
for uom in self.browse(cursor, user, ids, context=context):
|
for uom in self.browse(cursor, user, ids, context=context):
|
||||||
if uom.factor:
|
if uom.factor:
|
||||||
if uom.factor_inv_data:
|
|
||||||
res[uom.id] = uom.factor_inv_data
|
|
||||||
else:
|
|
||||||
res[uom.id] = round(1 / uom.factor, 6)
|
res[uom.id] = round(1 / uom.factor, 6)
|
||||||
else:
|
else:
|
||||||
res[uom.id] = 0.0
|
res[uom.id] = 0.0
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _factor_inv(self, cursor, user, id, name, value, arg, context):
|
def _factor_inv_write(self, cursor, user, id, name, value, arg, context):
|
||||||
ctx = context.copy()
|
|
||||||
if 'read_delta' in ctx:
|
|
||||||
del ctx['read_delta']
|
|
||||||
if value:
|
if value:
|
||||||
data = 0.0
|
|
||||||
if round(1 / round(1/value, 6), 6) != value:
|
|
||||||
data = value
|
|
||||||
self.write(cursor, user, id, {
|
self.write(cursor, user, id, {
|
||||||
'factor': round(1/value, 6),
|
'factor': round(1/value, 6),
|
||||||
'factor_inv_data': data,
|
}, context=context)
|
||||||
}, context=ctx)
|
|
||||||
else:
|
else:
|
||||||
self.write(cursor, user, id, {
|
self.write(cursor, user, id, {
|
||||||
'factor': 0.0,
|
'factor': 0.0,
|
||||||
'factor_inv_data': 0.0,
|
}, context=context)
|
||||||
}, context=ctx)
|
return True
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Name', size=64, required=True, translate=True),
|
'name': fields.char('Name', size=64, required=True, translate=True),
|
||||||
|
@ -85,17 +75,17 @@ class product_uom(osv.osv):
|
||||||
'factor': fields.float('Ratio', digits=(12, 6), required=True,
|
'factor': fields.float('Ratio', digits=(12, 6), required=True,
|
||||||
help='The coefficient for the formula:\n' \
|
help='The coefficient for the formula:\n' \
|
||||||
'1 (base unit) = coeff (this unit). Ratio = 1 / Factor.'),
|
'1 (base unit) = coeff (this unit). Ratio = 1 / Factor.'),
|
||||||
'factor_inv': fields.function(_factor, digits=(12, 6),
|
'factor_inv': fields.function(_factor_inv, digits=(12, 6),
|
||||||
|
fnct_inv=_factor_inv_write,
|
||||||
method=True, string='Factor',
|
method=True, string='Factor',
|
||||||
help='The coefficient for the formula:\n' \
|
help='The coefficient for the formula:\n' \
|
||||||
'coeff (base unit) = 1 (this unit). Factor = 1 / Rate.'),
|
'coeff (base unit) = 1 (this unit). Factor = 1 / Rate.'),
|
||||||
'factor_inv_data': fields.float('Factor', digits=(12, 6)),
|
|
||||||
'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True,
|
'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True,
|
||||||
help="The computed quantity will be a multiple of this value. Use 1.0 for products that can not be split."),
|
help="The computed quantity will be a multiple of this value. Use 1.0 for products that can not be split."),
|
||||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the unit of measure without removing it."),
|
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the unit of measure without removing it."),
|
||||||
'uom_factor': fields.selection([('bigger','Bigger than the Default'),
|
'uom_factor': fields.selection([('bigger','Bigger than the default'),
|
||||||
('smaller','Smaller than the Default'),
|
('smaller','Smaller than the default'),
|
||||||
('','')],'UoM Factor'),
|
('default','The Default unit of measure')],'Type of Unit', required=1),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -103,12 +93,11 @@ class product_uom(osv.osv):
|
||||||
'factor_inv': lambda *a: 1.0,
|
'factor_inv': lambda *a: 1.0,
|
||||||
'active': lambda *a: 1,
|
'active': lambda *a: 1,
|
||||||
'rounding': lambda *a: 0.01,
|
'rounding': lambda *a: 0.01,
|
||||||
'uom_factor': lambda *a: 'smaller',
|
'uom_factor': lambda *a: 'default',
|
||||||
}
|
}
|
||||||
|
|
||||||
_sql_constraints = [
|
_sql_constraints = [
|
||||||
('factor_gt_zero', 'CHECK (factor!=0)', 'Value of the factor can never be 0 !'),
|
('factor_gt_zero', 'CHECK (factor!=0)', 'Value of the factor can never be 0 !'),
|
||||||
('factor_inv_data_gt_zero', 'CHECK (factor_inv_data!=0)', 'Value of the factor_inv_data can never be 0 !'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False):
|
def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False):
|
||||||
|
@ -124,14 +113,8 @@ class product_uom(osv.osv):
|
||||||
def _compute_qty_obj(self, cr, uid, from_unit, qty, to_unit, context={}):
|
def _compute_qty_obj(self, cr, uid, from_unit, qty, to_unit, context={}):
|
||||||
if from_unit.category_id.id <> to_unit.category_id.id:
|
if from_unit.category_id.id <> to_unit.category_id.id:
|
||||||
return qty
|
return qty
|
||||||
if from_unit.factor_inv_data:
|
|
||||||
amount = qty * from_unit.factor_inv_data
|
|
||||||
else:
|
|
||||||
amount = qty / from_unit.factor
|
amount = qty / from_unit.factor
|
||||||
if to_unit:
|
if to_unit:
|
||||||
if to_unit.factor_inv_data:
|
|
||||||
amount = rounding(amount / to_unit.factor_inv_data, to_unit.rounding)
|
|
||||||
else:
|
|
||||||
amount = rounding(amount * to_unit.factor, to_unit.rounding)
|
amount = rounding(amount * to_unit.factor, to_unit.rounding)
|
||||||
return amount
|
return amount
|
||||||
|
|
||||||
|
@ -145,26 +128,15 @@ class product_uom(osv.osv):
|
||||||
from_unit, to_unit = uoms[-1], uoms[0]
|
from_unit, to_unit = uoms[-1], uoms[0]
|
||||||
if from_unit.category_id.id <> to_unit.category_id.id:
|
if from_unit.category_id.id <> to_unit.category_id.id:
|
||||||
return price
|
return price
|
||||||
if from_unit.factor_inv_data:
|
|
||||||
amount = price / from_unit.factor_inv_data
|
|
||||||
else:
|
|
||||||
amount = price * from_unit.factor
|
amount = price * from_unit.factor
|
||||||
if to_uom_id:
|
if to_uom_id:
|
||||||
if to_unit.factor_inv_data:
|
|
||||||
amount = amount * to_unit.factor_inv_data
|
|
||||||
else:
|
|
||||||
amount = amount / to_unit.factor
|
amount = amount / to_unit.factor
|
||||||
return amount
|
return amount
|
||||||
|
|
||||||
def onchange_factor_inv(self, cursor, user, ids, value):
|
|
||||||
if value == 0.0:
|
|
||||||
return {'value': {'factor': 0}}
|
|
||||||
return {'value': {'factor': round(1/value, 6)}}
|
|
||||||
|
|
||||||
def onchange_factor(self, cursor, user, ids, value):
|
def onchange_factor(self, cursor, user, ids, value):
|
||||||
if value == 0.0:
|
if value == 'default':
|
||||||
return {'value': {'factor_inv': 0}}
|
return {'value': {'factor': 1, 'factor_inv': 1}}
|
||||||
return {'value': {'factor_inv': round(1/value, 6)}}
|
return {}
|
||||||
|
|
||||||
product_uom()
|
product_uom()
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<record id="product_uom_kgm" model="product.uom">
|
<record id="product_uom_kgm" model="product.uom">
|
||||||
<field name="category_id" ref="product_uom_categ_kgm"/>
|
<field name="category_id" ref="product_uom_categ_kgm"/>
|
||||||
<field name="name">KGM</field>
|
<field name="name">KGM</field>
|
||||||
<field name="factor">1000.0</field>
|
<field name="factor">1</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="uom_hour" model="product.uom">
|
<record id="uom_hour" model="product.uom">
|
||||||
<field name="name">Hour</field>
|
<field name="name">Hour</field>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<record id="product_uom_ton" model="product.uom">
|
<record id="product_uom_ton" model="product.uom">
|
||||||
<field name="category_id" ref="product_uom_categ_kgm"/>
|
<field name="category_id" ref="product_uom_categ_kgm"/>
|
||||||
<field name="name">TON</field>
|
<field name="name">TON</field>
|
||||||
<field name="factor">1.0</field>
|
<field name="factor">0.001</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="product_uom_meter" model="product.uom">
|
<record id="product_uom_meter" model="product.uom">
|
||||||
<field name="category_id" ref="uom_categ_length"/>
|
<field name="category_id" ref="uom_categ_length"/>
|
||||||
|
|
|
@ -298,7 +298,6 @@
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="category_id"/>
|
<field name="category_id"/>
|
||||||
<field name="factor"/>
|
<field name="factor"/>
|
||||||
<field name="factor_inv"/>
|
|
||||||
<field name="rounding"/>
|
<field name="rounding"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
@ -310,14 +309,18 @@
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Units of Measure">
|
<form string="Units of Measure">
|
||||||
|
<group col="6" colspan="4">
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="category_id" select="1"/>
|
<field name="category_id" select="1"/>
|
||||||
<field name="factor" select="1" attrs="{'readonly':[('uom_factor','=','bigger')]}"/>
|
|
||||||
<field name="factor_inv_data" select="1" string="Factor Data" attrs="{'readonly':[('uom_factor','=','smaller')]}"/>
|
|
||||||
<field name="factor_inv" invisible="1"/>
|
|
||||||
<field name="rounding"/>
|
|
||||||
<field name="uom_factor"/>
|
|
||||||
<field name="active"/>
|
<field name="active"/>
|
||||||
|
<field name="uom_factor" on_change="onchange_factor(uom_factor)"/>
|
||||||
|
<group colspan="2" col="2">
|
||||||
|
<field name="factor" select="1" attrs="{'invisible':[('uom_factor','<>','smaller')]}"/>
|
||||||
|
<field name="factor_inv" select="1" string="Factor Data" attrs="{'invisible':[('uom_factor','<>','bigger')]}"/>
|
||||||
|
</group>
|
||||||
|
<newline/>
|
||||||
|
<field name="rounding"/>
|
||||||
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -97,6 +97,7 @@ class sale_order(osv.osv):
|
||||||
res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']
|
res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
# This is False
|
||||||
def _picked_rate(self, cr, uid, ids, name, arg, context=None):
|
def _picked_rate(self, cr, uid, ids, name, arg, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
@ -1021,6 +1022,7 @@ class sale_order_line(osv.osv):
|
||||||
}
|
}
|
||||||
result['product_uom_qty'] = qty
|
result['product_uom_qty'] = qty
|
||||||
|
|
||||||
|
uom2 = False
|
||||||
if uom:
|
if uom:
|
||||||
uom2 = product_uom_obj.browse(cr, uid, uom)
|
uom2 = product_uom_obj.browse(cr, uid, uom)
|
||||||
if product_obj.uom_id.category_id.id != uom2.category_id.id:
|
if product_obj.uom_id.category_id.id != uom2.category_id.id:
|
||||||
|
@ -1076,6 +1078,19 @@ class sale_order_line(osv.osv):
|
||||||
result['product_uos_qty'] = qty
|
result['product_uos_qty'] = qty
|
||||||
result['th_weight'] = q * product_obj.weight # Round the quantity up
|
result['th_weight'] = q * product_obj.weight # Round the quantity up
|
||||||
|
|
||||||
|
if not uom2:
|
||||||
|
uom2 = product_obj.uom_id
|
||||||
|
if (product_obj.type=='product') and (product_obj.virtual_available * product_obj.uom_id.factor < qty * uom2.factor) \
|
||||||
|
and (product_obj.procure_method=='make_to_stock'):
|
||||||
|
warning = {
|
||||||
|
'title': _('Not enough stock !'),
|
||||||
|
'message': _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') %
|
||||||
|
(qty, uom2 and uom2.name or product_obj.uom_id.name,
|
||||||
|
max(0,product_obj.virtual_available), product_obj.uom_id.name,
|
||||||
|
max(0,product_obj.qty_available), product_obj.uom_id.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# get unit price
|
# get unit price
|
||||||
|
|
||||||
if not pricelist:
|
if not pricelist:
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
<field colspan="4"
|
<field colspan="4"
|
||||||
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
|
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
|
||||||
name="product_id"
|
name="product_id"
|
||||||
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, parent.date_order, product_packaging, parent.fiscal_position)"
|
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, parent.date_order, product_packaging, parent.fiscal_position, False)"
|
||||||
/>
|
/>
|
||||||
<field
|
<field
|
||||||
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
|
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
<field
|
<field
|
||||||
name="product_packaging"
|
name="product_packaging"
|
||||||
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
|
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
|
||||||
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position)"
|
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position, False)"
|
||||||
domain="[('product_id','=',product_id)]"
|
domain="[('product_id','=',product_id)]"
|
||||||
groups="base.group_extended"/>
|
groups="base.group_extended"/>
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ stock_location()
|
||||||
|
|
||||||
class stock_tracking(osv.osv):
|
class stock_tracking(osv.osv):
|
||||||
_name = "stock.tracking"
|
_name = "stock.tracking"
|
||||||
_description = "Stock Tracking Lots"
|
_description = "Packs"
|
||||||
|
|
||||||
def checksum(sscc):
|
def checksum(sscc):
|
||||||
salt = '31' * 8 + '3'
|
salt = '31' * 8 + '3'
|
||||||
|
@ -424,7 +424,7 @@ class stock_tracking(osv.osv):
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Tracking ID', size=64, required=True),
|
'name': fields.char('Tracking ID', size=64, required=True),
|
||||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the tracking lots without removing it."),
|
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the pack without removing it."),
|
||||||
'serial': fields.char('Reference', size=64),
|
'serial': fields.char('Reference', size=64),
|
||||||
'move_ids': fields.one2many('stock.move', 'tracking_id', 'Moves Tracked'),
|
'move_ids': fields.one2many('stock.move', 'tracking_id', 'Moves Tracked'),
|
||||||
'date': fields.datetime('Created Date', required=True),
|
'date': fields.datetime('Created Date', required=True),
|
||||||
|
@ -1308,7 +1308,7 @@ class stock_move(osv.osv):
|
||||||
return (res and res[0]) or False
|
return (res and res[0]) or False
|
||||||
_name = "stock.move"
|
_name = "stock.move"
|
||||||
_description = "Stock Move"
|
_description = "Stock Move"
|
||||||
_order = 'date_planned desc'
|
_order = 'date_expected desc, id'
|
||||||
_log_create = False
|
_log_create = False
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context={}):
|
def name_get(self, cr, uid, ids, context={}):
|
||||||
|
@ -1362,7 +1362,7 @@ class stock_move(osv.osv):
|
||||||
'address_id': fields.many2one('res.partner.address', 'Dest. Address', help="Address where goods are to be delivered"),
|
'address_id': fields.many2one('res.partner.address', 'Dest. Address', help="Address where goods are to be delivered"),
|
||||||
|
|
||||||
'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', help="Production lot is used to put a serial number on the production"),
|
'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', help="Production lot is used to put a serial number on the production"),
|
||||||
'tracking_id': fields.many2one('stock.tracking', 'Tracking Lot', select=True, help="Tracking lot is the code that will be put on the logistical unit/pallet"),
|
'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, help="This is the code that will be put on the logistical unit: pallet, box, pack."),
|
||||||
# 'lot_id': fields.many2one('stock.lot', 'Consumer lot', select=True, readonly=True),
|
# 'lot_id': fields.many2one('stock.lot', 'Consumer lot', select=True, readonly=True),
|
||||||
|
|
||||||
'auto_validate': fields.boolean('Auto Validate'),
|
'auto_validate': fields.boolean('Auto Validate'),
|
||||||
|
|
|
@ -61,11 +61,11 @@
|
||||||
Sequences from tracking numbers
|
Sequences from tracking numbers
|
||||||
-->
|
-->
|
||||||
<record id="sequence_type_serial" model="ir.sequence.type">
|
<record id="sequence_type_serial" model="ir.sequence.type">
|
||||||
<field name="name">Stock Production Lots</field>
|
<field name="name">Production Lots</field>
|
||||||
<field name="code">stock.lot.serial</field>
|
<field name="code">stock.lot.serial</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="sequence_production_lots" model="ir.sequence">
|
<record id="sequence_production_lots" model="ir.sequence">
|
||||||
<field name="name">Stock Production Lots</field>
|
<field name="name">Production Lots</field>
|
||||||
<field name="code">stock.lot.serial</field>
|
<field name="code">stock.lot.serial</field>
|
||||||
<field name="prefix"></field>
|
<field name="prefix"></field>
|
||||||
<field name="padding">7</field>
|
<field name="padding">7</field>
|
||||||
|
@ -74,12 +74,12 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="sequence_type_tracking" model="ir.sequence.type">
|
<record id="sequence_type_tracking" model="ir.sequence.type">
|
||||||
<field name="name">Stock Tracking Lots</field>
|
<field name="name">Packs</field>
|
||||||
<field name="code">stock.lot.tracking</field>
|
<field name="code">stock.lot.tracking</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="sequence_tracking" model="ir.sequence">
|
<record id="sequence_tracking" model="ir.sequence">
|
||||||
<field name="name">Stock Tracking Lots</field>
|
<field name="name">Packs</field>
|
||||||
<field name="code">stock.lot.tracking</field>
|
<field name="code">stock.lot.tracking</field>
|
||||||
<field name="prefix"></field>
|
<field name="prefix"></field>
|
||||||
<field name="padding">7</field>
|
<field name="padding">7</field>
|
||||||
|
|
|
@ -154,7 +154,7 @@
|
||||||
<field name="model">stock.tracking</field>
|
<field name="model">stock.tracking</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Tracking/Serial">
|
<form string="Packs">
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="serial" select="1"/>
|
<field name="serial" select="1"/>
|
||||||
<field name="date" select="1"/>
|
<field name="date" select="1"/>
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
<field name="model">stock.tracking</field>
|
<field name="model">stock.tracking</field>
|
||||||
<field name="type">tree</field>
|
<field name="type">tree</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Tracking/Serial">
|
<tree string="Packs">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="serial"/>
|
<field name="serial"/>
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="action_tracking_form" model="ir.actions.act_window">
|
<record id="action_tracking_form" model="ir.actions.act_window">
|
||||||
<field name="name">Tracking Lots</field>
|
<field name="name">Packs</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">stock.tracking</field>
|
<field name="res_model">stock.tracking</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
<field name="type">tree</field>
|
<field name="type">tree</field>
|
||||||
<field name="field_parent">child_ids</field>
|
<field name="field_parent">child_ids</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree colors="grey:not active" string="Tracking Number">
|
<tree colors="grey:not active" string="Packs">
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="serial" />
|
<field name="serial" />
|
||||||
<field name="date" />
|
<field name="date" />
|
||||||
|
@ -637,15 +637,14 @@
|
||||||
type="action" icon="terp-stock_effects-object-colorize"
|
type="action" icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,waiting,confirmed,assigned" />
|
states="draft,waiting,confirmed,assigned" />
|
||||||
<field groups="base.group_extended" name="tracking_id"/>
|
<field groups="base.group_extended" name="tracking_id"/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||||
groups="base.group_extended"
|
|
||||||
icon="terp-stock_effects-object-colorize"
|
icon="terp-stock_effects-object-colorize"
|
||||||
|
groups="base.group_extended"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
|
||||||
icon="terp-stock_effects-object-colorize"
|
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<field name="location_id"/>
|
<field name="location_id"/>
|
||||||
<field name="location_dest_id"/>
|
<field name="location_dest_id"/>
|
||||||
|
@ -688,9 +687,8 @@
|
||||||
states="draft,waiting,confirmed,assigned"
|
states="draft,waiting,confirmed,assigned"
|
||||||
type="action" icon="terp-stock_effects-object-colorize"
|
type="action" icon="terp-stock_effects-object-colorize"
|
||||||
groups="base.group_extended" />
|
groups="base.group_extended" />
|
||||||
<button name="%(move_scrap)d" string="Scrap Move Line" type="action" icon="gtk-justify-fill"/>
|
<button name="%(move_scrap)d" string="Scrap" type="action" icon="gtk-justify-fill"/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
|
||||||
states="draft,assigned,confirmed,done"
|
states="draft,assigned,confirmed,done"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize" />
|
icon="terp-stock_effects-object-colorize" />
|
||||||
|
@ -804,15 +802,15 @@
|
||||||
<field name="picking_id" />
|
<field name="picking_id" />
|
||||||
<field name="prodlot_id" groups="base.group_extended"/>
|
<field name="prodlot_id" groups="base.group_extended"/>
|
||||||
<field groups="base.group_extended" name="tracking_id"/>
|
<field groups="base.group_extended" name="tracking_id"/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
|
||||||
states="draft,assigned,confirmed,done"
|
|
||||||
groups="base.group_extended"/>
|
|
||||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
|
icon="terp-stock_effects-object-colorize"
|
||||||
|
states="draft,assigned,confirmed,done"
|
||||||
|
groups="base.group_extended"/>
|
||||||
<field name="location_id"/>
|
<field name="location_id"/>
|
||||||
<field name="location_dest_id"/>
|
<field name="location_dest_id"/>
|
||||||
<field name="date_planned"/>
|
<field name="date_planned"/>
|
||||||
|
@ -859,8 +857,7 @@
|
||||||
states="draft,waiting,confirmed,assigned"
|
states="draft,waiting,confirmed,assigned"
|
||||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||||
<label/>
|
<label/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
|
@ -1014,15 +1011,14 @@
|
||||||
states="draft,assigned,confirmed,done"
|
states="draft,assigned,confirmed,done"
|
||||||
groups="base.group_extended"/>
|
groups="base.group_extended"/>
|
||||||
<field name="tracking_id" groups="base.group_extended"/>
|
<field name="tracking_id" groups="base.group_extended"/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||||
icon="terp-stock_effects-object-colorize"
|
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
|
||||||
groups="base.group_extended"
|
|
||||||
icon="terp-stock_effects-object-colorize"
|
icon="terp-stock_effects-object-colorize"
|
||||||
|
groups="base.group_extended"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<field name="location_id"/>
|
<field name="location_id"/>
|
||||||
<field name="date_planned"/>
|
<field name="date_planned"/>
|
||||||
|
@ -1059,8 +1055,7 @@
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
/>
|
/>
|
||||||
<label/>
|
<label/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
|
@ -1082,7 +1077,7 @@
|
||||||
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-yes"/>
|
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-yes"/>
|
||||||
<button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-apply"/>
|
<button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-apply"/>
|
||||||
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
|
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
|
||||||
<button name="%(action_partial_picking)d" states="assigned" string="Picking Done" type="action" icon="gtk-execute"/>
|
<button name="%(action_partial_picking)d" states="assigned" string="Done" type="action" icon="gtk-execute"/>
|
||||||
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
|
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
|
@ -1215,13 +1210,13 @@
|
||||||
type="action" icon="terp-stock_effects-object-colorize"
|
type="action" icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,waiting,confirmed,assigned" />
|
states="draft,waiting,confirmed,assigned" />
|
||||||
<field name="tracking_id" groups="base.group_extended"/>
|
<field name="tracking_id" groups="base.group_extended"/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button name="%(stock.move_scrap)d"
|
<button name="%(stock.move_scrap)d"
|
||||||
|
@ -1409,13 +1404,13 @@
|
||||||
states="draft,waiting,confirmed,assigned"
|
states="draft,waiting,confirmed,assigned"
|
||||||
groups="base.group_extended"/>
|
groups="base.group_extended"/>
|
||||||
<field groups="base.group_extended" name="tracking_id"/>
|
<field groups="base.group_extended" name="tracking_id"/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<field name="location_id"/>
|
<field name="location_id"/>
|
||||||
<field name="location_dest_id"/>
|
<field name="location_dest_id"/>
|
||||||
|
@ -1480,9 +1475,9 @@
|
||||||
states="draft,waiting,confirmed,assigned"
|
states="draft,waiting,confirmed,assigned"
|
||||||
string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" colspan="2" />
|
string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" colspan="2" />
|
||||||
<label/>
|
<label/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
@ -1573,15 +1568,15 @@
|
||||||
context="{'default_use_exist': picking_id.type=='in'}"
|
context="{'default_use_exist': picking_id.type=='in'}"
|
||||||
groups="base.group_extended"/>
|
groups="base.group_extended"/>
|
||||||
<field name="tracking_id" groups="base.group_extended"/>
|
<field name="tracking_id" groups="base.group_extended"/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||||
groups="base.group_extended"
|
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
|
||||||
states="draft,assigned,confirmed,done"/>
|
|
||||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
|
||||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
|
groups="base.group_extended"
|
||||||
|
icon="terp-stock_effects-object-colorize"
|
||||||
|
states="draft,assigned,confirmed,done"/>
|
||||||
<field name="date_planned"/>
|
<field name="date_planned"/>
|
||||||
<field name="backorder_id" groups="base.group_extended"/>
|
<field name="backorder_id" groups="base.group_extended"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
|
@ -1629,9 +1624,9 @@
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||||
<label/>
|
<label/>
|
||||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||||
groups="base.group_extended"
|
groups="base.group_extended"
|
||||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
icon="terp-stock_effects-object-colorize"
|
||||||
states="draft,assigned,confirmed,done"/>
|
states="draft,assigned,confirmed,done"/>
|
||||||
<label/>
|
<label/>
|
||||||
<button name="%(track_line)d" string="Split in production lots"
|
<button name="%(track_line)d" string="Split in production lots"
|
||||||
|
|
|
@ -193,7 +193,7 @@ class split_in_production_lot(osv.osv_memory):
|
||||||
'product_uom': fields.many2one('product.uom', 'Product UOM'),
|
'product_uom': fields.many2one('product.uom', 'Product UOM'),
|
||||||
'line_ids': fields.one2many('stock.move.split.lines', 'lot_id', 'Lots Number'),
|
'line_ids': fields.one2many('stock.move.split.lines', 'lot_id', 'Lots Number'),
|
||||||
'line_exist_ids': fields.one2many('stock.move.split.lines.exist', 'lot_id', 'Lots Existing Numbers'),
|
'line_exist_ids': fields.one2many('stock.move.split.lines.exist', 'lot_id', 'Lots Existing Numbers'),
|
||||||
'use_exist' : fields.boolean('Use Exist'),
|
'use_exist' : fields.boolean('Existing Lot'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def split_lot(self, cr, uid, ids, context=None):
|
def split_lot(self, cr, uid, ids, context=None):
|
||||||
|
@ -293,7 +293,7 @@ class stock_move_split_lines(osv.osv_memory):
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Tracking serial', size=64),
|
'name': fields.char('Tracking serial', size=64),
|
||||||
'quantity': fields.integer('Quantity'),
|
'quantity': fields.integer('Quantity'),
|
||||||
'use_exist' : fields.boolean('Use Exist'),
|
'use_exist' : fields.boolean('Existing Lot'),
|
||||||
'lot_id': fields.many2one('stock.move.split', 'Lot'),
|
'lot_id': fields.many2one('stock.move.split', 'Lot'),
|
||||||
'action': fields.selection([('split','Split'),('keepinone','Keep in one lot')],'Action'),
|
'action': fields.selection([('split','Split'),('keepinone','Keep in one lot')],'Action'),
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,17 +40,15 @@ class stock_split_into(osv.osv_memory):
|
||||||
|
|
||||||
quantity = self.browse(cr, uid, data[0], context).quantity or 0.0
|
quantity = self.browse(cr, uid, data[0], context).quantity or 0.0
|
||||||
for move in move_obj.browse(cr, uid, rec_id):
|
for move in move_obj.browse(cr, uid, rec_id):
|
||||||
move_qty = move.product_qty
|
quantity_rest = move.product_qty - quantity
|
||||||
uos_qty_rest = move.product_uos_qty
|
if quantity > 0:
|
||||||
quantity_rest = move_qty - quantity
|
|
||||||
if (quantity_rest == 0) or (quantity <= 0) :
|
|
||||||
continue
|
|
||||||
move_obj.setlast_tracking(cr, uid, [move.id], context=context)
|
move_obj.setlast_tracking(cr, uid, [move.id], context=context)
|
||||||
move_obj.write(cr, uid, [move.id], {
|
move_obj.write(cr, uid, [move.id], {
|
||||||
'product_qty': quantity,
|
'product_qty': quantity,
|
||||||
'product_uos_qty': quantity,
|
'product_uos_qty': quantity,
|
||||||
'product_uos': move.product_uom.id,
|
'product_uos': move.product_uom.id,
|
||||||
})
|
})
|
||||||
|
if quantity_rest>0:
|
||||||
quantity_rest = move.product_qty - quantity
|
quantity_rest = move.product_qty - quantity
|
||||||
tracking_id = track_obj.create(cr, uid, {})
|
tracking_id = track_obj.create(cr, uid, {})
|
||||||
default_val = {
|
default_val = {
|
||||||
|
@ -61,11 +59,6 @@ class stock_split_into(osv.osv_memory):
|
||||||
'product_uos': move.product_uom.id
|
'product_uos': move.product_uom.id
|
||||||
}
|
}
|
||||||
current_move = move_obj.copy(cr, uid, move.id, default_val)
|
current_move = move_obj.copy(cr, uid, move.id, default_val)
|
||||||
new_move.append(current_move)
|
|
||||||
update_val['product_qty'] = quantity
|
|
||||||
update_val['tracking_id'] = tracking_id
|
|
||||||
update_val['product_uos_qty'] = uos_qty_rest
|
|
||||||
move_obj.write(cr, uid, [move.id], update_val)
|
|
||||||
return {}
|
return {}
|
||||||
stock_split_into()
|
stock_split_into()
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<record id="view_stock_move_split_wizard" model="ir.ui.view">
|
<record id="view_stock_move_split_wizard" model="ir.ui.view">
|
||||||
<field name="name">Split move</field>
|
<field name="name">Split move</field>
|
||||||
<field name="model">stock.split.into</field>
|
<field name="model">stock.split.into</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Split Move">
|
<form string="Split Move">
|
||||||
<separator string="Set quantity to split your palets" colspan="4"/>
|
<separator string="Quantity for current pack" colspan="4"/>
|
||||||
<field name="quantity"/>
|
<field name="quantity"/>
|
||||||
<button icon='gtk-cancel' special="cancel"
|
<button icon='gtk-cancel' special="cancel"
|
||||||
string="Cancel" />
|
string="Cancel" />
|
||||||
|
@ -17,7 +16,6 @@
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="split_into" model="ir.actions.act_window">
|
<record id="split_into" model="ir.actions.act_window">
|
||||||
<field name="name">Split into</field>
|
<field name="name">Split into</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
@ -26,6 +24,5 @@
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Downstream traceability">
|
<form string="Downstream traceability">
|
||||||
|
|
||||||
<label string="It will give information about the stock of a product as per the Tracking Lot" colspan="2" />
|
<label string="It will give information about the stock of a product as per the pack" colspan="2" />
|
||||||
<separator string="" colspan="4" />
|
<separator string="" colspan="4" />
|
||||||
<button icon='gtk-cancel' special="cancel"
|
<button icon='gtk-cancel' special="cancel"
|
||||||
string="Cancel" />
|
string="Cancel" />
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Upstream traceability">
|
<form string="Upstream traceability">
|
||||||
|
|
||||||
<label string="It will give information about the stock of a product as per the Tracking Lot" colspan="2" />
|
<label string="It will give information about the stock of a product as per the pack" colspan="2" />
|
||||||
<separator string="" colspan="4" />
|
<separator string="" colspan="4" />
|
||||||
<button icon='gtk-cancel' special="cancel"
|
<button icon='gtk-cancel' special="cancel"
|
||||||
string="Cancel" />
|
string="Cancel" />
|
||||||
|
|
Loading…
Reference in New Issue