[MERGE] merge sbh branch for the stock, product related modules changes (still in development)

bzr revid: mra@mra-laptop-20100621104415-rjzncdkbw7rxlloc
This commit is contained in:
Mustufa Rangwala 2010-06-21 16:14:15 +05:30
commit 9721320410
20 changed files with 118 additions and 97 deletions

View File

@ -238,6 +238,7 @@ class pos_order(osv.osv):
'invoice_id': False, 'invoice_id': False,
'account_move': False, 'account_move': False,
'picking_id': False, 'picking_id': False,
'statement_ids':[],
'nb_print': 0, 'nb_print': 0,
'pickings': [] 'pickings': []
}) })

View File

@ -47,8 +47,8 @@
<group colspan="4" col="7"> <group colspan="4" col="7">
<field name="amount_tax"/> <field name="amount_tax"/>
<field name="amount_total"/> <field name="amount_total"/>
<button name="%(action_pos_discount)d" string="D_iscount" type="action" states="draft"/> <button name="%(action_pos_discount)d" string="D_iscount" icon="gtk-execute" type="action" states="draft"/>
<button name="dummy_button" string="Compute" type="object" /> <button name="dummy_button" string="Compute" icon="gtk-execute" type="object" />
</group> </group>
<group colspan="4" col="9" groups="base.group_extended"> <group colspan="4" col="9" groups="base.group_extended">
@ -95,8 +95,8 @@
<field name="sale_journal" domain="[('type','=','sale'),('company_id','=',company_id)]"/> <field name="sale_journal" domain="[('type','=','sale'),('company_id','=',company_id)]"/>
<field name="pricelist_id" domain="[('type','=','sale')]"/> <field name="pricelist_id" domain="[('type','=','sale')]"/>
<field name="invoice_id"/> <field name="invoice_id"/>
<group colspan="2" col="3"> <group colspan="2" col="4">
<button name="invoice" string="Create _Invoice" states="paid"/> <button name="invoice" icon="gtk-execute" string="Create _Invoice" states="paid"/>
</group> </group>
</group> </group>

View File

@ -35,19 +35,19 @@ class pos_invoice(report_sxw.rml_parse):
}) })
def set_context(self, objects, data, ids, report_type=None): def set_context(self, order, data, ids, report_type=None):
super(pos_invoice, self).set_context(objects, data, ids, report_type) super(pos_invoice, self).set_context(order, data, ids, report_type)
iids = [] iids = []
nids = [] nids = []
for order in objects:
order.write({'nb_print': order.nb_print + 1})
if order.invoice_id and order.invoice_id not in iids: order.write({'nb_print': order.nb_print + 1})
if not order.invoice_id:
raise osv.except_osv(_('Error !'), _('Please create an invoice for this sale.')) if order.invoice_id and order.invoice_id not in iids:
iids.append(order.invoice_id) if not order.invoice_id:
nids.append(order.invoice_id.id) raise osv.except_osv(_('Error !'), _('Please create an invoice for this sale.'))
iids.append(order.invoice_id)
nids.append(order.invoice_id.id)
self.cr.commit() self.cr.commit()
data['ids'] = nids data['ids'] = nids
self.datas = data self.datas = data

View File

