[MERGE] merged the dev2 branch
bzr revid: qdp-launchpad@tinyerp.com-20110118171400-0ijtac2s3ww7ot0q
This commit is contained in:
+19
-10
@@ -68,18 +68,21 @@ class purchase_order(osv.osv):
|
||||
if type(ids)!=type([]):
|
||||
ids=[ids]
|
||||
for po in self.browse(cr, uid, ids, context=context):
|
||||
cr.execute("""update purchase_order_line set
|
||||
date_planned=%s
|
||||
where
|
||||
order_id=%s and
|
||||
(date_planned=%s or date_planned<%s)""", (value,po.id,po.minimum_planned_date,value))
|
||||
if po.order_line:
|
||||
cr.execute("""update purchase_order_line set
|
||||
date_planned=%s
|
||||
where
|
||||
order_id=%s and
|
||||
(date_planned=%s or date_planned<%s)""", (value,po.id,po.minimum_planned_date,value))
|
||||
cr.execute("""update purchase_order set
|
||||
minimum_planned_date=%s where id=%s""", (value, po.id))
|
||||
return True
|
||||
|
||||
def _minimum_planned_date(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res={}
|
||||
purchase_obj=self.browse(cr, uid, ids, context=context)
|
||||
for purchase in purchase_obj:
|
||||
res[purchase.id] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
res[purchase.id] = False
|
||||
if purchase.order_line:
|
||||
min_date=purchase.order_line[0].date_planned
|
||||
for line in purchase.order_line:
|
||||
@@ -191,7 +194,11 @@ class purchase_order(osv.osv):
|
||||
"From Picking: a draft invoice will be pre-generated based on validated receptions.\n" \
|
||||
"Manual: allows you to generate suppliers invoices by chosing in the uninvoiced lines of all manual purchase orders."
|
||||
),
|
||||
'minimum_planned_date':fields.function(_minimum_planned_date, fnct_inv=_set_minimum_planned_date, method=True,store=True, string='Expected Date', type='date', select=True, 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, string='Expected Date', type='date', select=True, help="This is computed as the minimum scheduled date of all purchase order lines' products.",
|
||||
store = {
|
||||
'purchase.order.line': (_get_order, ['date_planned'], 10),
|
||||
}
|
||||
),
|
||||
'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),
|
||||
@@ -693,7 +700,7 @@ class purchase_order_line(osv.osv):
|
||||
dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
|
||||
res.update({'value': {'price_unit': price, 'name': name or prod_name,
|
||||
res.update({'value': {'price_unit': price, 'name': prod_name,
|
||||
'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id),
|
||||
'date_planned': date_planned or dt,'notes': notes or prod.description_purchase,
|
||||
'product_qty': qty,
|
||||
@@ -714,9 +721,11 @@ class purchase_order_line(osv.osv):
|
||||
return res
|
||||
|
||||
def product_uom_change(self, cr, uid, ids, pricelist, product, qty, uom,
|
||||
partner_id, date_order=False,fiscal_position=False):
|
||||
partner_id, date_order=False, fiscal_position=False, date_planned=False,
|
||||
name=False, price_unit=False, notes=False):
|
||||
res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom,
|
||||
partner_id=partner_id, date_order=date_order,fiscal_position=fiscal_position)
|
||||
partner_id, date_order=date_order, fiscal_position=fiscal_position, date_planned=date_planned,
|
||||
name=name, price_unit=price_unit, notes=notes)
|
||||
if 'product_uom' in res['value']:
|
||||
if uom and (uom != res['value']['product_uom']) and res['value']['product_uom']:
|
||||
seller_uom_name = self.pool.get('product.uom').read(cr, uid, [res['value']['product_uom']], ['name'])[0]['name']
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
<page string="Order Line">
|
||||
<field name="product_id" colspan="4" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
|
||||
<field name="product_qty" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id,parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
|
||||
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position)"/>
|
||||
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
|
||||
<field colspan="4" name="name"/>
|
||||
<field name="date_planned" widget="date"/>
|
||||
<field name="price_unit"/>
|
||||
|
||||
@@ -209,7 +209,7 @@ class stock_location(osv.osv):
|
||||
'company_id': fields.many2one('res.company', 'Company', select=1, help='Let this field empty if this location is shared between all companies'),
|
||||
'scrap_location': fields.boolean('Scrap Location', help='Check this box to allow using this location to put scrapped/damaged goods.'),
|
||||
'valuation_in_account_id': fields.many2one('account.account', 'Stock Input Account',domain = [('type','=','other')], help='This account will be used to value stock moves that have this location as destination, instead of the stock output account from the product.'),
|
||||
'valuation_out_account_id': fields.many2one('account.account', 'Stock Output Account',domain = [('type','=','other')], help='This account will be used ta value stock moves that have this location as source, instead of the stock input account from the product.'),
|
||||
'valuation_out_account_id': fields.many2one('account.account', 'Stock Output Account',domain = [('type','=','other')], help='This account will be used to value stock moves that have this location as source, instead of the stock input account from the product.'),
|
||||
}
|
||||
_defaults = {
|
||||
'active': True,
|
||||
|
||||
@@ -738,10 +738,6 @@
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed"/>
|
||||
<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"/>
|
||||
<field name="location_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
<field name="date_expected" string="Date Expected"/>
|
||||
|
||||
@@ -197,13 +197,21 @@ class stock_return_picking(osv.osv_memory):
|
||||
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'})
|
||||
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
|
||||
pick_obj.force_assign(cr, uid, [new_picking], context)
|
||||
# Update view id in context, lp:702939
|
||||
view_list = {
|
||||
'out': 'view_picking_out_tree',
|
||||
'in': 'view_picking_in_tree',
|
||||
'internal': 'vpicktree',
|
||||
}
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
res = data_obj.get_object_reference(cr, uid, 'stock', view_list.get(new_type, 'vpicktree'))
|
||||
context.update({'view_id': res and res[1] or False})
|
||||
return {
|
||||
'domain': "[('id', 'in', ["+str(new_picking)+"])]",
|
||||
'name': 'Picking List',
|
||||
'view_type':'form',
|
||||
'view_mode':'tree,form',
|
||||
'res_model':'stock.picking',
|
||||
'view_id':False,
|
||||
'type':'ir.actions.act_window',
|
||||
'context':context,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user