[IMP]add onchange of warehouse to change company related to warehouse and improve some code
bzr revid: sgo@tinyerp.com-20130131062613-tmlgvdrculc2udu1
This commit is contained in:
parent
2eec99df81
commit
6be21ac5d3
|
@ -51,7 +51,7 @@ class pos_config(osv.osv):
|
||||||
'journal_ids' : fields.many2many('account.journal', 'pos_config_journal_rel',
|
'journal_ids' : fields.many2many('account.journal', 'pos_config_journal_rel',
|
||||||
'pos_config_id', 'journal_id', 'Available Payment Methods',
|
'pos_config_id', 'journal_id', 'Available Payment Methods',
|
||||||
domain="[('journal_user', '=', True )]",),
|
domain="[('journal_user', '=', True )]",),
|
||||||
'warehouse_id' : fields.many2one('stock.warehouse', 'Location',
|
'warehouse_id' : fields.many2one('stock.warehouse', 'Warehouse',
|
||||||
required=True),
|
required=True),
|
||||||
'journal_id' : fields.many2one('account.journal', 'Sale Journal',
|
'journal_id' : fields.many2one('account.journal', 'Sale Journal',
|
||||||
domain=[('type', '=', 'sale')],
|
domain=[('type', '=', 'sale')],
|
||||||
|
@ -575,7 +575,7 @@ class pos_order(osv.osv):
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Order Ref', size=64, required=True, readonly=True),
|
'name': fields.char('Order Ref', size=64, required=True, readonly=True),
|
||||||
'company_id':fields.many2one('res.company', 'Company', required=True, readonly=True),
|
'company_id':fields.many2one('res.company', 'Company', required=True, readonly=True),
|
||||||
'warehouse_id': fields.related('session_id', 'config_id', 'warehouse_id', relation='stock.warehouse', type='many2one', string='Location', store=True, readonly=True),
|
'warehouse_id': fields.related('session_id', 'config_id', 'warehouse_id', relation='stock.warehouse', type='many2one', string='Warehouse', store=True, readonly=True),
|
||||||
'date_order': fields.datetime('Order Date', readonly=True, select=True),
|
'date_order': fields.datetime('Order Date', readonly=True, select=True),
|
||||||
'user_id': fields.many2one('res.users', 'Salesman', help="Person who uses the the cash register. It can be a reliever, a student or an interim employee."),
|
'user_id': fields.many2one('res.users', 'Salesman', help="Person who uses the the cash register. It can be a reliever, a student or an interim employee."),
|
||||||
'amount_tax': fields.function(_amount_all, string='Taxes', digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
|
'amount_tax': fields.function(_amount_all, string='Taxes', digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
|
||||||
|
|
|
@ -41,7 +41,7 @@ class pos_order_report(osv.osv):
|
||||||
'price_total':fields.float('Total Price', readonly=True),
|
'price_total':fields.float('Total Price', readonly=True),
|
||||||
'total_discount':fields.float('Total Discount', readonly=True),
|
'total_discount':fields.float('Total Discount', readonly=True),
|
||||||
'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
|
'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
|
||||||
'warehouse_id':fields.many2one('stock.warehouse', 'Location', readonly=True),
|
'warehouse_id':fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
|
||||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||||
'nbr':fields.integer('# of Lines', readonly=True),
|
'nbr':fields.integer('# of Lines', readonly=True),
|
||||||
'product_qty':fields.integer('# of Qty', readonly=True),
|
'product_qty':fields.integer('# of Qty', readonly=True),
|
||||||
|
|
|
@ -139,7 +139,7 @@ class sale_order(osv.osv):
|
||||||
'picking_ids': fields.one2many('stock.picking.out', 'sale_id', 'Related Picking', readonly=True, help="This is a list of delivery orders that has been generated for this sales order."),
|
'picking_ids': fields.one2many('stock.picking.out', 'sale_id', 'Related Picking', readonly=True, help="This is a list of delivery orders that has been generated for this sales order."),
|
||||||
'shipped': fields.boolean('Delivered', readonly=True, help="It indicates that the sales order has been delivered. This field is updated only after the scheduler(s) have been launched."),
|
'shipped': fields.boolean('Delivered', readonly=True, help="It indicates that the sales order has been delivered. This field is updated only after the scheduler(s) have been launched."),
|
||||||
'picked_rate': fields.function(_picked_rate, string='Picked', type='float'),
|
'picked_rate': fields.function(_picked_rate, string='Picked', type='float'),
|
||||||
'warehouse_id': fields.many2one('stock.warehouse', 'Location'),
|
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
|
||||||
'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on',
|
'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on',
|
||||||
help="The sales order will automatically create the invoice proposition (draft invoice).\
|
help="The sales order will automatically create the invoice proposition (draft invoice).\
|
||||||
You have to choose if you want your invoice based on ordered ", required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
You have to choose if you want your invoice based on ordered ", required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||||
|
@ -163,6 +163,14 @@ class sale_order(osv.osv):
|
||||||
|
|
||||||
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||||
|
|
||||||
|
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context=None):
|
||||||
|
val = {}
|
||||||
|
if warehouse_id:
|
||||||
|
warehouse = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context=context)
|
||||||
|
if warehouse.company_id.id:
|
||||||
|
val['company_id'] = warehouse.company_id.id
|
||||||
|
return {'value': val}
|
||||||
|
|
||||||
def action_view_delivery(self, cr, uid, ids, context=None):
|
def action_view_delivery(self, cr, uid, ids, context=None):
|
||||||
'''
|
'''
|
||||||
This function returns an action that display existing delivery orders of given sales order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
|
This function returns an action that display existing delivery orders of given sales order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
|
||||||
|
|
|
@ -23,6 +23,12 @@
|
||||||
<field name="state" position="replace">
|
<field name="state" position="replace">
|
||||||
<field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,invoiced,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
|
<field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,invoiced,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
|
||||||
</field>
|
</field>
|
||||||
|
<field name="company_id" position="replace">
|
||||||
|
<field name="company_id" readonly="True"/>
|
||||||
|
</field>
|
||||||
|
<field name="date_order" position="after">
|
||||||
|
<field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection" groups="stock.group_locations"/>
|
||||||
|
</field>
|
||||||
<field name="product_id" position="replace">
|
<field name="product_id" position="replace">
|
||||||
<field name="product_id"
|
<field name="product_id"
|
||||||
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
|
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
|
||||||
|
|
Loading…
Reference in New Issue