[FIX]: Fix product_id onchange problem
bzr revid: atp@tinyerp.com-20120727071708-gx51ajrt2zfdtgzy
This commit is contained in:
parent
bab2f1959f
commit
692357c872
|
@ -25,7 +25,7 @@
|
|||
<field name="timesheet" on_change="onchange_timesheet(timesheet)"/>
|
||||
<field name="default_order_policy" attrs="{'invisible':[('group_invoice_so_lines','=',False)],'required': [('group_invoice_so_lines','=',True)]}"/>
|
||||
<field name="time_unit" domain="[('category_id.name','=','Working Time')]"
|
||||
attrs="{'invisible': [('task_work','=',False), ('module_account_analytic_analysis','=',False)],'required': ['|', ('task_work','=',True), ('module_account_analytic_analysis','=',True)]}"/>
|
||||
attrs="{'invisible': [('module_account_analytic_analysis','=',False)],'required': [('module_account_analytic_analysis','=',True)]}"/>
|
||||
<separator string="Contracts" colspan="2"/>
|
||||
<field name="module_account_analytic_analysis" on_change="onchange_timesheet(module_account_analytic_analysis)"/>
|
||||
<field name="module_analytic_user_function" attrs="{'invisible':[('module_account_analytic_analysis','=',False)]}"/>
|
||||
|
|
|
@ -815,11 +815,6 @@ class sale_order_line(osv.osv):
|
|||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.invoiced:
|
||||
raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced!'))
|
||||
for move_line in line.move_ids:
|
||||
if move_line.state != 'cancel':
|
||||
raise osv.except_osv(
|
||||
_('Could not cancel sales order line!'),
|
||||
_('You must first cancel stock moves attached to this sales order line.'))
|
||||
return self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
|
||||
def button_confirm(self, cr, uid, ids, context=None):
|
||||
|
@ -855,7 +850,7 @@ class sale_order_line(osv.osv):
|
|||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if not default:
|
||||
default = {}
|
||||
default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []})
|
||||
default.update({'state': 'draft', 'invoiced': False, 'invoice_lines': []})
|
||||
return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context)
|
||||
|
||||
|
||||
|
@ -876,14 +871,14 @@ class sale_order_line(osv.osv):
|
|||
context_partner = {'lang': lang, 'partner_id': partner_id}
|
||||
|
||||
if not product:
|
||||
return {'value': {'th_weight': 0, 'product_packaging': False,
|
||||
return {'value': {'th_weight': 0,
|
||||
'product_uos_qty': qty}, 'domain': {'product_uom': [],
|
||||
'product_uos': []}}
|
||||
if not date_order:
|
||||
date_order = time.strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
res = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
|
||||
result = res.get('value', {})
|
||||
res = {}
|
||||
result = res
|
||||
warning_msgs = res.get('warning') and res['warning']['message'] or ''
|
||||
product_obj = product_obj.browse(cr, uid, product, context=context)
|
||||
|
||||
|
@ -901,7 +896,6 @@ class sale_order_line(osv.osv):
|
|||
uos = False
|
||||
fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False
|
||||
if update_tax: #The quantity only have changed
|
||||
result['delay'] = (product_obj.sale_delay or 0.0)
|
||||
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
|
||||
result.update({'type': product_obj.procure_method})
|
||||
|
||||
|
@ -943,14 +937,6 @@ class sale_order_line(osv.osv):
|
|||
|
||||
if not uom2:
|
||||
uom2 = product_obj.uom_id
|
||||
compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding)
|
||||
if (product_obj.type=='product') and int(compare_qty) == -1 \
|
||||
and (product_obj.procure_method=='make_to_stock'):
|
||||
warn_msg = _('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)
|
||||
warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n"
|
||||
# get unit price
|
||||
|
||||
if not pricelist:
|
||||
|
|
|
@ -13,12 +13,14 @@
|
|||
<field name="flow_start">True</field>
|
||||
<field name="name">draft</field>
|
||||
</record>
|
||||
|
||||
<record id="act_sent" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">sent</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">write({'state':'sent'})</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record id="act_router" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">router</field>
|
||||
|
@ -26,6 +28,7 @@
|
|||
<field name="action">action_wait()</field>
|
||||
<field name="split_mode">OR</field>
|
||||
</record>
|
||||
|
||||
<record id="act_wait_invoice" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">wait_invoice</field>
|
||||
|
@ -39,6 +42,7 @@
|
|||
<field name="action">write({'state':'done'})</field>
|
||||
<field name="join_mode">AND</field>
|
||||
</record>
|
||||
|
||||
<record id="act_cancel" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">cancel</field>
|
||||
|
@ -46,6 +50,7 @@
|
|||
<field name="kind">stopall</field>
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
|
||||
<record id="act_cancel2" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">cancel2</field>
|
||||
|
@ -53,13 +58,7 @@
|
|||
<field name="kind">stopall</field>
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
<record id="act_cancel3" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">cancel3</field>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="kind">stopall</field>
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
|
||||
<record id="act_invoice" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">invoice</field>
|
||||
|
@ -79,7 +78,6 @@
|
|||
<field name="kind">function</field>
|
||||
<field name="action">action_invoice_end()</field>
|
||||
</record>
|
||||
|
||||
<record id="act_invoice_cancel" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_sale"/>
|
||||
<field name="name">invoice_cancel</field>
|
||||
|
@ -89,26 +87,21 @@
|
|||
</record>
|
||||
|
||||
<!-- Transistion -->
|
||||
|
||||
<record id="trans_invoice_end_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice_end"/>
|
||||
<field name="act_to" ref="act_done"/>
|
||||
</record>
|
||||
|
||||
<record id="trans_draft_router" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_router"/>
|
||||
<field name="signal">order_confirm</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_draft_sent" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_sent"/>
|
||||
<field name="signal">quotation_sent</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_sent_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_sent"/>
|
||||
|
||||
<record id="trans_draft_router" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_router"/>
|
||||
<field name="signal">order_confirm</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_draft_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
<field name="signal">cancel</field>
|
||||
</record>
|
||||
|
@ -118,52 +111,41 @@
|
|||
<field name="act_to" ref="act_router"/>
|
||||
<field name="signal">order_confirm</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_draft_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
|
||||
<record id="trans_sent_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_sent"/>
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
<field name="signal">cancel</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_router_wait_invoice" model="workflow.transition">
|
||||
<field name="act_from" ref="act_router"/>
|
||||
<field name="act_to" ref="act_wait_invoice"/>
|
||||
</record>
|
||||
|
||||
<record id="trans_wait_invoice_all_lines_invoiced" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_invoice"/>
|
||||
<field name="act_to" ref="act_invoice_end"/>
|
||||
<field name="signal">all_lines</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_router_wait_invoice_shipping" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_invoice"/>
|
||||
<field name="act_to" ref="act_invoice_end"/>
|
||||
<field name="condition">(order_policy=='picking')</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_router_wait_invoice" model="workflow.transition">
|
||||
<field name="act_from" ref="act_router"/>
|
||||
<field name="act_to" ref="act_wait_invoice"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_wait_invoice_cancel2" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_invoice"/>
|
||||
<field name="act_to" ref="act_cancel2"/>
|
||||
<field name="signal">cancel</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_wait_invoice_invoice" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_invoice"/>
|
||||
<field name="act_to" ref="act_invoice"/>
|
||||
<field name="condition">(order_policy=='prepaid')</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_invoice_invoice_end" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice"/>
|
||||
<field name="act_to" ref="act_invoice_end"/>
|
||||
<field name="signal">subflow.paid</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_invoice_invoice_except" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice"/>
|
||||
<field name="act_to" ref="act_invoice_except"/>
|
||||
|
@ -184,6 +166,11 @@
|
|||
<field name="act_to" ref="act_invoice_cancel"/>
|
||||
<field name="signal">invoice_cancel</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_invoice_end_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice_end"/>
|
||||
<field name="act_to" ref="act_done"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</group>
|
||||
<field name="group_sale_pricelist" position="after">
|
||||
<field name="group_multiple_shops"/>
|
||||
</field>
|
||||
</field>
|
||||
<field name="decimal_precision" position="after">
|
||||
<field name="default_picking_policy" attrs="{'invisible':[('group_invoice_deli_orders','=',False)]}"/>
|
||||
</field>
|
||||
|
@ -37,6 +37,10 @@
|
|||
<field name="default_order_policy" position="after">
|
||||
<field name="module_delivery" attrs="{'invisible':[('group_invoice_so_lines','=',False), ('group_invoice_deli_orders','=',False)]}"/>
|
||||
</field>
|
||||
<field name="time_unit" position="replace">
|
||||
<field name="time_unit" domain="[('category_id.name','=','Working Time')]"
|
||||
attrs="{'invisible': [('task_work','=',False), ('module_account_analytic_analysis','=',False)],'required': ['|', ('task_work','=',True), ('module_account_analytic_analysis','=',True)]}"/>
|
||||
</field>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -83,13 +83,6 @@
|
|||
<field name="shop_id" position="replace">
|
||||
<field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="stock.group_locations"/>
|
||||
</field>
|
||||
|
||||
<field name="order_policy" position="before">
|
||||
<field name="incoterm" widget="selection" groups="base.group_user"/>
|
||||
</field>
|
||||
<field name="incoterm" position="after">
|
||||
<field name="picking_policy" required="True"/>
|
||||
</field>
|
||||
<xpath expr="//page[@string='Other Information']/group/group/field[@name='invoiced']" position="after">
|
||||
<field name="shipped"/>
|
||||
</xpath>
|
||||
|
@ -105,27 +98,26 @@
|
|||
</tree>
|
||||
</field>
|
||||
</field>
|
||||
<field name="th_weight" position="before">
|
||||
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='th_weight']" position="before">
|
||||
<label for="delay"/>
|
||||
<div>
|
||||
<field name="delay" class="oe_inline"/> days
|
||||
</div>
|
||||
<field name="type"/>
|
||||
</field>
|
||||
<field name="address_allotment_id" position="after">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='address_allotment_id']" position="after">
|
||||
<field name="property_ids" widget="many2many_tags"
|
||||
groups="sale.group_mrp_properties"/>
|
||||
</field>
|
||||
<field name="tax_id" position="before">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='tax_id']" position="before">
|
||||
<field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging" colspan="3"/>
|
||||
</field>
|
||||
<field name="invoice_lines" position="after">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/div/field[@name='invoice_lines']" position="after">
|
||||
<label for="move_ids"/>
|
||||
<field name="move_ids" widget="many2many"/>
|
||||
</field>
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='sequence']" position="after">
|
||||
<field name="delay" invisible="1"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='tax_id']" position="after">
|
||||
<field name="type" invisible="1"/>
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
<field name="act_to" ref="act_wait_ship"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_router_wait_invoice" model="workflow.transition">
|
||||
<field name="act_from" ref="sale.act_router"/>
|
||||
<field name="act_to" ref="sale.act_wait_invoice"/>
|
||||
|
@ -64,6 +63,12 @@
|
|||
<field name="act_to" ref="sale.act_invoice_end"/>
|
||||
<field name="condition">(order_policy=='picking')</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_wait_invoice_invoice_manual" model="workflow.transition">
|
||||
<field name="act_from" ref="sale.act_wait_invoice"/>
|
||||
<field name="act_to" ref="sale.act_invoice"/>
|
||||
<field name="signal">manual_invoice</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_wait_ship_cancel3" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_ship"/>
|
||||
|
@ -77,12 +82,6 @@
|
|||
<field name="condition">(order_policy!='prepaid') or invoiced</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_wait_invoice_invoice_manual" model="workflow.transition">
|
||||
<field name="act_from" ref="sale.act_wait_invoice"/>
|
||||
<field name="act_to" ref="sale.act_invoice"/>
|
||||
<field name="signal">manual_invoice</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_ship_end_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_ship_end"/>
|
||||
<field name="act_to" ref="sale.act_done"/>
|
||||
|
|
Loading…
Reference in New Issue