*calendar view on picking * return warning message instand of raise exception if pricelist not found
bzr revid: hmo@tinyerp.com-20080909135716-5k0re6km9qh4i6tb
This commit is contained in:
parent
1c641448c8
commit
4c8c90f80c
|
@ -781,12 +781,7 @@ class sale_order_line(osv.osv):
|
|||
if not product:
|
||||
return {'value': {'th_weight' : 0, 'product_packaging': False,
|
||||
'product_uos_qty': qty}, 'domain': {'product_uom': [],
|
||||
'product_uos': []}}
|
||||
|
||||
if not pricelist:
|
||||
raise osv.except_osv(_('No Pricelist !'),
|
||||
_('You have to select a pricelist in the sale form !\n'
|
||||
'Please set one before choosing a product.'))
|
||||
'product_uos': []}}
|
||||
|
||||
if not date_order:
|
||||
date_order = time.strftime('%Y-%m-%d')
|
||||
|
@ -798,18 +793,7 @@ class sale_order_line(osv.osv):
|
|||
pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context)
|
||||
q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom)
|
||||
qty = qty - qty % q + q
|
||||
result['product_uom_qty'] = qty
|
||||
|
||||
price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
|
||||
product, qty or 1.0, partner_id, {
|
||||
'uom': uom,
|
||||
'date': date_order,
|
||||
})[pricelist]
|
||||
if price is False:
|
||||
raise osv.except_osv(_('No valid pricelist line found !'),
|
||||
_("Couldn't find a pricelist line matching this product and quantity.\n"
|
||||
"You have to change either the product, the quantity or the pricelist."))
|
||||
|
||||
result['product_uom_qty'] = qty
|
||||
|
||||
if uom:
|
||||
uom2 = product_uom_obj.browse(cr, uid, uom)
|
||||
|
@ -824,7 +808,7 @@ class sale_order_line(osv.osv):
|
|||
else:
|
||||
uos = False
|
||||
|
||||
result .update({'price_unit': price, 'type': product_obj.procure_method})
|
||||
result .update({'type': product_obj.procure_method})
|
||||
if product_obj.description_sale:
|
||||
result['notes'] = product_obj.description_sale
|
||||
|
||||
|
@ -878,7 +862,34 @@ class sale_order_line(osv.osv):
|
|||
result['product_uom_qty'] = qty_uos / product_obj.uos_coeff
|
||||
result['th_weight'] = result['product_uom_qty'] * product_obj.weight
|
||||
# Round the quantity up
|
||||
return {'value': result, 'domain': domain}
|
||||
|
||||
# get unit price
|
||||
warning={}
|
||||
if not pricelist:
|
||||
warning={
|
||||
'title':'No Pricelist !',
|
||||
'message':
|
||||
'You have to select a pricelist in the sale form !\n'
|
||||
'Please set one before choosing a product.'
|
||||
}
|
||||
else:
|
||||
price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
|
||||
product, qty or 1.0, partner_id, {
|
||||
'uom': uom,
|
||||
'date': date_order,
|
||||
})[pricelist]
|
||||
if price is False:
|
||||
warning={
|
||||
'title':'No valid pricelist line found !',
|
||||
'message':
|
||||
"Couldn't find a pricelist line matching this product and quantity.\n"
|
||||
"You have to change either the product, the quantity or the pricelist."
|
||||
}
|
||||
else:
|
||||
result.update({'price_unit': price})
|
||||
|
||||
|
||||
return {'value': result, 'domain': domain,'warning':warning}
|
||||
|
||||
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,
|
||||
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||
|
|
|
@ -453,6 +453,19 @@
|
|||
=============================
|
||||
Packing
|
||||
=============================
|
||||
<record model="ir.ui.view" id="stock_picking_calendar">
|
||||
<field name="name">stock.picking.calendar</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Calendar View" date_start="date" color="state">
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="address_id"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
<record id="vpicktree" model="ir.ui.view">
|
||||
<field name="name">stock.picking.tree</field>
|
||||
<field name="model">stock.picking</field>
|
||||
|
@ -634,7 +647,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('type','=','delivery')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -658,7 +671,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','assigned'),('type','=','delivery')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -681,7 +694,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','confirmed'),('type','=','delivery')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -791,7 +804,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('type','=','out')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -814,7 +827,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','assigned'),('type','=','out')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -837,7 +850,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','confirmed'),('type','=','out')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -956,7 +969,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('type','=','in')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -980,7 +993,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','assigned'),('type','=','in')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -1027,7 +1040,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('type','=','internal')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -1039,7 +1052,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','assigned'),('type','=','internal')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -1050,7 +1063,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','confirmed'),('type','=','internal')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
@ -1061,7 +1074,7 @@
|
|||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="domain">[('state','=','draft'),('type','=','internal')]</field>
|
||||
<field name="context">{'contact_display': 'partner'}</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue