[MERGE] Merge with trunk addons remove conflicts on stock module
bzr revid: mra@mra-laptop-20100622034434-o28onhil9wh0aasv
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="section_id" select="1"/>
|
||||
<field name="section_id" select="1"/>
|
||||
<field name="nbr" select="1"/>
|
||||
<field name="delay_close"/>
|
||||
<field name="stage_id"/>
|
||||
@@ -69,79 +69,79 @@
|
||||
|
||||
<!-- Leads by user and section Search View -->
|
||||
|
||||
<record id="view_report_crm_lead_filter" model="ir.ui.view">
|
||||
<record id="view_report_crm_lead_filter" model="ir.ui.view">
|
||||
<field name="name">crm.lead.report.select</field>
|
||||
<field name="model">crm.lead.report</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Leads Analysis">
|
||||
<group col="16" colspan="8">
|
||||
<filter string="Last 365 Days" icon="terp-go-year"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter string="Last 365 Days" icon="terp-go-year"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter string="Last 30 Days" icon="terp-go-month" name="This Month"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter icon="terp-go-week" string="7 Days" separator="1"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<separator orientation="vertical" />
|
||||
<separator orientation="vertical" />
|
||||
<filter icon="terp-check"
|
||||
string="Current"
|
||||
domain="[('state','in',('draft','open')]"/>
|
||||
<filter icon="terp-check"
|
||||
string="Pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
<separator orientation="vertical" />
|
||||
<field name="section_id"
|
||||
default="context.get('section_id', False)"
|
||||
widget="selection"
|
||||
context="{'invisible_section': False}">
|
||||
<filter icon="terp-crm"
|
||||
context="{'invisible_section': False}"
|
||||
domain="[('section_id.user_id','=',uid)]"
|
||||
help="My section" />
|
||||
</field>
|
||||
<field name="user_id" select="1" widget="selection">
|
||||
<filter icon="terp-personal+" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
|
||||
</field>
|
||||
string="Current"
|
||||
domain="[('state','in',('draft','open')]"/>
|
||||
<filter icon="terp-check"
|
||||
string="Pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
<separator orientation="vertical" />
|
||||
<field name="section_id"
|
||||
default="context.get('section_id', False)"
|
||||
widget="selection"
|
||||
context="{'invisible_section': False}">
|
||||
<filter icon="terp-crm"
|
||||
context="{'invisible_section': False}"
|
||||
domain="[('section_id.user_id','=',uid)]"
|
||||
help="My section" />
|
||||
</field>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-personal+" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="User" name="User" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Section" icon="terp-personal+"
|
||||
domain="[]"
|
||||
context="{'group_by':'section_id'}" />
|
||||
domain="[]"
|
||||
context="{'group_by':'section_id'}" />
|
||||
<filter string="Category" icon="terp-stock_symbol-selection"
|
||||
domain="[]" context="{'group_by':'categ_id'}" />
|
||||
domain="[]" context="{'group_by':'categ_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize"
|
||||
domain="[]" context="{'group_by':'state'}" />
|
||||
domain="[]" context="{'group_by':'state'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Company" icon="terp-go-home"
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" />
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Day" icon="terp-go-today"
|
||||
domain="[]" context="{'group_by':'day'}"/>
|
||||
domain="[]" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month"
|
||||
domain="[]" context="{'group_by':'month'}" />
|
||||
domain="[]" context="{'group_by':'month'}" />
|
||||
<filter string="Year" icon="terp-go-year"
|
||||
domain="[]" context="{'group_by':'name'}" />
|
||||
domain="[]" context="{'group_by':'name'}" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." groups="base.group_extended">
|
||||
<field name="partner_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<newline/>
|
||||
<field name="creation_date"/>
|
||||
<field name="opening_date"/>
|
||||
<field name="date_closed"/>
|
||||
@@ -150,9 +150,9 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunity tree view -->
|
||||
<!-- Opportunity tree view -->
|
||||
|
||||
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
|
||||
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
|
||||
<field name="name">crm.lead.report.tree</field>
|
||||
<field name="model">crm.lead.report</field>
|
||||
<field name="type">tree</field>
|
||||
@@ -207,7 +207,7 @@
|
||||
<field name="act_window_id" ref="action_report_crm_lead"/>
|
||||
</record>
|
||||
|
||||
<record id="action_report_crm_opportunity" model="ir.actions.act_window">
|
||||
<record id="action_report_crm_opportunity" model="ir.actions.act_window">
|
||||
<field name="name">Opportunities Analysis</field>
|
||||
<field name="res_model">crm.lead.report</field>
|
||||
<field name="view_type">form</field>
|
||||
|
||||
+13
-16
@@ -679,30 +679,28 @@ class mrp_production(osv.osv):
|
||||
raw_product_todo = []
|
||||
final_product_todo = []
|
||||
|
||||
produced_qty = 0
|
||||
for produced_product in production.move_created_ids2:
|
||||
if (produced_product.scraped) or (produced_product.product_id.id<>production.product_id.id):
|
||||
continue
|
||||
produced_qty += produced_product.product_qty
|
||||
|
||||
if production_mode in ['consume','consume_produce']:
|
||||
# To consume remaining qty of raw materials
|
||||
consumed_products = {}
|
||||
produced_qty = 0
|
||||
for consumed_product in production.move_lines2:
|
||||
if consumed_product.scraped:
|
||||
continue
|
||||
if not consumed_products.get(consumed_product.product_id.id, False):
|
||||
consumed_products[consumed_product.product_id.id] = 0
|
||||
consumed_products[consumed_product.product_id.id] += consumed_product.product_qty
|
||||
|
||||
for produced_product in production.move_created_ids2:
|
||||
if produced_product.scraped:
|
||||
continue
|
||||
produced_qty += produced_product.product_qty
|
||||
consumed_products[consumed_product.product_id.id] -= consumed_product.product_qty
|
||||
|
||||
for raw_product in production.move_lines:
|
||||
consumed_qty = consumed_products.get(raw_product.product_id.id, 0)
|
||||
consumed_qty -= produced_qty
|
||||
rest_qty = production_qty - consumed_qty
|
||||
if rest_qty > production.product_qty:
|
||||
rest_qty = production.product_qty
|
||||
if rest_qty > 0:
|
||||
stock_mov_obj.action_consume(cr, uid, [raw_product.id], rest_qty, production.location_src_id.id, context=context)
|
||||
for f in production.product_lines:
|
||||
if f.product_id.id==raw_product.product_id.id:
|
||||
consumed_qty = consumed_products.get(raw_product.product_id.id, 0)
|
||||
rest_qty = production_qty * f.product_qty / production.product_qty - consumed_qty
|
||||
if rest_qty > 0:
|
||||
stock_mov_obj.action_consume(cr, uid, [raw_product.id], rest_qty, production.location_src_id.id, context=context)
|
||||
|
||||
if production_mode == 'consume_produce':
|
||||
# To produce remaining qty of final product
|
||||
@@ -725,7 +723,6 @@ class mrp_production(osv.osv):
|
||||
if rest_qty > 0 :
|
||||
stock_mov_obj.action_consume(cr, uid, [produce_product.id], production_qty, production.location_dest_id.id, context=context)
|
||||
|
||||
|
||||
for raw_product in production.move_lines2:
|
||||
new_parent_ids = []
|
||||
parent_move_ids = [x.id for x in raw_product.move_history_ids]
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"access_procurement_stock_worker","procurement.order stock_worker","model_procurement_order","stock.group_stock_user",1,1,1,1
|
||||
"access_mrp_production_stock_worker","mrp.production stock_worker","model_mrp_production","stock.group_stock_user",1,0,0,0
|
||||
"access_mrp_installer","mrp.installer","model_mrp_installer","base.group_system",1,1,1,1
|
||||
"access_mrp_product_produce","mrp.product.produce","model_mrp_product_produce","mrp.group_mrp_user",1,0,0,0
|
||||
"access_mrp_product_produce","mrp.product.produce","model_mrp_product_produce","mrp.group_mrp_user",1,1,1,1
|
||||
"access_mrp_change_production_qty","change.production.qty","model_change_production_qty","mrp.group_mrp_user",1,0,0,0
|
||||
"access_mrp_production_order","mrp.production.order","model_mrp_production_order","mrp.group_mrp_user",1,0,0,0
|
||||
"access_report_workcenter_load","report.workcenter.load","model_report_workcenter_load","mrp.group_mrp_manager",1,0,0,0
|
||||
|
||||
|
@@ -237,14 +237,12 @@
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking0}:
|
||||
date: '2010-04-30 16:53:36'
|
||||
partner_id: base.res_partner_asus
|
||||
address_id: base.res_partner_address_tang
|
||||
-
|
||||
I make my pickings done.
|
||||
-
|
||||
!python {model: stock.partial.picking}: |
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = pick_obj.search(cr, uid, [('type','=','in')])
|
||||
self.view_init(cr, uid, ['date','partner_id','address_id'],context={'active_ids': picking_ids})
|
||||
self.view_init(cr, uid, ['date'],context={'active_ids': picking_ids})
|
||||
self.do_partial(cr, uid, [1], context={'active_ids': picking_ids})
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'res_company_view.xml'
|
||||
#'security/ir.model.access.csv',
|
||||
],
|
||||
'demo_xml': [
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_inventory_tree" model="ir.ui.view">
|
||||
<field name="name">multi_company.default.tree</field>
|
||||
<field name="model">multi_company.default</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Multi Company">
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="object_id"/>
|
||||
<field name="field_id"/>
|
||||
<field name="expression" />
|
||||
<field name="sequence"/>
|
||||
<field name="company_dest_id"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_inventory_form" model="ir.ui.view">
|
||||
<field name="name">multi_company.default.form</field>
|
||||
<field name="model">multi_company.default</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Multi Company">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" colspan="6"/>
|
||||
<separator string="Matching" colspan="6"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="object_id"/>
|
||||
<field name="field_id" domain="[('model_id','=',object_id)]"/>
|
||||
<separator string="Condition" colspan="6"/>
|
||||
<field name="expression" colspan="4"/>
|
||||
<field name="sequence"/>
|
||||
<separator string="Returning" colspan="6"/>
|
||||
<field name="company_dest_id"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_inventory_search" model="ir.ui.view">
|
||||
<field name="name">multi_company.default.search</field>
|
||||
<field name="model">multi_company.default</field>
|
||||
<field name="type">search</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Multi Company">
|
||||
<field name="name" select="1"/>
|
||||
<field name="company_id" select="1" widget="selection"/>
|
||||
<field name="company_dest_id" select="1" widget="selection"/>
|
||||
<field name="object_id" select="1"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_inventory_form" model="ir.actions.act_window">
|
||||
<field name="name">Default Company per Object</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">multi_company.default</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="search_view_id" ref="view_inventory_search"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_custom_multicompany"
|
||||
name="Multi-Companies"
|
||||
parent="base.menu_custom"
|
||||
sequence="50"/>
|
||||
|
||||
<menuitem id="menu_action_inventory_form"
|
||||
action="action_inventory_form"
|
||||
parent="menu_custom_multicompany"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -221,7 +221,7 @@ class account_bank_statement(osv.osv):
|
||||
self.write(cr, uid, ids, {'date':time.strftime("%Y-%m-%d %H:%M:%S"), 'state':'open', 'name':number})
|
||||
return True
|
||||
|
||||
def button_confirm(self, cr, uid, ids, context=None):
|
||||
def button_confirm(self, cr, uid, ids, context={}):
|
||||
|
||||
""" Check the starting and ending detail of statement
|
||||
@return: True
|
||||
@@ -245,7 +245,7 @@ class account_bank_statement(osv.osv):
|
||||
|
||||
self.write(cr, uid, statement.id, {'balance_end_real':Decimal(str(val_statement_line))+Decimal(str(val2)),'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
|
||||
# self.write(cr, uid, statement.id, {'balance_end_real':bal_st+val_statement_line,'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
|
||||
return super(account_bank_statement, self).button_confirm(cr, uid, ids, context=None)
|
||||
return super(account_bank_statement, self).button_confirm(cr, uid, ids, context={})
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'draft'}, context=context)
|
||||
|
||||
@@ -576,7 +576,7 @@ class pos_order(osv.osv):
|
||||
val=cr.fetchone()
|
||||
val=val and val[0] or None
|
||||
if val:
|
||||
cr.execute("Update pos_order set date_validation='%s' where id = %d"%(val, order.id))
|
||||
cr.execute("Update pos_order set date_validation='%s', state_2 ='%s' where id = %d"%(val, 'accepted', order.id))
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
<menuitem name="Point of Sale" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
|
||||
<menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1"/>
|
||||
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="2" />
|
||||
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="29" />
|
||||
|
||||
<menuitem action="product.product_normal_action" id="menu_pos_products" parent="menu_point_of_sale_product" sequence="2" name="Products"/>
|
||||
|
||||
@@ -860,7 +860,7 @@
|
||||
</record>
|
||||
|
||||
<!-- Miscelleanous Operations/Reporting -->
|
||||
<menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="5"/>
|
||||
<menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="30"/>
|
||||
<menuitem name="Registers" parent="menu_point_rep" id="menu_point_report_register" sequence="0" />
|
||||
<menuitem name="Sales" parent="menu_point_rep" id="menu_point_report_sale" sequence="1" />
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P8">[[ repeatIn(o.lines,'line') ]]</para>
|
||||
<para style="terp_default_9b">[[ len(line.product_id.name) > 39 and line.product_id.name[:39] + '...' or line.product_id.name ]]</para>
|
||||
|
||||
<para style="terp_default_9b">[[ line.product_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][['%.f' % line.qty ]]</para>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<field name="quantity"/>
|
||||
<button icon='gtk-cancel' name="close_action"
|
||||
string="Close" type="object" />
|
||||
<button name="select_product" string="Contiue"
|
||||
<button name="select_product" string="Continue"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
</form>
|
||||
|
||||
@@ -37,14 +37,26 @@ class pos_close_statement(osv.osv_memory):
|
||||
@return : Blank Dictionary
|
||||
"""
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
list_statement = []
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
journal_lst = journal_obj.search(cr, uid, [('company_id', '=', company_id), ('auto_cash', '=', True), ('check_dtls', '=', False)])
|
||||
journal_ids = journal_obj.browse(cr, uid, journal_lst)
|
||||
for journal in journal_ids:
|
||||
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])
|
||||
statement_obj.button_confirm(cr, uid, ids)
|
||||
return {}
|
||||
list_statement = ids
|
||||
statement_obj.button_confirm(cr, uid, ids, context)
|
||||
if not list_statement:
|
||||
return {}
|
||||
return {
|
||||
'domain': "[('id','in', list_statement)]",
|
||||
'name': 'Close Statements',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.bank.statement',
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
||||
pos_close_statement()
|
||||
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Close Statements">
|
||||
<label string="Are you sure you want to close the statements ?" colspan="2"/>
|
||||
<newline/>
|
||||
<separator string="Are you sure you want to close the statements ?" colspan="4"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="No" />
|
||||
string="No" colspan="1" />
|
||||
<button name="close_statement" string="Yes"
|
||||
colspan="1" type="object" icon="gtk-ok"/>
|
||||
</form>
|
||||
@@ -37,4 +36,4 @@
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
||||
@@ -37,9 +37,11 @@ class pos_open_statement(osv.osv_memory):
|
||||
@param context: A standard dictionary
|
||||
@return : Blank Directory
|
||||
"""
|
||||
list_statement = []
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
singer_obj = self.pool.get('singer.statement')
|
||||
sequence_obj = self.pool.get('ir.sequence')
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
journal_lst = journal_obj.search(cr, uid, [('company_id', '=', company_id), ('auto_cash', '=', True)])
|
||||
journal_ids = journal_obj.browse(cr, uid, journal_lst)
|
||||
@@ -54,7 +56,6 @@ class pos_open_statement(osv.osv_memory):
|
||||
cr.execute(sql)
|
||||
st_id = cr.fetchone()
|
||||
number = ''
|
||||
sequence_obj = self.pool.get('ir.sequence')
|
||||
if journal.statement_sequence_id:
|
||||
number = sequence_obj.get_id(cr, uid, journal.id)
|
||||
else:
|
||||
@@ -74,6 +75,7 @@ class pos_open_statement(osv.osv_memory):
|
||||
statement_id = cr.fetchone()[0]
|
||||
if st_id:
|
||||
statemt_id = statement_obj.browse(cr, uid, st_id[0])
|
||||
list_statement.append(statemt_id.id)
|
||||
if statemt_id and statemt_id.ending_details_ids:
|
||||
statement_obj.write(cr, uid, [statement_id], {
|
||||
'balance_start': statemt_id.balance_end,
|
||||
@@ -86,7 +88,15 @@ class pos_open_statement(osv.osv_memory):
|
||||
'number': i.number,
|
||||
'starting_id': statement_id,
|
||||
})
|
||||
cr.commit()
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,list_statement))+"])]",
|
||||
'name': 'Open Statement',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.bank.statement',
|
||||
'view_id': False, # TODO: REFERENCE RIGHT VIEWS
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return {}
|
||||
|
||||
pos_open_statement()
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Statements">
|
||||
<label string="Are you sure you want to open the statements ?" colspan="2"/>
|
||||
<newline/>
|
||||
<separator string="Are you sure you want to open the statements ?" colspan="4"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="No" />
|
||||
<button name="open_statement" string="Yes"
|
||||
colspan="1" type="object" icon="gtk-ok"/>
|
||||
type="object" icon="gtk-ok"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -36,4 +35,4 @@
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Receipt :">
|
||||
<separator string="Print the receipt of the sale" colspan="4"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button name="print_report" string="Print Report"
|
||||
|
||||
@@ -247,7 +247,8 @@ class add_product(osv.osv_memory):
|
||||
"""
|
||||
|
||||
active_id=context.get('active_id', False)
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
data = self.read(cr, uid, ids)
|
||||
data = data and data[0] or False
|
||||
if active_id:
|
||||
order_obj = self.pool.get('pos.order')
|
||||
lines_obj = self.pool.get('pos.order.line')
|
||||
@@ -327,7 +328,6 @@ class add_product(osv.osv_memory):
|
||||
return_boj=self.pool.get('pos.return')
|
||||
return_id=return_boj.search(cr,uid,[])
|
||||
data=return_boj.read(cr,uid,return_id,[])[0]
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_id in order_obj.browse(cr, uid, active_ids, context=context):
|
||||
prop_ids =property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')])
|
||||
|
||||
@@ -361,7 +361,7 @@ class procurement_order(osv.osv):
|
||||
ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id])
|
||||
cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,))
|
||||
if not cr.fetchone()[0]:
|
||||
cr.execute('update procurement_order set message=%s where id=%s', (_('Stock is not enough and No minimum orderpoint rule defined'), procurement.id))
|
||||
cr.execute('update procurement_order set message=%s where id=%s', (_('Not enough stock and no minimum orderpoint rule defined.'), procurement.id))
|
||||
return ok
|
||||
|
||||
def action_produce_assign_service(self, cr, uid, ids, context={}):
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_id" ref="product_category_tree_view"/>
|
||||
</record>
|
||||
<menuitem
|
||||
action="product_category_action"
|
||||
id="product.menu_products_category"
|
||||
parent="base.menu_product"
|
||||
sequence="0"/>
|
||||
<record id="product_category_action_form" model="ir.actions.act_window">
|
||||
<field name="name">Products Categories</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
</record>
|
||||
|
||||
<record id="product_comp_rule" model="ir.rule">
|
||||
<field name="name" >Product multi-company</field>
|
||||
<field name="name" >Product multi-company</field>
|
||||
<field name="model_id" ref="model_product_template"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="group_product_variant" model="res.groups" context="{'noadmin':True}">
|
||||
<field name="name">Product / Variant</field>
|
||||
<field name="name">Useability / Product Variant</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -37,7 +37,6 @@ class stock_production_lot(osv.osv):
|
||||
result.append((line.id, line.name))
|
||||
return result
|
||||
|
||||
|
||||
def _get_date(dtype):
|
||||
"""Return a function to compute the limit date for this type"""
|
||||
def calc_date(self, cr, uid, context=None):
|
||||
|
||||
@@ -26,55 +26,45 @@ from tools.translate import _
|
||||
import netsvc
|
||||
import pooler
|
||||
import time
|
||||
import datetime
|
||||
import datetime, time
|
||||
import wizard
|
||||
|
||||
class stock_partial_lot_picking(osv.osv_memory):
|
||||
_inherit = "stock.partial.picking"
|
||||
_name = "stock.partial.picking"
|
||||
_description = "Partial Picking"
|
||||
|
||||
def do_partial(self, cr, uid, ids, context):
|
||||
res = super(stock_partial_lot_picking, self).do_partial(cr, uid, ids, context=context)
|
||||
class stock_production_lot(osv.osv):
|
||||
_inherit = "stock.production.lot"
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
new_id = super(stock_production_lot, self).create(cr, uid, vals, context=context)
|
||||
prodlot_obj = self.pool.get('stock.production.lot')
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = context.get('active_ids', False)
|
||||
partial = self.browse(cr, uid, ids[0], context)
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids):
|
||||
for m in pick.move_lines:
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids):
|
||||
for m in pick.move_lines:
|
||||
res = {}
|
||||
if (pick.type == 'in') and m.prodlot_id:
|
||||
if not m.prodlot_id.life_date:
|
||||
date_life = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.life_time))
|
||||
res['life_date'] = date_life.strftime('%Y-%m-%d')
|
||||
if not m.prodlot_id.use_date:
|
||||
date_use = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.use_time))
|
||||
res['use_date'] = date_use.strftime('%Y-%m-%d')
|
||||
if not m.prodlot_id.removal_date:
|
||||
date_removal = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.removal_time))
|
||||
res['removal_date'] = date_removal.strftime('%Y-%m-%d')
|
||||
if not m.prodlot_id.alert_date:
|
||||
date_alert = (datetime.datetime.strptime(partial.date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=m.product_id.alert_time))
|
||||
res['alert_date'] = date_alert.strftime('%Y-%m-%d')
|
||||
prodlot_obj.write(cr, uid, [m.prodlot_id.id], res)
|
||||
return res
|
||||
stock_partial_lot_picking()
|
||||
prod = prodlot_obj.browse(cr, uid, new_id, context=context)
|
||||
res = {}
|
||||
current_date = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
if not prod.life_date:
|
||||
date_life = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.life_time))
|
||||
res['life_date'] = date_life.strftime('%Y-%m-%d')
|
||||
if not prod.use_date:
|
||||
date_use = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.use_time))
|
||||
res['use_date'] = date_use.strftime('%Y-%m-%d')
|
||||
if not prod.removal_date:
|
||||
date_removal = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.removal_time))
|
||||
res['removal_date'] = date_removal.strftime('%Y-%m-%d')
|
||||
if not prod.alert_date:
|
||||
date_alert = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.alert_time))
|
||||
res['alert_date'] = date_alert.strftime('%Y-%m-%d')
|
||||
prodlot_obj.write(cr, uid, [prod.id], res)
|
||||
return new_id
|
||||
stock_production_lot()
|
||||
|
||||
class stock_move_split_lines_exist(osv.osv_memory):
|
||||
_name = "stock.move.split.lines.exist"
|
||||
_inherit = "stock.move.split.lines.exist"
|
||||
_inherit = "stock.move.split.lines"
|
||||
_columns = {
|
||||
'date': fields.date('Expiry Date'),
|
||||
}
|
||||
# TODO: use this date instead of default one
|
||||
def on_change_product(self, cr, uid, ids, product_id):
|
||||
if not product_id:
|
||||
return {'value':{'date': False}}
|
||||
day_life = self.pool.get('product.product').browse(cr, uid, product_id).life_time
|
||||
date_life = (datetime.datetime.now() + datetime.timedelta(days=day_life))
|
||||
return {'value':{'date': date_life.strftime('%Y-%m-%d')
|
||||
}}
|
||||
|
||||
|
||||
return {'value':
|
||||
{'date': date_life.strftime('%Y-%m-%d')}
|
||||
}
|
||||
stock_move_split_lines_exist()
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_split_in_lots" model="ir.ui.view">
|
||||
<field name="name">Split in lots</field>
|
||||
<field name="model">stock.move.split</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">Split in lots</field>
|
||||
<field name="model">stock.move.split</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="stock.view_split_in_lots"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//form/group/field[@name='line_exist_ids']/tree/field[@name='prodlot_id']" position="replace">
|
||||
<field name="prodlot_id" on_change="on_change_product(parent.product_id)"/>
|
||||
<xpath expr="//form/group/field[@name='line_ids']/tree/field[@name='name']" position="replace">
|
||||
<field name="name" on_change="on_change_product(parent.product_id)"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/group/field[@name='line_exist_ids']/tree/field[@name='quantity']" position="after">
|
||||
<xpath expr="//form/group/field[@name='line_ids']/tree/field[@name='quantity']" position="after">
|
||||
<field name="date"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_product_manufacturer_attribute","product.manufacturer.attribute","model_product_manufacturer_attribute","product.group_uos",1,0,0,0
|
||||
"access_product_manufacturer_attribute","product.manufacturer.attribute","model_product_manufacturer_attribute",,1,0,0,0
|
||||
"access_product_manufacturer_attribute_manager","product.manufacturer.attribute","model_product_manufacturer_attribute","product.group_product_manager",1,1,1,1
|
||||
"access_partner_manufacturer","res.partner.manufacturer","model_res_partner_manufacturer","product.group_uos",1,0,0,0
|
||||
"access_partner_manufacturer_manager","res.partner.manufacturer","model_res_partner_manufacturer","product.group_uos",1,1,1,1
|
||||
"access_partner_manufacturer","res.partner.manufacturer","model_res_partner_manufacturer",,1,0,0,0
|
||||
"access_partner_manufacturer_manager","res.partner.manufacturer","model_res_partner_manufacturer","product.group_product_manager",1,1,1,1
|
||||
|
||||
|
@@ -148,20 +148,22 @@ class purchase_order(osv.osv):
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Order Reference', size=64, required=True, select=True),
|
||||
'origin': fields.char('Source Document', size=64,
|
||||
'name': fields.char('Order Reference', size=64, required=True, select=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
|
||||
'origin': fields.char('Source Document', size=64, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
|
||||
help="Reference of the document that generated this purchase order request."
|
||||
),
|
||||
'partner_ref': fields.char('Supplier Reference', size=64),
|
||||
'partner_ref': fields.char('Supplier Reference', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, size=64),
|
||||
'date_order':fields.date('Date Ordered', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}, help="Date on which this document has been created."),
|
||||
'date_approve':fields.date('Date Approved', readonly=1),
|
||||
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
|
||||
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, states={'posted':[('readonly',True)]}),
|
||||
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', states={'posted':[('readonly',True)]},
|
||||
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True,
|
||||
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
|
||||
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',
|
||||
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
|
||||
help="Put an address if you want to deliver directly from the supplier to the customer." \
|
||||
"In this case, it will remove the warehouse link and set the customer location."
|
||||
),
|
||||
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', states={'posted':[('readonly',True)]}),
|
||||
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
|
||||
'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')]),
|
||||
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
|
||||
'state': fields.selection([('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Waiting Supplier Ack'), ('approved', 'Approved'),('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True),
|
||||
@@ -180,7 +182,7 @@ class purchase_order(osv.osv):
|
||||
"From Picking: a draft invoice will be pre-generated based on validated receptions.\n" \
|
||||
"Manual: no invoice will be pre-generated. The accountant will have to encode manually."
|
||||
),
|
||||
'minimum_planned_date':fields.function(_minimum_planned_date, fnct_inv=_set_minimum_planned_date, method=True,store=True, string='Expected Date', type='datetime', 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,store=True, string='Expected Date', type='date', help="This is computed as the minimum scheduled date of all purchase order lines' products."),
|
||||
'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),
|
||||
@@ -596,7 +598,7 @@ class purchase_order_line(osv.osv):
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=256, required=True),
|
||||
'product_qty': fields.float('Quantity', required=True, digits=(16,2)),
|
||||
'date_planned': fields.datetime('Scheduled date', required=True),
|
||||
'date_planned': fields.date('Scheduled date', required=True),
|
||||
'taxes_id': fields.many2many('account.tax', 'purchase_order_taxe', 'ord_id', 'tax_id', 'Taxes'),
|
||||
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True),
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--<menuitem icon="terp-purchase" id="base.menu_purchase_root" name="Purchase Management"
|
||||
groups="group_purchase_user"/>-->
|
||||
<menuitem icon="terp-purchase" id="base.menu_purchase_root" name="Purchases"
|
||||
groups="group_purchase_user" sequence="3"/>
|
||||
<menuitem id="menu_procurement_management" name="Purchase Management"
|
||||
@@ -31,31 +29,34 @@
|
||||
</record>
|
||||
|
||||
<!--supplier menu-->
|
||||
<menuitem id="base.menu_procurement_management_supplier" name="Address Book"
|
||||
<menuitem id="base.menu_procurement_management_supplier" name="Address Book"
|
||||
parent="base.menu_purchase_root" sequence="3"/>
|
||||
<menuitem id="base.menu_procurement_management_supplier_name" name="Suppliers"
|
||||
parent="base.menu_procurement_management_supplier" action="base.action_partner_supplier_form" sequence="1"/>
|
||||
<menuitem action="action_supplier_address_form" id="menu_purchases_partner_address_form"
|
||||
parent="base.menu_procurement_management_supplier" sequence="3"/>
|
||||
<menuitem id="base.menu_procurement_management_supplier_name" name="Suppliers"
|
||||
parent="base.menu_procurement_management_supplier"
|
||||
action="base.action_partner_supplier_form" sequence="1"/>
|
||||
|
||||
<!--Inventory control-->
|
||||
<menuitem id="menu_procurement_management_inventory" name="Inventory Control"
|
||||
parent="base.menu_purchase_root" sequence="4"/>
|
||||
<menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_inventory"
|
||||
name="Incoming Shipments" sequence="9"/>
|
||||
<menuitem action="stock.action_reception_picking_move" id="menu_action_picking_tree_in_move" parent="menu_procurement_management_inventory" sequence="11"/>
|
||||
name="Incoming Shipments" sequence="9"/>
|
||||
<menuitem action="stock.action_reception_picking_move" id="menu_action_picking_tree_in_move"
|
||||
parent="menu_procurement_management_inventory" sequence="11"/>
|
||||
|
||||
<!--Invoice control-->
|
||||
<menuitem id="menu_procurement_management_invoice" name="Invoice Control"
|
||||
parent="base.menu_purchase_root" sequence="6"/>
|
||||
<menuitem name="Pending Invoices" id="menu_procurement_management_pending_invoice" action="account.action_invoice_tree_pending_invoice"
|
||||
parent="menu_procurement_management_invoice" sequence="13"/>
|
||||
<menuitem id="menu_procurement_management_invoice" name="Invoice Control"
|
||||
parent="base.menu_purchase_root" sequence="6"/>
|
||||
<menuitem name="Supplier Invoices to Receive"
|
||||
id="menu_procurement_management_pending_invoice"
|
||||
action="account.action_invoice_tree_pending_invoice"
|
||||
parent="menu_procurement_management_invoice"
|
||||
sequence="13"/>
|
||||
|
||||
<!--product menu-->
|
||||
<menuitem id="menu_procurement_management_product" name="Product"
|
||||
parent="base.menu_purchase_root" sequence="8"/>
|
||||
<menuitem id="menu_procurement_management_product" name="Products"
|
||||
parent="base.menu_purchase_root" sequence="8"/>
|
||||
<menuitem name="Products" id="menu_procurement_partner_contact_form" action="product.product_normal_action_puchased"
|
||||
parent="menu_procurement_management_product"/>
|
||||
parent="menu_procurement_management_product"/>
|
||||
|
||||
<record model="ir.ui.view" id="purchase_order_calendar">
|
||||
<field name="name">purchase.order.calendar</field>
|
||||
@@ -94,7 +95,7 @@
|
||||
<field name="invoiced"/>
|
||||
<newline/>
|
||||
<field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection"/>
|
||||
<field name="origin"/>
|
||||
<field name="partner_ref"/>
|
||||
<field name="shipped"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
@@ -103,17 +104,16 @@
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[('supplier','=', 1)]"/>
|
||||
<field name="partner_address_id"/>
|
||||
<field domain="[('type','=','purchase')]" name="pricelist_id" groups="base.group_extended"/>
|
||||
<field name="partner_ref"/>
|
||||
<field name="origin" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
<field colspan="4" name="order_line" nolabel="1" mode="tree,form">
|
||||
<tree colors="red:date_planned<=current_date;black:date_planned>current_date" string="Purchase Order Lines">
|
||||
<field name="date_planned"/>
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="price_subtotal" groups="base.group_extended"/>
|
||||
<field name="price_subtotal"/>
|
||||
</tree>
|
||||
<!-- default form view -->
|
||||
</field>
|
||||
@@ -136,8 +136,8 @@
|
||||
<button name="invoice_ok" states="except_invoice" string="Manually Corrected" icon="gtk-convert"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Delivery & Invoices" groups="account.group_account_user">
|
||||
<group colspan="2" col="2" groups="base.group_extended">
|
||||
<page string="Delivery & Invoices" groups="base.group_extended">
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Delivery" colspan="2"/>
|
||||
<field name="dest_address_id" on_change="onchange_dest_address_id(dest_address_id)"/>
|
||||
<field name="minimum_planned_date"/>
|
||||
@@ -169,12 +169,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Purchase Order">
|
||||
<group col='10' colspan='4'>
|
||||
<filter icon="terp-document-new" name="draft" string="Quotations" domain="[('state','=','draft')]" separator="1"/>
|
||||
<filter icon="terp-camera_test" name="confirmed" string="To Approve" domain="[('state','in',('wait','confirmed'))]" separator="1"/>
|
||||
<filter icon="terp-check" name="approved" string="Approved" domain="[('state','in',('approved','done'))]" separator="1"/>
|
||||
<filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" separator="1"/>
|
||||
<filter icon="terp-document-new" name="draft" string="Quotations" domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-accessories-archiver" name="sale_ok" string="Sales" domain="[('state','<>','draft'),('state','<>','cancel')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gtk-go-back-rtl" string="To Invoice" domain="[('invoiced','=',1)]" separator="1"/>
|
||||
<filter icon="terp-camera_test" name="confirmed" string="To Approve" domain="[('state','in',('wait','confirmed'))]" separator="1"/>
|
||||
<filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" separator="1"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1" string="Reference"/>
|
||||
<field name="partner_id" select="1"/>
|
||||
@@ -254,7 +253,6 @@
|
||||
<field name="price_unit"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="account_analytic_id" colspan="4" groups="base.group_extended"/>
|
||||
<field name="price_subtotal" readonly="1"/>
|
||||
<group colspan="4" col="4" groups="base.group_extended">
|
||||
<separator colspan="4" string="Taxes"/>
|
||||
<field colspan="4" nolabel="1" name="taxes_id"
|
||||
@@ -275,9 +273,6 @@
|
||||
<field colspan="4" name="invoice_lines" nolabel="1" widget="many2many"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group>
|
||||
<field name="state" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -347,7 +342,7 @@
|
||||
-->
|
||||
|
||||
<record id="purchase_line_form_action2" model="ir.actions.act_window">
|
||||
<field name="name">Lines To Invoices</field>
|
||||
<field name="name">Purchase Lines not Invoiced</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.order.line</field>
|
||||
<field name="domain">[('state','in',('confirmed','done')), ('invoiced','=',False)]</field>
|
||||
@@ -367,8 +362,12 @@
|
||||
<field name="view_id" ref="purchase_order_line_form"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action2"/>
|
||||
</record>
|
||||
<menuitem action="purchase_line_form_action2" id="menu_purchase_line_order_draft"
|
||||
parent="menu_procurement_management_invoice" sequence="12"/>
|
||||
<menuitem
|
||||
action="purchase_line_form_action2"
|
||||
id="menu_purchase_line_order_draft"
|
||||
groups="base.group_extended"
|
||||
parent="menu_procurement_management_invoice"
|
||||
sequence="12"/>
|
||||
|
||||
<!--
|
||||
Procurements
|
||||
|
||||
@@ -52,7 +52,7 @@ class sale_report(osv.osv):
|
||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
|
||||
'price_total':fields.float('Total Price', readonly=True),
|
||||
'delay':fields.float('Days to Close', digits=(16,2), readonly=True),
|
||||
'delay':fields.float('Commitment Delay', digits=(16,2), readonly=True),
|
||||
'price_average':fields.float('Average Price', readonly=True,group_operator="avg"),
|
||||
'categ_id': fields.many2one('product.category','Category of Product', readonly=True),
|
||||
'nbr':fields.integer('# of Lines', readonly=True),
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<field name="uom_name" invisible="not context.get('set_visible',False)"/>
|
||||
<field name="price_average" avg="Average Price"/>
|
||||
<field name="price_total" sum="Total Price"/>
|
||||
<field name="delay" avg="Days to Close"/>
|
||||
<field name="delay" avg="Commitment Delay"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="analytic_account_id" invisible="1"/>
|
||||
</tree>
|
||||
|
||||
+9
-24
@@ -623,6 +623,7 @@ class sale_order(osv.osv):
|
||||
picking_id = False
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid).company_id
|
||||
for order in self.browse(cr, uid, ids, context={}):
|
||||
proc_ids = []
|
||||
output_id = order.shop_id.warehouse_id.lot_output_id.id
|
||||
picking_id = False
|
||||
for line in order.order_line:
|
||||
@@ -631,6 +632,7 @@ class sale_order(osv.osv):
|
||||
date_planned = (date_planned - relativedelta(company.security_lead)).strftime('%Y-%m-%d %H:%M:%S')
|
||||
if line.state == 'done':
|
||||
continue
|
||||
move_id = False
|
||||
if line.product_id and line.product_id.product_tmpl_id.type in ('product', 'consu'):
|
||||
location_id = order.shop_id.warehouse_id.lot_stock_id.id
|
||||
if not picking_id:
|
||||
@@ -671,8 +673,9 @@ class sale_order(osv.osv):
|
||||
'note': line.notes,
|
||||
'company_id': order.company_id.id,
|
||||
})
|
||||
if line.product_id:
|
||||
proc_id = self.pool.get('procurement.order').create(cr, uid, {
|
||||
'name': order.name,
|
||||
'name': line.name,
|
||||
'origin': order.name,
|
||||
'date_planned': date_planned,
|
||||
'product_id': line.product_id.id,
|
||||
@@ -688,36 +691,18 @@ class sale_order(osv.osv):
|
||||
'property_ids': [(6, 0, [x.id for x in line.property_ids])],
|
||||
'company_id': order.company_id.id,
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
|
||||
proc_ids.append(proc_id)
|
||||
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
|
||||
elif line.product_id and line.product_id.product_tmpl_id.type == 'service':
|
||||
proc_id = self.pool.get('procurement.order').create(cr, uid, {
|
||||
'name': line.name,
|
||||
'origin': order.name,
|
||||
'date_planned': date_planned,
|
||||
'product_id': line.product_id.id,
|
||||
'product_qty': line.product_uom_qty,
|
||||
'product_uom': line.product_uom.id,
|
||||
'location_id': order.shop_id.warehouse_id.lot_stock_id.id,
|
||||
'procure_method': line.type,
|
||||
'property_ids': [(6, 0, [x.id for x in line.property_ids])],
|
||||
'company_id': order.company_id.id,
|
||||
})
|
||||
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
|
||||
else:
|
||||
#
|
||||
# No procurement because no product in the sale.order.line.
|
||||
#
|
||||
pass
|
||||
|
||||
val = {}
|
||||
if picking_id:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||
|
||||
for proc_id in proc_ids:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
|
||||
|
||||
if order.state == 'shipping_except':
|
||||
val['state'] = 'progress'
|
||||
|
||||
|
||||
@@ -110,10 +110,10 @@
|
||||
<form string="Sales order">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name"/>
|
||||
<field name="client_order_ref"/>
|
||||
<field name="shipped"/>
|
||||
<field name="date_order"/>
|
||||
<field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="base.group_extended"/>
|
||||
<field name="shipped"/>
|
||||
<field name="client_order_ref"/>
|
||||
<field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection"/>
|
||||
<field name="invoiced"/>
|
||||
</group>
|
||||
<notebook colspan="5">
|
||||
@@ -264,8 +264,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Sales Order">
|
||||
<filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-check" string="Running" domain="[('state','in',('manual','progress'))]"/>
|
||||
<filter icon="terp-gtk-go-back-rtl" string="Sales To Invoice" domain="[('state','=','manual')]"/>
|
||||
<filter icon="terp-check" string="Sales" domain="[('state','in',('manual','progress'))]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gtk-go-back-rtl" string="To Invoice" domain="[('state','=','manual')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="partner_id" select="1"/>
|
||||
@@ -361,7 +362,6 @@
|
||||
<field name="product_uom" string="UoM"/>
|
||||
<field name="salesman_id"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="th_weight"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -438,7 +438,6 @@
|
||||
<field name="product_id"/>
|
||||
<field name="salesman_id">
|
||||
<filter icon="terp-dolar" domain="[('salesman_id','=',uid)]" help="My Sale Order Lines"/>
|
||||
<filter icon="terp-personal+" domain="[('salesman_id','child_of',[uid])]" help="My Departments Sale Order Lines"/>
|
||||
</field>
|
||||
<newline/>
|
||||
<group expand="context.get('report',False)" string="Group By..." colspan="9" col="8">
|
||||
@@ -472,7 +471,9 @@
|
||||
<field name="order_id"/>
|
||||
<field name="order_partner_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="state"/>
|
||||
<field name="salesman_id">
|
||||
<filter icon="terp-dolar" domain="[('salesman_id','=',uid)]" help="My Sale Order Lines"/>
|
||||
</field>
|
||||
<newline />
|
||||
<group expand="0" string="Group By..." colspan="9" col="8">
|
||||
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(ob['product'],'p') ]]</para>
|
||||
<blockTable colWidths="72.0,35.0,133.0,47.0,58.0,33.0,60.0,43.0" repeatRows="1" style="Table4">
|
||||
<blockTable colWidths="20.0,120.0,133.0,47.0,58.0,33.0,60.0,43.0" repeatRows="1" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P2">
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
<para style="terp_default_9">[ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ move_lines.tracking_id and move_lines.tracking_id.name or '' ]]</para>
|
||||
<para style="terp_default_9">[[ (move_lines.tracking_id and move_lines.tracking_id.name) or '/' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
|
||||
@@ -281,11 +281,14 @@
|
||||
<para style="terp_default_1cm_above_space">[[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]]</para>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]]</para>
|
||||
<blockTable colWidths="257.0,57.0,62.0,46.0,26.0,74.0" style="Move_Line_Content_Other_State">
|
||||
<blockTable colWidths="197.0,68.0,61.0,57,46.0,26.0,74.0" style="Move_Line_Content_Other_State">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ (move_lines.tracking_id and move_lines.tracking_id.name) or '/' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
|
||||
</td>
|
||||
@@ -303,15 +306,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
@@ -32,5 +32,5 @@ class picking(report_sxw.rml_parse):
|
||||
})
|
||||
|
||||
report_sxw.report_sxw('report.stock.picking.list','stock.picking','addons/stock/report/picking.rml',parser=picking)
|
||||
report_sxw.report_sxw('report.stock.packing.list','stock.picking','addons/stock/report/packing.rml',parser=picking)
|
||||
report_sxw.report_sxw('report.stock.packing.list2','stock.picking','addons/stock/report/packing.rml',parser=picking)
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -25,7 +25,7 @@ from osv import fields,osv
|
||||
|
||||
class report_stock_move(osv.osv):
|
||||
_name = "report.stock.move"
|
||||
_description = "Stock Statistics"
|
||||
_description = "Moves Statistics"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_planned': fields.date('Date', readonly=True),
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
src_model="product.product"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
<act_window
|
||||
<act_window
|
||||
domain="[('tracking_id', '=', active_id)]"
|
||||
id="act_stock_tracking_lot_2_stock_report_tracklots"
|
||||
name="Stock" res_model="stock.report.tracklots"
|
||||
|
||||
+31
-79
@@ -410,22 +410,6 @@ class stock_tracking(osv.osv):
|
||||
_name = "stock.tracking"
|
||||
_description = "Stock Tracking Lots"
|
||||
|
||||
def get_create_tracking_lot(self, cr, uid, ids, tracking_lot):
|
||||
"""
|
||||
@param tracking_lot: Name of tracking lot
|
||||
@return:
|
||||
"""
|
||||
tracking_lot_list = self.search(cr, uid, [('name', '=', tracking_lot)],
|
||||
limit=1)
|
||||
if tracking_lot_list:
|
||||
tracking_lot = tracking_lot_list[0]
|
||||
tracking_obj = self.browse(cr, uid, tracking_lot)
|
||||
if not tracking_obj:
|
||||
tracking_lot_vals = {
|
||||
'name': tracking_lot
|
||||
}
|
||||
tracking_lot = self.create(cr, uid, tracking_lot_vals)
|
||||
return tracking_lot
|
||||
def checksum(sscc):
|
||||
salt = '31' * 8 + '3'
|
||||
sum = 0
|
||||
@@ -445,7 +429,6 @@ class stock_tracking(osv.osv):
|
||||
'move_ids': fields.one2many('stock.move', 'tracking_id', 'Moves Tracked'),
|
||||
'date': fields.datetime('Created Date', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'name': make_sscc,
|
||||
@@ -1378,9 +1361,7 @@ class stock_move(osv.osv):
|
||||
'move_history_ids': fields.many2many('stock.move', 'stock_move_history_ids', 'parent_id', 'child_id', 'Move History'),
|
||||
'move_history_ids2': fields.many2many('stock.move', 'stock_move_history_ids', 'child_id', 'parent_id', 'Move History'),
|
||||
'picking_id': fields.many2one('stock.picking', 'Picking List', select=True),
|
||||
|
||||
'note': fields.text('Notes'),
|
||||
|
||||
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
|
||||
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
|
||||
\nThe state is \'Waiting\' if the move is waiting for another one.'),
|
||||
@@ -1657,7 +1638,7 @@ class stock_move(osv.osv):
|
||||
done = []
|
||||
count = 0
|
||||
pickings = {}
|
||||
for move in self.browse(cr, uid, ids):
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
if move.product_id.type == 'consu':
|
||||
if move.state in ('confirmed', 'waiting'):
|
||||
done.append(move.id)
|
||||
@@ -1692,32 +1673,17 @@ class stock_move(osv.osv):
|
||||
return count
|
||||
|
||||
def setlast_tracking(self, cr, uid, ids, context=None):
|
||||
new_move = []
|
||||
update_val = {}
|
||||
ir_sequence_obj = self.pool.get('ir.sequence')
|
||||
tracking_obj = self.pool.get('stock.tracking')
|
||||
tracking = False
|
||||
tracking = context.get('tracking', False)
|
||||
# import pdb; pdb.set_trace()
|
||||
if tracking:
|
||||
tracking_id = tracking_obj.search(cr, uid, ['name','=', tracking])
|
||||
if prodlot_id:
|
||||
update_val['prodlot_id'] = prodlot_id
|
||||
else:
|
||||
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
|
||||
last_track = [line.tracking_id.id for line in self.browse(cr, uid, ids)[0].picking_id.move_lines if line.tracking_id]
|
||||
if not last_track:
|
||||
last_track = tracking_obj.create(cr, uid, {}, context=context)
|
||||
else:
|
||||
last_track = [line.tracking_id for line in self.browse(cr, uid, ids)[0].picking_id.move_lines if line.tracking_id]
|
||||
if not last_track:
|
||||
track_ids= tracking_obj.search(cr, uid, [])
|
||||
last_track = [track for track in tracking_obj.browse(cr, uid, track_ids)]
|
||||
last_track.sort(key=lambda p: p.date, reverse=True)
|
||||
last_track_id = last_track and last_track[0].id
|
||||
update_val['tracking_id'] = last_track_id
|
||||
self.write(cr, uid, ids, update_val)
|
||||
last_track.sort()
|
||||
last_track = last_track[-1]
|
||||
self.write(cr, uid, ids, {'tracking_id': last_track})
|
||||
return True
|
||||
|
||||
|
||||
#
|
||||
# Cancel move => cancel others move and pickings
|
||||
#
|
||||
@@ -1802,7 +1768,8 @@ class stock_move(osv.osv):
|
||||
product_obj=self.pool.get('product.product')
|
||||
move_obj = self.pool.get('account.move')
|
||||
for move in self.browse(cr, uid, ids):
|
||||
if move.picking_id: picking_ids.append(move.picking_id.id)
|
||||
if move.picking_id:
|
||||
picking_ids.append(move.picking_id.id)
|
||||
if move.move_dest_id.id and (move.state != 'done'):
|
||||
cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id))
|
||||
if move.move_dest_id.state in ('waiting', 'confirmed'):
|
||||
@@ -1852,32 +1819,31 @@ class stock_move(osv.osv):
|
||||
'line_id': line,
|
||||
'ref': move.picking_id and move.picking_id.name,
|
||||
})
|
||||
tracking_lot = False
|
||||
if context:
|
||||
tracking_lot = context.get('tracking_lot', False)
|
||||
if tracking_lot:
|
||||
rec_id = context and context.get('active_id', False)
|
||||
tracking = self.pool.get('stock.tracking')
|
||||
tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
|
||||
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'), 'tracking_id': tracking_lot or False})
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
|
||||
for pick in picking_obj.browse(cr, uid, picking_ids):
|
||||
if all(move.state == 'done' for move in pick.move_lines):
|
||||
picking_obj.action_done(cr, uid, [pick.id])
|
||||
|
||||
for (id,name) in picking_obj.name_get(cr, uid, picking_ids):
|
||||
message = _('Picking ') + " '" + name + "' "+ _("is processed")
|
||||
self.log(cr, uid, id, message)
|
||||
# This can be removed
|
||||
#tracking_lot = False
|
||||
#if context:
|
||||
# tracking_lot = context.get('tracking_lot', False)
|
||||
# if tracking_lot:
|
||||
# rec_id = context and context.get('active_id', False)
|
||||
# tracking = self.pool.get('stock.tracking')
|
||||
# tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
|
||||
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'stock.move', id, cr)
|
||||
|
||||
# We should remove this
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
for pick in picking_obj.browse(cr, uid, picking_ids):
|
||||
if len([move.state == 'done' for move in pick.move_lines]) == len(pick.move_lines):
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
|
||||
if len([(move.state in ('done','cancelled')) for move in pick.move_lines]) == len(pick.move_lines):
|
||||
picking_obj.action_done(cr, uid, [pick.id])
|
||||
|
||||
for (id,name) in picking_obj.name_get(cr, uid, picking_ids):
|
||||
message = _('Document') + " '" + name + "' "+ _("is processed")
|
||||
self.log(cr, uid, id, message)
|
||||
|
||||
return True
|
||||
|
||||
def create_account_move(self, cr, uid, move,account_id,account_variation,amount, context=None):
|
||||
@@ -1904,6 +1870,7 @@ class stock_move(osv.osv):
|
||||
'partner_id': partner_id,
|
||||
})]
|
||||
return lines
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -1919,19 +1886,9 @@ class stock_move(osv.osv):
|
||||
@return: Production lot id
|
||||
"""
|
||||
prodlot_obj = self.pool.get('stock.production.lot')
|
||||
ir_sequence_obj = self.pool.get('ir.sequence')
|
||||
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
|
||||
if not sequence:
|
||||
raise osv.except_osv(_('Error!'), _('No production sequence defined'))
|
||||
prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix': prefix}, {'product_id': product_id})
|
||||
prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
|
||||
ref = ','.join(map(lambda x:str(x),ids))
|
||||
if prodlot.ref:
|
||||
ref = '%s, %s' % (prodlot.ref, ref)
|
||||
prodlot_obj.write(cr, uid, [prodlot_id], {'ref': ref})
|
||||
prodlot_id = prodlot_obj.create(cr, uid, {'prefix': prefix, 'product_id': product_id})
|
||||
return prodlot_id
|
||||
|
||||
|
||||
def action_scrap(self, cr, uid, ids, quantity, location_id, context=None):
|
||||
""" Move the scrap/damaged product into scrap location
|
||||
@param cr: the database cursor
|
||||
@@ -2107,7 +2064,6 @@ class stock_move(osv.osv):
|
||||
partner_id = partial_datas.get('partner_id', False)
|
||||
address_id = partial_datas.get('address_id', False)
|
||||
delivery_date = partial_datas.get('delivery_date', False)
|
||||
tracking_lot = context.get('tracking_lot', False)
|
||||
|
||||
new_moves = []
|
||||
|
||||
@@ -2124,10 +2080,6 @@ class stock_move(osv.osv):
|
||||
product_price = partial_data.get('product_price',0.0)
|
||||
product_currency = partial_data.get('product_currency',False)
|
||||
if move.product_qty == product_qty:
|
||||
self.write(cr, uid, move.id,
|
||||
{
|
||||
'tracking_id': tracking_lot
|
||||
})
|
||||
complete.append(move)
|
||||
elif move.product_qty > product_qty:
|
||||
too_few.append(move)
|
||||
@@ -2172,7 +2124,7 @@ class stock_move(osv.osv):
|
||||
'state': 'assigned',
|
||||
'move_dest_id': False,
|
||||
'price_unit': move.price_unit,
|
||||
'tracking_id': tracking_lot,
|
||||
#'tracking_id': tracking_lot,
|
||||
})
|
||||
complete.append(self.browse(cr, uid, new_move))
|
||||
self.write(cr, uid, move.id,
|
||||
@@ -2187,7 +2139,7 @@ class stock_move(osv.osv):
|
||||
{
|
||||
'product_qty': move.product_qty,
|
||||
'product_uos_qty': move.product_qty,
|
||||
'tracking_id': tracking_lot
|
||||
#'tracking_id': tracking_lot
|
||||
})
|
||||
complete.append(move)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<data>
|
||||
<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_packing_list" model="stock.picking" name="stock.packing.list2" 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 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"/>
|
||||
|
||||
+49
-32
@@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<menuitem icon="terp-stock" id="menu_stock_root" name="Warehouse" sequence="5"/>
|
||||
<menuitem id="menu_stock_warehouse_mgmt" name="Warehouse Management" parent="menu_stock_root" sequence="1"/>
|
||||
<menuitem id="menu_stock_products_moves" name="Products Moves" parent="menu_stock_root" sequence="7"/>
|
||||
<menuitem id="menu_stock_products_moves" name="Products Moves" parent="menu_stock_root" sequence="2"/>
|
||||
<menuitem id="menu_stock_product" name="Product" parent="menu_stock_root" sequence="6"/>
|
||||
<menuitem action="product.product_normal_action" id="menu_stock_products_menu" parent="menu_stock_product" sequence="1"/>
|
||||
<menuitem id="menu_stock_configuration" name="Configuration" parent="menu_stock_root" sequence="15"/>
|
||||
@@ -406,7 +406,7 @@
|
||||
<field name="model">stock.location</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Stock location">
|
||||
<form string="Stock Location">
|
||||
<field name="name"/>
|
||||
<field name="active" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
@@ -465,7 +465,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Stock location" colors="blue:usage=='view';darkred:usage=='internal'">
|
||||
<tree string="Stock Location" colors="blue:usage=='view';darkred:usage=='internal'">
|
||||
<field name="complete_name"/>
|
||||
<field name="usage"/>
|
||||
<field name="stock_real" invisible="'product_id' not in context"/>
|
||||
@@ -597,6 +597,7 @@
|
||||
<field name="date"/>
|
||||
<field name="min_date"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-go-forward" help="Validate Picking"/>
|
||||
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the picking. Do you want to continue?"/>
|
||||
@@ -622,7 +623,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped == True" string="Stock Moves" editable="top">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -637,9 +638,10 @@
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field groups="base.group_extended" name="tracking_id"/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
@@ -655,6 +657,7 @@
|
||||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="scraped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
@@ -687,6 +690,7 @@
|
||||
groups="base.group_extended" />
|
||||
<button name="%(move_scrap)d" string="Scrap Move Line" type="action" icon="gtk-justify-fill"/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
states="draft,assigned,confirmed,done"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" />
|
||||
@@ -765,6 +769,7 @@
|
||||
<field name="origin"/>
|
||||
<field name="date"/>
|
||||
<field name="min_date"/>
|
||||
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-go-forward" help="Validate Delivery"/>
|
||||
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the delivery. Do you want to continue?"/>
|
||||
@@ -791,7 +796,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped == True" string="Stock Moves" editable="top">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -819,10 +824,11 @@
|
||||
type="action" icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<button name="%(stock.move_scrap)d"
|
||||
<button name="%(stock.move_scrap)d"
|
||||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="scraped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
@@ -854,6 +860,7 @@
|
||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
@@ -948,7 +955,7 @@
|
||||
<field name="view_mode">calendar</field>
|
||||
<field name="act_window_id" ref="action_picking_tree_delivery"/>
|
||||
</record>
|
||||
<menuitem action="action_picking_tree_delivery" id="menu_action_picking_tree_delivery" parent="menu_stock_warehouse_mgmt" sequence="1"/>
|
||||
<menuitem action="action_picking_tree_delivery" id="menu_action_picking_tree_delivery" parent="menu_stock_warehouse_mgmt" sequence="7"/>
|
||||
|
||||
#
|
||||
# Sending Products
|
||||
@@ -967,6 +974,7 @@
|
||||
<field name="min_date"/>
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-go-forward" help="Validate Picking"/>
|
||||
</tree>
|
||||
@@ -992,7 +1000,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped=True" string="Stock Moves" editable="top">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
<field name="product_uom" string="UOM"/>
|
||||
@@ -1006,10 +1014,11 @@
|
||||
states="draft,assigned,confirmed,done"
|
||||
groups="base.group_extended"/>
|
||||
<field name="tracking_id" groups="base.group_extended"/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="setlast_tracking" string="Set Last Tracking" type="object"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
@@ -1020,6 +1029,7 @@
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_move)d" string="Partial" type="action" states="confirmed,assigned" icon="gtk-justify-fill"/>
|
||||
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
|
||||
<field name="scraped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
@@ -1050,6 +1060,7 @@
|
||||
/>
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
@@ -1162,6 +1173,7 @@
|
||||
<field name="date"/>
|
||||
<field name="min_date"/>
|
||||
<field name="invoice_state" groups="base.group_extended"/>
|
||||
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-ok" help="Receive products"/>
|
||||
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the shipment. Do you want to continue?" />
|
||||
@@ -1190,7 +1202,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}" >
|
||||
<tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped==True" string="Stock Moves" editable="top">
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_qty" readonly="1"/>
|
||||
<field name="product_uom" string="UOM" readonly="1"/>
|
||||
@@ -1216,6 +1228,7 @@
|
||||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="scraped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
@@ -1238,7 +1251,7 @@
|
||||
|
||||
<newline/>
|
||||
<label/>
|
||||
<button groups="base.group_extended" name="267" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<button groups="base.group_extended" name="267" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<label/>
|
||||
<button name="275" string="Split Stock Moves" type="action"
|
||||
groups="base.group_extended"
|
||||
@@ -1331,7 +1344,7 @@
|
||||
<field name="view_mode">calendar</field>
|
||||
<field name="act_window_id" ref="action_picking_tree4"/>
|
||||
</record>
|
||||
<menuitem action="action_picking_tree4" id="menu_action_picking_tree4" parent="menu_stock_warehouse_mgmt" sequence="2"/>
|
||||
<menuitem action="action_picking_tree4" id="menu_action_picking_tree4" parent="menu_stock_warehouse_mgmt" sequence="1"/>
|
||||
|
||||
<record id="view_picking_internal_search" model="ir.ui.view">
|
||||
<field name="name">stock.picking.internal.search</field>
|
||||
@@ -1369,7 +1382,7 @@
|
||||
<field name="context">{'contact_display': 'partner',"search_default_confirmed":1}</field>
|
||||
<field name="search_view_id" ref="view_picking_internal_search"/>
|
||||
</record>
|
||||
<menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="4"/>
|
||||
<menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="2"/>
|
||||
|
||||
<record id="view_move_tree" model="ir.ui.view">
|
||||
<field name="name">stock.move.tree</field>
|
||||
@@ -1458,15 +1471,15 @@
|
||||
<newline/>
|
||||
<group colspan="4" col="4">
|
||||
<label/>
|
||||
<button name="%(track_line)d"
|
||||
groups="base.group_extended"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" colspan="2" />
|
||||
<button name="%(track_line)d"
|
||||
groups="base.group_extended"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" colspan="2" />
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
@@ -1607,15 +1620,19 @@
|
||||
<field groups="base.group_extended" name="tracking_id"/>
|
||||
<newline/>
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
groups="base.group_extended"
|
||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Split Stock Moves" type="action"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
groups="base.group_extended"
|
||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
<field name="state"/>
|
||||
<group col="5" colspan="2">
|
||||
|
||||
@@ -254,21 +254,15 @@ class split_in_production_lot(osv.osv_memory):
|
||||
if quantity_rest == 0:
|
||||
current_move = move.id
|
||||
prodlot_id = False
|
||||
if data.use_exist and line.prodlot_id:
|
||||
prodlot_id = prodlot_obj.search(cr, uid, [('id','=',line.prodlot_id.id)])
|
||||
if prodlot_id:
|
||||
prodlot_id = prodlot_id[0]
|
||||
if data.use_exist:
|
||||
prodlot_id = line.prodlot_id.id
|
||||
if not prodlot_id:
|
||||
# sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
|
||||
prodlot_id = prodlot_obj.create(cr, uid, {'name': line.name},
|
||||
# 'prefix' : line.name},
|
||||
{'product_id': move.product_id.id})
|
||||
prodlot_id = prodlot_obj.create(cr, uid, {
|
||||
'name': line.name,
|
||||
'product_id': move.product_id.id},
|
||||
context=context)
|
||||
print 'write', current_move, {'prodlot_id': prodlot_id, 'state':move.state}
|
||||
move_obj.write(cr, uid, [current_move], {'prodlot_id': prodlot_id, 'state':move.state})
|
||||
prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
|
||||
# ref = '%d' % (move.id)
|
||||
# if prodlot.ref:
|
||||
# ref = '%s, %s' % (prodlot.ref, ref)
|
||||
# prodlot_obj.write(cr, uid, [prodlot_id], {'ref': ref})
|
||||
|
||||
update_val = {}
|
||||
if quantity_rest > 0:
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_stock_move_track_wizard" model="ir.ui.view">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="model">stock.move.track</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Tracking a move">
|
||||
<field name="tracking_prefix" colspan="4"/>
|
||||
<field name="quantity" colspan="4"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="track_lines" string="Ok"
|
||||
type="object" icon="gtk-ok" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="track_line_old" model="ir.actions.act_window">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move.track</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="view_stock_move_track_wizard" model="ir.ui.view">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="model">stock.move.track</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Tracking a move">
|
||||
<field name="tracking_prefix" colspan="4"/>
|
||||
<field name="quantity" colspan="4"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="track_lines" string="Ok"
|
||||
type="object" icon="gtk-ok" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="track_line_old" model="ir.actions.act_window">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move.track</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Consume, scrap move -->
|
||||
|
||||
<record id="view_stock_move_consume_wizard" model="ir.ui.view">
|
||||
|
||||
<record id="view_stock_move_consume_wizard" model="ir.ui.view">
|
||||
<field name="name">Consume Move</field>
|
||||
<field name="model">stock.move.consume</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Consume Move">
|
||||
<separator string="Consume Products" colspan="4"/>
|
||||
<field name="product_id" colspan="4" readonly="1"/>
|
||||
<field name="location_id" colspan="4" widget="selection"/>
|
||||
<field name="product_qty" colspan="2"/>
|
||||
<field name="product_uom" nolabel="1" readonly="1"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2" />
|
||||
<group col="2" colspan="1">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="do_move_consume" string="Ok"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
<separator string="Consume Products" colspan="4"/>
|
||||
<field name="product_id" colspan="4" readonly="1"/>
|
||||
<field name="location_id" colspan="4" widget="selection"/>
|
||||
<field name="product_qty" colspan="2"/>
|
||||
<field name="product_uom" nolabel="1" readonly="1"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2" />
|
||||
<group col="2" colspan="1">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="do_move_consume" string="Ok"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -64,27 +64,27 @@
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_stock_move_scrap_wizard" model="ir.ui.view">
|
||||
<field name="name">Scrap Move</field>
|
||||
<field name="model">stock.move.scrap</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Scrap Move">
|
||||
<separator string="Scrap Products" colspan="4"/>
|
||||
<field name="product_id" colspan="4" readonly="1"/>
|
||||
<field name="location_id" colspan="4" string="Dest. Location" domain="[('usage','<>','view'),('scrap_location','=',True)]" widget="selection"/>
|
||||
<field name="product_qty" colspan="2"/>
|
||||
<field name="product_uom" nolabel="1" readonly="1"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2" />
|
||||
<group col="2" colspan="1">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="move_scrap" string="Ok"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
<separator string="Scrap Products" colspan="4"/>
|
||||
<field name="product_id" colspan="4" readonly="1"/>
|
||||
<field name="location_id" colspan="4" string="Dest. Location" domain="[('usage','<>','view'),('scrap_location','=',True)]" widget="selection"/>
|
||||
<field name="product_qty" colspan="2"/>
|
||||
<field name="product_uom" nolabel="1" readonly="1"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2" />
|
||||
<group col="2" colspan="1">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="move_scrap" string="Ok"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -97,12 +97,12 @@
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_split_in_lots" model="ir.ui.view">
|
||||
<field name="name">Split in lots</field>
|
||||
<field name="model">stock.move.split</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name">Split in lots</field>
|
||||
<field name="model">stock.move.split</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Split in lots">
|
||||
<field name="product_id" colspan="4" readonly="1"/>
|
||||
<newline/>
|
||||
@@ -119,47 +119,47 @@
|
||||
</group>
|
||||
|
||||
<group colspan="4" attrs="{'invisible':[('use_exist','=',True)]}">
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
<tree string="Lots Number" editable="bottom">
|
||||
<field name="name" string="Lots"/>
|
||||
<field name="quantity" />
|
||||
</tree>
|
||||
<form string="Lots Number">
|
||||
<field name="name" string="Lots"/>
|
||||
<field name="quantity" />
|
||||
</form>
|
||||
</field>
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
<tree string="Lots Number" editable="bottom">
|
||||
<field name="name" string="Lots"/>
|
||||
<field name="quantity" />
|
||||
</tree>
|
||||
<form string="Lots Number">
|
||||
<field name="name" string="Lots"/>
|
||||
<field name="quantity" />
|
||||
</form>
|
||||
</field>
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible':[('use_exist','!=',True)]}">
|
||||
<field name="line_exist_ids" colspan="4" nolabel="1">
|
||||
<tree string="Lots Number" editable="bottom">
|
||||
<field name="prodlot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
|
||||
<field name="quantity" />
|
||||
</tree>
|
||||
<form string="Lots Number">
|
||||
<field name="prodlot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
|
||||
<field name="quantity" />
|
||||
</form>
|
||||
</field>
|
||||
<field name="line_exist_ids" colspan="4" nolabel="1">
|
||||
<tree string="Lots Number" editable="bottom">
|
||||
<field name="prodlot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
|
||||
<field name="quantity" />
|
||||
</tree>
|
||||
<form string="Lots Number">
|
||||
<field name="prodlot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
|
||||
<field name="quantity" />
|
||||
</form>
|
||||
</field>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="split_lot" string="Ok"
|
||||
type="object" icon="gtk-ok" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="track_line" model="ir.actions.act_window">
|
||||
<field name="name">Split in lots</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move.split</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="split_lot" string="Ok"
|
||||
type="object" icon="gtk-ok" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
<record id="track_line" model="ir.actions.act_window">
|
||||
<field name="name">Split in lots</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move.split</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -27,26 +27,26 @@ import pooler
|
||||
import time
|
||||
|
||||
class stock_partial_move(osv.osv_memory):
|
||||
_name = "stock.partial.move"
|
||||
_description = "Partial Move"
|
||||
_name = "stock.partial.move"
|
||||
_description = "Partial Move"
|
||||
_columns = {
|
||||
'date': fields.datetime('Date', required=True),
|
||||
'partner_id': fields.many2one('res.partner',string="Partner"),
|
||||
'type': fields.char("Type", size=3),
|
||||
'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered"),
|
||||
'address_id': fields.many2one('res.partner.address', 'Address', help="Address where goods are to be delivered"),
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
res = super(stock_partial_move, self).view_init(cr, uid, fields_list, context=context)
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
if not context:
|
||||
context={}
|
||||
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'):
|
||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delivery products which are already delivered !'))
|
||||
|
||||
|
||||
|
||||
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")
|
||||
if 'move%s_product_qty'%(m.id) not in self._columns:
|
||||
@@ -59,59 +59,59 @@ class stock_partial_move(osv.osv_memory):
|
||||
self._columns['move%s_product_price'%(m.id)] = fields.float("Price")
|
||||
if 'move%s_product_currency'%(m.id) not in self._columns:
|
||||
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency',string="Currency")
|
||||
return res
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
|
||||
result = super(stock_partial_move, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
result = super(stock_partial_move, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context.get('active_ids', False)
|
||||
move_ids = context.get('active_ids', False)
|
||||
move_ids = move_obj.search(cr, uid, [('id','in',move_ids)])
|
||||
_moves_arch_lst = """<form string="Deliver Products">
|
||||
<separator colspan="4" string="Delivery Information"/>
|
||||
<field name="date" />
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" attrs="{'invisible':[('type','=','in')]}">
|
||||
<field name="partner_id" attrs="{'required':[('type','!=','in')]}" />
|
||||
<field name="address_id" attrs="{'required':[('type','!=','in')]}"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<newline/>
|
||||
<field name="partner_id" attrs="{'required':[('type','!=','in')]}" />
|
||||
<field name="address_id" attrs="{'required':[('type','!=','in')]}"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator colspan="4" string="Move Detail"/>
|
||||
"""
|
||||
"""
|
||||
_moves_fields = result['fields']
|
||||
if move_ids and view_type in ['form']:
|
||||
for m in move_obj.browse(cr, uid, move_ids, context):
|
||||
if move_ids and view_type in ['form']:
|
||||
for m in move_obj.browse(cr, uid, move_ids, context):
|
||||
if m.state in ('done', 'cancel'):
|
||||
continue
|
||||
_moves_fields.update({
|
||||
'move%s_product_id'%(m.id) : {
|
||||
'string': _('Product'),
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.product',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.product',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
},
|
||||
'move%s_product_qty'%(m.id) : {
|
||||
'string': _('Quantity'),
|
||||
'type' : 'float',
|
||||
'required': True,
|
||||
'required': True,
|
||||
},
|
||||
'move%s_product_uom'%(m.id) : {
|
||||
'string': _('Product UOM'),
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.uom',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.uom',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
_moves_arch_lst += """
|
||||
<group colspan="4" col="10">
|
||||
<field name="move%s_product_id" nolabel="1"/>
|
||||
<field name="move%s_product_qty" string="Qty" />
|
||||
<field name="move%s_product_uom" nolabel="1" />
|
||||
"""%(m.id, m.id, m.id)
|
||||
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
_moves_fields.update({
|
||||
'move%s_product_price'%(m.id) : {
|
||||
'string': _('Price'),
|
||||
@@ -119,9 +119,9 @@ class stock_partial_move(osv.osv_memory):
|
||||
},
|
||||
'move%s_product_currency'%(m.id): {
|
||||
'string': _('Currency'),
|
||||
'type' : 'float',
|
||||
'type' : 'many2one',
|
||||
'relation': 'res.currency',
|
||||
'type' : 'float',
|
||||
'type' : 'many2one',
|
||||
'relation': 'res.currency',
|
||||
}
|
||||
})
|
||||
_moves_arch_lst += """
|
||||
@@ -135,14 +135,14 @@ class stock_partial_move(osv.osv_memory):
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2"/>
|
||||
<group col="2" colspan="2">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="_Cancel" />
|
||||
<button name="do_partial" string="_Deliver"
|
||||
colspan="1" type="object" icon="gtk-apply" />
|
||||
</group>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="_Cancel" />
|
||||
<button name="do_partial" string="_Deliver"
|
||||
colspan="1" type="object" icon="gtk-apply" />
|
||||
</group>
|
||||
</form>"""
|
||||
result['arch'] = _moves_arch_lst
|
||||
result['fields'] = _moves_fields
|
||||
result['fields'] = _moves_fields
|
||||
return result
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
@@ -150,13 +150,13 @@ class stock_partial_move(osv.osv_memory):
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
|
||||
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
if not context:
|
||||
context={}
|
||||
moveids = address_delivery = address_default = []
|
||||
@@ -164,7 +164,7 @@ class stock_partial_move(osv.osv_memory):
|
||||
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
move_ids = context.get('active_ids', [])
|
||||
move_ids = move_obj.search(cr, uid, [('id','in',move_ids)])
|
||||
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'):
|
||||
continue
|
||||
res['type'] = m.picking_id and m.picking_id.type or ''
|
||||
@@ -173,7 +173,7 @@ class stock_partial_move(osv.osv_memory):
|
||||
if len(address_ids1) == 1:
|
||||
if m.picking_id and m.picking_id.type=='out':
|
||||
res['address_id'] = address_ids[0][0] or False
|
||||
res['partner_id'] = address_ids[0][1] or False
|
||||
res['partner_id'] = address_ids[0][1] or False
|
||||
if m.picking_id and m.picking_id.type=='in':
|
||||
res['partner_id'] = m.company_id.partner_id.id or False
|
||||
if m.company_id.partner_id:
|
||||
@@ -199,7 +199,7 @@ class stock_partial_move(osv.osv_memory):
|
||||
currency = False
|
||||
if hasattr(m.picking_id, 'sale_id') and m.picking_id.sale_id:
|
||||
currency = m.picking_id.sale_id.pricelist_id.currency_id.id
|
||||
|
||||
|
||||
if 'move%s_product_price'%(m.id) in fields:
|
||||
res['move%s_product_price'%(m.id)] = price
|
||||
if 'move%s_product_currency'%(m.id) in fields:
|
||||
@@ -213,38 +213,38 @@ class stock_partial_move(osv.osv_memory):
|
||||
currency = False
|
||||
if hasattr(m.picking_id, 'purchase_id') and m.picking_id.purchase_id:
|
||||
currency = m.picking_id.purchase_id.pricelist_id.currency_id.id
|
||||
|
||||
|
||||
if 'move%s_product_price'%(m.id) in fields:
|
||||
res['move%s_product_price'%(m.id)] = price
|
||||
if 'move%s_product_currency'%(m.id) in fields:
|
||||
res['move%s_product_currency'%(m.id)] = currency
|
||||
return res
|
||||
return res
|
||||
|
||||
def do_partial(self, cr, uid, ids, context):
|
||||
""" Makes partial moves and pickings done.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
|
||||
rec_id = context and context.get('active_id', False)
|
||||
tracking_lot = context.get('tracking_lot', False)
|
||||
if tracking_lot:
|
||||
tracking = self.pool.get('stock.tracking')
|
||||
tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
|
||||
context ['tracking_lot'] = tracking_lot
|
||||
move_obj = self.pool.get('stock.move')
|
||||
#tracking_lot = context.get('tracking_lot', False)
|
||||
#if tracking_lot:
|
||||
# tracking = self.pool.get('stock.tracking')
|
||||
# tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
|
||||
# context ['tracking_lot'] = tracking_lot
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context.get('active_ids', False)
|
||||
partial = self.browse(cr, uid, ids[0], context)
|
||||
partial_datas = {
|
||||
'partner_id' : partial.partner_id and partial.partner_id.id or False,
|
||||
'address_id' : partial.address_id and partial.address_id.id or False,
|
||||
'delivery_date' : partial.date
|
||||
'delivery_date' : partial.date
|
||||
}
|
||||
for m in move_obj.browse(cr, uid, move_ids):
|
||||
for m in move_obj.browse(cr, uid, move_ids):
|
||||
if m.state in ('done', 'cancel'):
|
||||
continue
|
||||
partial_datas['move%s'%(m.id)] = {
|
||||
@@ -253,15 +253,15 @@ class stock_partial_move(osv.osv_memory):
|
||||
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id
|
||||
}
|
||||
|
||||
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
|
||||
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
|
||||
})
|
||||
})
|
||||
res = move_obj.do_partial(cr, uid, move_ids, partial_datas, context=context)
|
||||
return {}
|
||||
|
||||
stock_partial_move()
|
||||
|
||||
stock_partial_move()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ class stock_partial_picking(osv.osv_memory):
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
res = super(stock_partial_picking, self).view_init(cr, uid, fields_list, context=context)
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
if not context:
|
||||
context={}
|
||||
moveids = []
|
||||
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
for m in pick.move_lines:
|
||||
if m.state in ('done', 'cancel'):
|
||||
continue
|
||||
@@ -54,18 +54,18 @@ class stock_partial_picking(osv.osv_memory):
|
||||
self._columns['move%s_product_price'%(m.id)] = fields.float("Price")
|
||||
if 'move%s_product_currency'%(m.id) not in self._columns:
|
||||
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency',string="Currency")
|
||||
return res
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
|
||||
result = super(stock_partial_picking, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
result = super(stock_partial_picking, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = context.get('active_ids', False)
|
||||
picking_ids = context.get('active_ids', False)
|
||||
_moves_arch_lst = """<form string="Deliver Products">
|
||||
<separator colspan="4" string="Delivery Information"/>
|
||||
<field name="date" />
|
||||
<separator colspan="4"/>
|
||||
<separator colspan="4" string="Move Detail"/>
|
||||
"""
|
||||
"""
|
||||
_moves_fields = result['fields']
|
||||
if picking_ids and view_type in ['form']:
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids, context):
|
||||
@@ -75,32 +75,32 @@ class stock_partial_picking(osv.osv_memory):
|
||||
_moves_fields.update({
|
||||
'move%s_product_id'%(m.id) : {
|
||||
'string': _('Product'),
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.product',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.product',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
},
|
||||
'move%s_product_qty'%(m.id) : {
|
||||
'string': _('Quantity'),
|
||||
'type' : 'float',
|
||||
'required': True,
|
||||
'required': True,
|
||||
},
|
||||
'move%s_product_uom'%(m.id) : {
|
||||
'string': _('Product UOM'),
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.uom',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
'type' : 'many2one',
|
||||
'relation': 'product.uom',
|
||||
'required' : True,
|
||||
'readonly' : True,
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
_moves_arch_lst += """
|
||||
<group colspan="4" col="10">
|
||||
<field name="move%s_product_id" nolabel="1"/>
|
||||
<field name="move%s_product_qty" string="Qty" />
|
||||
<field name="move%s_product_uom" nolabel="1" />
|
||||
"""%(m.id, m.id, m.id)
|
||||
if (m.product_id.cost_method == 'average'):
|
||||
if (m.product_id.cost_method == 'average'):
|
||||
_moves_fields.update({
|
||||
'move%s_product_price'%(m.id) : {
|
||||
'string': _('Price'),
|
||||
@@ -108,9 +108,9 @@ class stock_partial_picking(osv.osv_memory):
|
||||
},
|
||||
'move%s_product_currency'%(m.id): {
|
||||
'string': _('Currency'),
|
||||
'type' : 'float',
|
||||
'type' : 'many2one',
|
||||
'relation': 'res.currency',
|
||||
'type' : 'float',
|
||||
'type' : 'many2one',
|
||||
'relation': 'res.currency',
|
||||
}
|
||||
})
|
||||
_moves_arch_lst += """
|
||||
@@ -124,14 +124,14 @@ class stock_partial_picking(osv.osv_memory):
|
||||
<separator string="" colspan="4" />
|
||||
<label string="" colspan="2"/>
|
||||
<group col="2" colspan="2">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="_Cancel" />
|
||||
<button name="do_partial" string="_Deliver"
|
||||
colspan="1" type="object" icon="gtk-apply" />
|
||||
</group>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="_Cancel" />
|
||||
<button name="do_partial" string="_Validate"
|
||||
colspan="1" type="object" icon="gtk-apply" />
|
||||
</group>
|
||||
</form>"""
|
||||
result['arch'] = _moves_arch_lst
|
||||
result['fields'] = _moves_fields
|
||||
result['fields'] = _moves_fields
|
||||
return result
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
@@ -139,13 +139,13 @@ class stock_partial_picking(osv.osv_memory):
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
|
||||
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
if not context:
|
||||
context={}
|
||||
moveids = []
|
||||
@@ -179,22 +179,22 @@ class stock_partial_picking(osv.osv_memory):
|
||||
res['move%s_product_price'%(m.id)] = price
|
||||
if 'move%s_product_currency'%(m.id) in fields:
|
||||
res['move%s_product_currency'%(m.id)] = currency
|
||||
return res
|
||||
return res
|
||||
|
||||
def do_partial(self, cr, uid, ids, context):
|
||||
def do_partial(self, cr, uid, ids, context):
|
||||
""" Makes partial moves and pickings done.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = context.get('active_ids', False)
|
||||
partial = self.browse(cr, uid, ids[0], context)
|
||||
partial_datas = {
|
||||
'delivery_date' : partial.date
|
||||
'delivery_date' : partial.date
|
||||
}
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids):
|
||||
for m in pick.move_lines:
|
||||
@@ -206,15 +206,15 @@ class stock_partial_picking(osv.osv_memory):
|
||||
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id
|
||||
}
|
||||
|
||||
if (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
if (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
|
||||
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
|
||||
})
|
||||
})
|
||||
res = pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
|
||||
return {}
|
||||
|
||||
stock_partial_picking()
|
||||
|
||||
stock_partial_picking()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,52 +26,39 @@ from tools.translate import _
|
||||
class stock_split_into(osv.osv_memory):
|
||||
_name = "stock.split.into"
|
||||
_description = "Split into"
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
""" Get default values
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary
|
||||
@return: Default values of fields
|
||||
"""
|
||||
res = super(stock_split_into, self).default_get(cr, uid, fields, context=context)
|
||||
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
|
||||
if 'quantity' in fields:
|
||||
res.update({'quantity': move.product_qty})
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'quantity': fields.integer('Quantity'),
|
||||
'quantity': fields.float('Quantity', digits=(16,2)),
|
||||
}
|
||||
_defaults = {
|
||||
'quantity': lambda *x: 1,
|
||||
'quantity': lambda *x: 0,
|
||||
}
|
||||
|
||||
def split(self, cr, uid, data, context=None):
|
||||
rec_id = context and context.get('active_ids', False)
|
||||
move_obj = self.pool.get('stock.move')
|
||||
new_move = []
|
||||
update_val = {}
|
||||
value_to_split = self.browse(cr, uid, data[0], context)
|
||||
quantity = value_to_split.quantity or 0.0
|
||||
ir_sequence_obj = self.pool.get('ir.sequence')
|
||||
track_obj = self.pool.get('stock.tracking')
|
||||
|
||||
quantity = self.browse(cr, uid, data[0], context).quantity or 0.0
|
||||
for move in move_obj.browse(cr, uid, rec_id):
|
||||
move_qty = move.product_qty
|
||||
uos_qty_rest = move.product_uos_qty
|
||||
quantity_rest = move_qty - quantity
|
||||
if (quantity_rest == 0) or (quantity <= 0) :
|
||||
continue
|
||||
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.tracking')
|
||||
tracking_id = track_obj.create(cr, uid, {'name': sequence}, {'product_id': move.product_id.id})
|
||||
uos_qty = quantity / move_qty * move.product_uos_qty
|
||||
uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
|
||||
move_obj.setlast_tracking(cr, uid, [move.id], context=context)
|
||||
move_obj.write(cr, uid, [move.id], {
|
||||
'product_qty': quantity,
|
||||
'product_uos_qty': quantity,
|
||||
'product_uos': move.product_uom.id,
|
||||
})
|
||||
quantity_rest = move.product_qty - quantity
|
||||
tracking_id = track_obj.create(cr, uid, {})
|
||||
default_val = {
|
||||
'product_qty': quantity_rest,
|
||||
'product_uos_qty': uos_qty,
|
||||
'state': move.state
|
||||
'product_uos_qty': quantity_rest,
|
||||
'tracking_id': tracking_id,
|
||||
'state': move.state,
|
||||
'product_uos': move.product_uom.id
|
||||
}
|
||||
current_move = move_obj.copy(cr, uid, move.id, default_val)
|
||||
new_move.append(current_move)
|
||||
|
||||
Reference in New Issue
Block a user