@ -34,7 +34,7 @@
<field name="balance_end"/> <field name="balance_end"/>
<field name="user_id"/> <field name="user_id"/>
<field name="state"/> <field name="state"/>
<button type="object" string="Open" name="button_open" states="draft" icon="terp-camera_test"/> <button type="object" string="Open" name="button_open" states="draft" icon="terp-camera_test"/>
<button type="object" string="Confirm" name="button_confirm" states="open" icon="terp-gtk-go-back-rtl"/> <button type="object" string="Confirm" name="button_confirm" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Cancel" name="button_cancel" states="confirm" icon="terp-gtk-stop"/> <button type="object" string="Cancel" name="button_cancel" states="confirm" icon="terp-gtk-stop"/>
</tree> </tree>
@ -109,10 +109,10 @@
<field name="total_entry_encoding"/> <field name="total_entry_encoding"/>
</group> </group>
<group colspan="4"> <group colspan="4">
<button name="button_dummy" states="draft" string="Compute"/> <button name="button_dummy" states="draft" icon="gtk-execute" string="Compute"/>
<button name="button_confirm" states="open" string="Close CashBox" type="object"/> <button name="button_confirm" states="open" icon="terp-gtk-go-back-rtl" string="Close CashBox" type="object"/>
<button name="button_open" states="draft" string="Open CashBox" type="object"/> <button name="button_open" states="draft" icon="terp-camera_test" string="Open CashBox" type="object"/>
<button name="button_cancel" states="confirm" string="Cancel" type="object" groups="base.group_extended"/> <button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel" groups="base.group_extended"/>
</group> </group>
</form> </form>
</field> </field>
@ -172,10 +172,10 @@
<field name="total_entry_encoding"/> <field name="total_entry_encoding"/>
</group> </group>
<group colspan="4"> <group colspan="4">
<button name="button_dummy" states="draft" string="Compute"/> <button name="button_dummy" states="draft" icon="gtk-execute" string="Compute"/>
<button name="button_confirm" states="open" string="Close CashBox" type="object"/> <button name="button_confirm" states="open" icon="terp-gtk-go-back-rtl" string="Close CashBox" type="object"/>
<button name="button_open" states="draft" string="Open CashBox" type="object"/> <button name="button_open" states="draft" icon="terp-camera_test" string="Open CashBox" type="object"/>
<button name="button_cancel" states="confirm" string="Cancel" type="object" groups="base.group_extended"/> <button name="button_cancel" states="confirm" icon="gtk-cancel" string="Cancel" type="object" groups="base.group_extended"/>
</group> </group>
</form> </form>
</field> </field>
@ -301,10 +301,11 @@
<field name="total_entry_encoding"/> <field name="total_entry_encoding"/>
</group> </group>
<group colspan="4"> <group colspan="4">
<button name="button_dummy" states="draft" string="Compute"/> <button name="button_dummy" states="draft" icon="gtk-execute" string="Compute"/>
<button name="button_open" states="draft" string="Open CashBox" type="object" /> <button name="button_confirm" states="open" icon="terp-gtk-go-back-rtl" string="Close CashBox" type="object"/>
<button name="button_confirm" states="open" string="Confirm" type="object" /> <button name="button_open" states="draft" icon="terp-camera_test" string="Open CashBox" type="object"/>
<button name="button_cancel" states="confirm" string="Cancel" type="object" groups="base.group_extended"/> <button name="button_cancel" states="confirm" icon="gtk-cancel" string="Cancel" type="object" groups="base.group_extended"/>
</group> </group>
</form> </form>
</field> </field>

View File

@ -1,5 +1,5 @@
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# #
@ -14,7 +14,7 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
@ -39,7 +39,7 @@ class res_partner_manufacturer(osv.osv):
'product_id': fields.many2one('product.product', 'Product', ondelete='cascade'), 'product_id': fields.many2one('product.product', 'Product', ondelete='cascade'),
} }
_defaults = { _defaults = {
'authorized': lambda *a: True, 'authorized': True,
} }
res_partner_manufacturer() res_partner_manufacturer()

View File

@ -42,7 +42,7 @@ class product_product(osv.osv):
invoice_types=() invoice_types=()
states=() states=()
if invoice_state=='paid': if invoice_state=='paid':
states=('paid') states=('paid',)
elif invoice_state=='open_paid': elif invoice_state=='open_paid':
states=('open','paid') states=('open','paid')
elif invoice_state=='draft_open_paid': elif invoice_state=='draft_open_paid':

View File

@ -349,7 +349,8 @@ class product_product(osv.osv):
if location_info.usage == 'inventory': if location_info.usage == 'inventory':
if fields.get('virtual_available'): if fields.get('virtual_available'):
res['fields']['virtual_available']['string'] = _('Future P&L') res['fields']['virtual_available']['string'] = _('Future P&L')
res['fields']['qty_available']['string'] = _('P&L Qty') if fields.get('qty_available'):
res['fields']['qty_available']['string'] = _('P&L Qty')
if location_info.usage == 'procurement': if location_info.usage == 'procurement':
if fields.get('virtual_available'): if fields.get('virtual_available'):

View File

@ -559,7 +559,7 @@ class stock_picking(osv.osv):
} }
new_id = super(stock_picking, self).create(cr, user, vals, context) new_id = super(stock_picking, self).create(cr, user, vals, context)
if not vals.get('auto_picking', False): if not vals.get('auto_picking', False):
message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + _(" with origin")+" '" + (vals['origin'] or "n/a") + "' "+ _("is created.") message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + _(" with origin")+" '" + (vals.get('origin') or "n/a") + "' "+ _("is created.")
self.log(cr, user, new_id, message) self.log(cr, user, new_id, message)
return new_id return new_id
@ -687,6 +687,8 @@ class stock_picking(osv.osv):
""" """
wf_service = netsvc.LocalService("workflow") wf_service = netsvc.LocalService("workflow")
for pick in self.browse(cr, uid, ids): for pick in self.browse(cr, uid, ids):
if not pick.move_lines:
raise osv.except_osv(_('Error !'),_('You can not process picking without stock moves'))
wf_service.trg_validate(uid, 'stock.picking', pick.id, wf_service.trg_validate(uid, 'stock.picking', pick.id,
'button_confirm', cr) 'button_confirm', cr)
#move_ids = [x.id for x in pick.move_lines] #move_ids = [x.id for x in pick.move_lines]
@ -1385,9 +1387,9 @@ class stock_move(osv.osv):
'price_unit': fields.float('Unit Price', 'price_unit': fields.float('Unit Price',
digits_compute= dp.get_precision('Account')), digits_compute= dp.get_precision('Account')),
'company_id': fields.many2one('res.company', 'Company', required=True, select=1), 'company_id': fields.many2one('res.company', 'Company', required=True, select=1),
'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner"), 'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner", store=True),
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order"), 'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order"),
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"), 'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin",store=True),
'scraped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scraped'), 'scraped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scraped'),
} }
_constraints = [ _constraints = [
@ -1701,7 +1703,7 @@ class stock_move(osv.osv):
tracking_id = tracking_obj.search(cr, uid, ['name','=', tracking]) tracking_id = tracking_obj.search(cr, uid, ['name','=', tracking])
if prodlot_id: if prodlot_id:
update_val['prodlot_id'] = prodlot_id update_val['prodlot_id'] = prodlot_id
else: else:
tracking_id = tracking_obj.create(cr, uid, {'name': tracking}, {'product_id': self.browse(cr, uid, ids)[0].product_id.id}) tracking_id = tracking_obj.create(cr, uid, {'name': tracking}, {'product_id': self.browse(cr, uid, ids)[0].product_id.id})
update_val['tracking_id'] = tracking_id update_val['tracking_id'] = tracking_id
else: else:
@ -2191,17 +2193,17 @@ class stock_move(osv.osv):
for move in complete: for move in complete:
self.action_done(cr, uid, [move.id], context) self.action_done(cr, uid, [move.id], context)
if move.picking_id.id :
# TOCHECK : Done picking if all moves are done # TOCHECK : Done picking if all moves are done
cr.execute(""" cr.execute("""
SELECT move.id FROM stock_picking pick SELECT move.id FROM stock_picking pick
RIGHT JOIN stock_move move ON move.picking_id = pick.id AND move.state = %s RIGHT JOIN stock_move move ON move.picking_id = pick.id AND move.state = %s
WHERE pick.id = %s""", WHERE pick.id = %s""",
('done', move.picking_id.id)) ('done', move.picking_id.id))
res = cr.fetchall() res = cr.fetchall()
if len(res) == len(move.picking_id.move_lines): if len(res) == len(move.picking_id.move_lines):
picking_obj.action_move(cr, uid, [move.picking_id.id]) picking_obj.action_move(cr, uid, [move.picking_id.id])
wf_service.trg_validate(uid, 'stock.picking', move.picking_id.id, 'button_done', cr) wf_service.trg_validate(uid, 'stock.picking', move.picking_id.id, 'button_done', cr)
ref = {} ref = {}
done_move_ids = [] done_move_ids = []

View File

@ -3,7 +3,6 @@
<data> <data>
<report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Future Stock Forecast"/> <report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Future Stock Forecast"/>
<report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Picking list" rml="stock/report/picking.rml"/> <report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Picking list" rml="stock/report/picking.rml"/>
<report id="report_packing_list" model="stock.picking" name="stock.packing.list" string="Packing list" rml="stock/report/packing.rml"/>
<report id="report_move_labels" model="stock.move" name="stock.move.label" string="Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/> <report id="report_move_labels" model="stock.move" name="stock.move.label" string="Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/>
<report auto="False" id="report_location_overview" model="stock.location" name="lot.stock.overview" string="Location Overview" rml="stock/report/lot_overview.rml" groups="base.group_extended"/> <report auto="False" id="report_location_overview" model="stock.location" name="lot.stock.overview" string="Location Overview" rml="stock/report/lot_overview.rml" groups="base.group_extended"/>
<report auto="False" id="report_lot_location" model="stock.location" name="lot.location" rml="stock/report/lot_location.rml" string="Lots by location"/> <report auto="False" id="report_lot_location" model="stock.location" name="lot.location" rml="stock/report/lot_location.rml" string="Lots by location"/>

View File

@ -1254,12 +1254,9 @@
</notebook> </notebook>
</form> </form>
</field> </field>
<group col="7" colspan="4">
<label colspan="5"/>
<button name="%(act_stock_picking_move_wizard)d" string="Unreceived Products" type="action" states="draft" icon="gtk-redo"/>
</group>
<group col="10" colspan="4"> <group col="10" colspan="4">
<field name="state" readonly="1"/> <field name="state" readonly="1"/>
<button name="%(act_stock_picking_move_wizard)d" string="Unreceived Products" type="action" states="draft" icon="gtk-redo"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/> <button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/> <button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/> <button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
@ -1354,7 +1351,6 @@
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="4" col="8"> <group expand="0" string="Group By..." colspan="4" col="8">
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'address_id'}"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/> <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/> <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/> <filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>

View File

@ -41,7 +41,7 @@
<field name="name">cancel</field> <field name="name">cancel</field>
<field name="flow_stop">True</field> <field name="flow_stop">True</field>
<field name="kind">function</field> <field name="kind">function</field>
<field name="action">action_cancel_inventary()</field> <field name="action">action_cancel()</field>
</record> </record>
<record id="act_cancel" model="workflow.activity"> <record id="act_cancel" model="workflow.activity">

View File

@ -7,11 +7,14 @@
<field name="model">stock.inventory.merge</field> <field name="model">stock.inventory.merge</field>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Merge inventories"> <form string="Merge inventories">
<separator colspan="4" string="Merge inventories" /> <separator colspan="4" string="Merge inventories" />
<label string="Do you want to merge theses inventories ?"/> <label string="Do you want to merge theses inventories ?"/>
<button special="cancel" string="Cancel" icon='gtk-cancel'/> <separator colspan="4"/>
<button name="do_merge" string="Yes" type="object" icon="gtk-apply"/> <group colspan="4" col="6">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_merge" string="Yes" type="object" icon="gtk-apply"/>
</group>
</form> </form>
</field> </field>
</record> </record>

View File

@ -176,15 +176,16 @@ class split_in_production_lot(osv.osv_memory):
""" """
res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context) res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context)
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context) if context.get('active_id'):
if 'product_id' in fields: move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
res.update({'product_id': move.product_id.id}) if 'product_id' in fields:
if 'product_uom' in fields: res.update({'product_id': move.product_id.id})
res.update({'product_uom': move.product_uom.id}) if 'product_uom' in fields:
if 'qty' in fields: res.update({'product_uom': move.product_uom.id})
res.update({'qty': move.product_qty}) if 'qty' in fields:
if 'use_exist' in fields: res.update({'qty': move.product_qty})
res.update({'use_exist': (move.picking_id and move.picking_id.type=='out' and True) or False}) if 'use_exist' in fields:
res.update({'use_exist': (move.picking_id and move.picking_id.type=='out' and True) or False})
return res return res
_columns = { _columns = {

View File

@ -44,7 +44,9 @@ class stock_partial_move(osv.osv_memory):
moveids = [] moveids = []
for m in move_obj.browse(cr, uid, context.get('active_ids', [])): for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if m.state in ('done', 'cancel'): if m.state in ('done', 'cancel'):
continue raise osv.except_osv(_('Invalid action !'), _('Cannot delivery products which are already delivered !'))
if 'move%s_product_id'%(m.id) not in self._columns: if 'move%s_product_id'%(m.id) not in self._columns:
self._columns['move%s_product_id'%(m.id)] = fields.many2one('product.product',string="Product") self._columns['move%s_product_id'%(m.id)] = fields.many2one('product.product',string="Product")
if 'move%s_product_qty'%(m.id) not in self._columns: if 'move%s_product_qty'%(m.id) not in self._columns:
@ -66,7 +68,8 @@ class stock_partial_move(osv.osv_memory):
move_ids = move_obj.search(cr, uid, [('id','in',move_ids)]) move_ids = move_obj.search(cr, uid, [('id','in',move_ids)])
_moves_arch_lst = """<form string="Deliver Products"> _moves_arch_lst = """<form string="Deliver Products">
<separator colspan="4" string="Delivery Information"/> <separator colspan="4" string="Delivery Information"/>
<field name="date" colspan="4" /> <field name="date" />
<separator colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','=','in')]}"> <group colspan="4" attrs="{'invisible':[('type','=','in')]}">
<field name="partner_id" attrs="{'required':[('type','!=','in')]}" /> <field name="partner_id" attrs="{'required':[('type','!=','in')]}" />
<field name="address_id" attrs="{'required':[('type','!=','in')]}"/> <field name="address_id" attrs="{'required':[('type','!=','in')]}"/>

View File

@ -62,7 +62,8 @@ class stock_partial_picking(osv.osv_memory):
picking_ids = context.get('active_ids', False) picking_ids = context.get('active_ids', False)
_moves_arch_lst = """<form string="Deliver Products"> _moves_arch_lst = """<form string="Deliver Products">
<separator colspan="4" string="Delivery Information"/> <separator colspan="4" string="Delivery Information"/>
<field name="date" colspan="4" /> <field name="date" />
<separator colspan="4"/>
<separator colspan="4" string="Move Detail"/> <separator colspan="4" string="Move Detail"/>
""" """
_moves_fields = result['fields'] _moves_fields = result['fields']

View File

@ -32,7 +32,7 @@ class procurement_order(osv.osv):
def check_buy(self, cr, uid, ids, context=None): def check_buy(self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids): for procurement in self.browse(cr, uid, ids):
for line in procurement.product_id.flow_pull_ids: for line in procurement.product_id.flow_pull_ids:
print line.location_src_id.name, line.location_id.name, line.type_proc
if line.location_id==procurement.location_id: if line.location_id==procurement.location_id:
return line.type_proc=='buy' return line.type_proc=='buy'
return super(procurement_order, self).check_buy(cr, uid, ids) return super(procurement_order, self).check_buy(cr, uid, ids)
@ -58,7 +58,6 @@ class procurement_order(osv.osv):
move_obj = self.pool.get('stock.move') move_obj = self.pool.get('stock.move')
location_obj = self.pool.get('stock.location') location_obj = self.pool.get('stock.location')
wf_service = netsvc.LocalService("workflow") wf_service = netsvc.LocalService("workflow")
for proc in proc_obj.browse(cr, uid, ids, context=context): for proc in proc_obj.browse(cr, uid, ids, context=context):
line = None line = None
for line in proc.product_id.flow_pull_ids: for line in proc.product_id.flow_pull_ids:
@ -79,7 +78,7 @@ class procurement_order(osv.osv):
move_id = self.pool.get('stock.move').create(cr, uid, { move_id = self.pool.get('stock.move').create(cr, uid, {
'name': line.name, 'name': line.name,
'picking_id': picking_id, 'picking_id': picking_id,
'company_id': line.company_id and line.company_id.id or False, 'company_id': line.company_id and line.company_id.id or False,
'product_id': proc.product_id.id, 'product_id': proc.product_id.id,
'date_planned': proc.date_planned, 'date_planned': proc.date_planned,
'product_qty': proc.product_qty, 'product_qty': proc.product_qty,
@ -104,7 +103,7 @@ class procurement_order(osv.osv):
proc_id = self.pool.get('procurement.order').create(cr, uid, { proc_id = self.pool.get('procurement.order').create(cr, uid, {
'name': line.name, 'name': line.name,
'origin': origin, 'origin': origin,
'company_id': line.company_id and line.company_id.id or False, 'company_id': line.company_id and line.company_id.id or False,
'date_planned': proc.date_planned, 'date_planned': proc.date_planned,
'product_id': proc.product_id.id, 'product_id': proc.product_id.id,
'product_qty': proc.product_qty, 'product_qty': proc.product_qty,

View File

@ -80,18 +80,19 @@ class product_pulled_flow(osv.osv):
required=True,), required=True,),
} }
_defaults = { _defaults = {
'cancel_cascade': lambda *arg: False, 'cancel_cascade': False,
'procure_method': lambda *args: 'make_to_stock', 'procure_method': 'make_to_stock',
'type_proc': lambda *args: 'move', 'type_proc': 'move',
'picking_type':lambda *args:'out', 'picking_type': 'out',
'invoice_state': lambda *args: 'none', 'invoice_state': 'none',
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.pulled.flow', context=c),
} }
product_pulled_flow() product_pulled_flow()
class product_product(osv.osv): class product_product(osv.osv):
_inherit = 'product.product' _inherit = 'product.product'
_columns = { _columns = {
'flow_pull_ids': fields.one2many('product.pulled.flow', 'product_id', 'Pulled Flows'), 'flow_pull_ids': fields.one2many('product.pulled.flow', 'product_id', 'Pulled Flows'),
'path_ids': fields.one2many('stock.location.path', 'product_id', 'path_ids': fields.one2many('stock.location.path', 'product_id',
'Pushed Flow', 'Pushed Flow',
help="These rules set the right path of the product in the "\ help="These rules set the right path of the product in the "\

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# #
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
@ -28,7 +28,7 @@ class product(osv.osv):
'auto_pick': fields.boolean('Auto Picking', help="Auto picking for raw materials of production orders.") 'auto_pick': fields.boolean('Auto Picking', help="Auto picking for raw materials of production orders.")
} }
_defaults = { _defaults = {
'auto_pick': lambda *args: True 'auto_pick': True
} }
product() product()

View File

@ -346,12 +346,13 @@ class stock_sale_forecast(osv.osv):
def product_amt_change(self, cr, uid, ids, product_amt = 0.0, product_uom=False): def product_amt_change(self, cr, uid, ids, product_amt = 0.0, product_uom=False):
ret={} ret={}
round_value = 1
if product_amt: if product_amt:
coeff_def2uom = 1 coeff_def2uom = 1
val1 = self.browse(cr, uid, ids) val1 = self.browse(cr, uid, ids)
val = val1[0] val = val1[0]
if (product_uom != val.product_id.uom_id.id): if (product_uom != val.product_id.uom_id.id):
coeff_def2uom, rounding = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {})
ret['product_qty'] = rounding(coeff_def2uom * product_amt/(val.product_id.product_tmpl_id.list_price), round_value) ret['product_qty'] = rounding(coeff_def2uom * product_amt/(val.product_id.product_tmpl_id.list_price), round_value)
res = {'value': ret} res = {'value': ret}
return res return res

View File

@ -105,7 +105,7 @@
<separator colspan ="4" string="Forecast lines creation"/> <separator colspan ="4" string="Forecast lines creation"/>
<label colspan ="4" string="Creates forecast lines for selected warehouse and period. Doesn't duplicate existing lines created by you."/> <label colspan ="4" string="Creates forecast lines for selected warehouse and period. Doesn't duplicate existing lines created by you."/>
<group colspan="4"> <group colspan="4">
<button icon="gtk-cancel" special="cancel" string="Cancel"/> <button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-execute" name="create_forecast" string="Create Forecasts" type="object" /> <button icon="gtk-execute" name="create_forecast" string="Create Forecasts" type="object" />
</group> </group>
</form> </form>
@ -152,7 +152,7 @@
<field name="product_amt" on_change="product_amt_change( product_amt, product_uom)" /> <field name="product_amt" on_change="product_amt_change( product_amt, product_uom)" />
<field name="product_qty" /> <field name="product_qty" />
<field name="state"/> <field name="state"/>
<button name="action_validate" string="Validate" states="draft" type="object" colspan = "2"/> <button name="action_validate" icon="gtk-apply" string="Validate" states="draft" type="object" colspan = "2"/>
</group> </group>
</group> </group>
<separator colspan ="4" string="Sales history"/> <separator colspan ="4" string="Sales history"/>
@ -209,11 +209,13 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Stock and Sales Forecasts" editable="bottom"> <tree string="Stock and Sales Forecasts" editable="bottom">
<field name="warehouse_id"/> <field name="warehouse_id"/>
<field name ="company_id"/>
<field name="user_id"/> <field name="user_id"/>
<field name="period_id"/> <field name="period_id"/>
<field name="product_id" on_change="product_id_change(product_id)" /> <field name="product_id" on_change="product_id_change(product_id)" />
<field name="product_qty"/> <field name="product_qty"/>
<field name="product_uom" /> <field name="product_uom" />
</tree> </tree>
</field> </field>
</record> </record>
@ -238,14 +240,20 @@
<field name="type">search</field> <field name="type">search</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Search Stock and Sales Forecast"> <search string="Search Stock and Sales Forecast">
<group col='10' colspan='4'>
<filter icon="terp-camera_test" string="Validated" domain="[('state','=','validated')]" separator="1"/> <filter icon="terp-camera_test" string="Validated" domain="[('state','=','validated')]" separator="1"/>
<field name="company_id" widget="selection"/> <field name="company_id"/>
<field name="warehouse_id" widget="selection"/> <field name="warehouse_id" />
<field name="period_id" widget="selection"/> <field name="period_id" />
<field name="product_id"/> <field name="product_id"/>
<field name="create_uid"/> <field name="create_uid"/>
</group> <newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
<filter string="Company" icon="terp-personal" domain="[]" context="{'group_by':'company_id'}"/>
<filter string="Warehouse " icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'warehouse_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string='Default UOM' icon="terp-mrp" domain="[]" context="{'group_by' : 'product_uom'}" />
</group>
</search> </search>
</field> </field>
</record> </record>
@ -351,7 +359,7 @@
<field name="to_procure"/> <field name="to_procure"/>
<field name="incoming"/> <field name="incoming"/>
<field name="incoming_left"/> <field name="incoming_left"/>
<button name="calculate_planning" string="Calculate Planning" type="object" colspan="2"/> <button name="calculate_planning" string="Calculate Planning" type="object" icon="gtk-execute" colspan="2"/>
<field name="stock_only"/> <field name="stock_only"/>
</group> </group>
<group colspan ="2" col="2"> <group colspan ="2" col="2">
@ -362,10 +370,10 @@
<field name="outgoing_before"/> <field name="outgoing_before"/>
<field name="incoming_before"/> <field name="incoming_before"/>
<field name="stock_simulation"/> <field name="stock_simulation"/>
<button name="procure_incomming_left" string="Procure Incoming Left" type="object" colspan="2"/> <button name="procure_incomming_left" icon="gtk-convert" string="Procure Incoming Left" type="object" colspan="2"/>
<field name="procure_to_stock"/> <field name="procure_to_stock"/>
<separator colspan ="2" string = "Internal Supply"/> <separator colspan ="2" string = "Internal Supply"/>
<button name="internal_supply" string="Supply from Another Warehouse" type="object" colspan="2"/> <button name="internal_supply" string="Supply from Another Warehouse" icon="gtk-convert" type="object" colspan="2"/>
<field name="supply_warehouse_id" domain = "[('company_id','=',company_id)] "/> <field name="supply_warehouse_id" domain = "[('company_id','=',company_id)] "/>
<field name="stock_supply_location"/> <field name="stock_supply_location"/>
</group> </group>
@ -382,14 +390,18 @@
<field name="type">search</field> <field name="type">search</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Search Stock Planning"> <search string="Search Stock Planning">
<group col='10' colspan='4'>
<!-- Doesn't work ! <filter icon="terp-purchase" string="Current" domain="[('line_time','=','Future')]" separator="1"/> -->
<filter icon="terp-purchase" string="No Requisition" domain="[('history','=',False)]" separator="1"/> <filter icon="terp-purchase" string="No Requisition" domain="[('history','=',False)]" separator="1"/>
<field name="company_id" widget="selection"/> <field name="company_id" widget="selection"/>
<field name="warehouse_id" widget="selection"/> <field name="warehouse_id" widget="selection"/>
<field name="period_id" widget="selection"/> <field name="period_id" widget="selection"/>
<field name="product_id"/> <field name="product_id"/>
</group> <newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
<filter string="Company" icon="terp-personal" domain="[]" context="{'group_by':'company_id'}"/>
<filter string="Warehouse " icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'warehouse_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
</group>
</search> </search>
</field> </field>
</record> </record>