Merge and bug fixing
bzr revid: ruchakpatel@gmail.com-20080924060143-4lekvw2onenrs2fl
This commit is contained in:
commit
8458837c69
|
@ -89,6 +89,14 @@ class account_analytic_line(osv.osv):
|
|||
}}
|
||||
return {}
|
||||
|
||||
def view_header_get(self, cr, user, view_id, view_type, context):
|
||||
if context.get('account_id', False):
|
||||
cr.execute('select name from account_analytic_account where id=%d', (context['account_id'],))
|
||||
res = cr.fetchone()
|
||||
res = _('Entries: ')+ (res[0] or '')
|
||||
return res
|
||||
return False
|
||||
|
||||
account_analytic_line()
|
||||
|
||||
|
||||
|
|
|
@ -178,15 +178,14 @@
|
|||
</field>
|
||||
</group>
|
||||
<group col="4" colspan="2">
|
||||
<label colspan="2"/>
|
||||
<field name="amount_untaxed"/>
|
||||
<button colspan="2" name="button_reset_taxes" states="draft" string="Reset taxes" type="object"/>
|
||||
<field name="amount_tax"/>
|
||||
<field name="amount_untaxed"/>
|
||||
<button colspan="2" name="button_compute" states="draft" string="Compute" type="object"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="amount_tax"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="residual"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="state" select="2"/>
|
||||
<field name="residual"/>
|
||||
<group col="3" colspan="4">
|
||||
<button name="invoice_open" states="draft,proforma" string="Validate"/>
|
||||
<button name="invoice_cancel" states="draft,proforma,sale,open" string="Cancel"/>
|
||||
|
@ -261,15 +260,14 @@
|
|||
</field>
|
||||
</group>
|
||||
<group col="4" colspan="2">
|
||||
<label colspan="2"/>
|
||||
<field name="amount_untaxed"/>
|
||||
<button colspan="2" name="button_reset_taxes" states="draft" string="Reset taxes" type="object"/>
|
||||
<field name="amount_tax"/>
|
||||
<field name="amount_untaxed"/>
|
||||
<button colspan="2" name="button_compute" states="draft" string="Compute" type="object"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="amount_tax"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="residual"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="state" select="2"/>
|
||||
<field name="residual"/>
|
||||
<group col="3" colspan="4">
|
||||
<button name="invoice_proforma" states="draft" string="PRO-FORMA"/>
|
||||
<button name="invoice_open" states="draft,proforma" string="Create"/>
|
||||
|
|
|
@ -21,15 +21,20 @@
|
|||
<field name="code">liability</field>
|
||||
<field name="close_method">balance</field>
|
||||
</record>
|
||||
<record id="account_type_cash_equity" model="account.account.type">
|
||||
<field name="name">Equity</field>
|
||||
<field name="code">equity</field>
|
||||
<field name="close_method">balance</field>
|
||||
</record>
|
||||
<record id="account_type_income" model="account.account.type">
|
||||
<field name="name">Income</field>
|
||||
<field name="code">income</field>
|
||||
<field name="close_method">none</field>
|
||||
<field name="close_method">unreconciled</field>
|
||||
</record>
|
||||
<record id="account_type_expense" model="account.account.type">
|
||||
<field name="name">Expense</field>
|
||||
<field name="code">expense</field>
|
||||
<field name="close_method">none</field>
|
||||
<field name="close_method">unreconciled</field>
|
||||
</record>
|
||||
<record id="account_type_cash_moves" model="account.account.type">
|
||||
<field name="name">Cash</field>
|
||||
|
|
|
@ -154,11 +154,12 @@
|
|||
|
||||
|
||||
<record id="action_account_tree1" model="ir.actions.act_window">
|
||||
<field name="name">action.account.tree1</field>
|
||||
<field name="name"></field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('account_id','=', active_id)]</field>
|
||||
<field name="context">{'account_id':active_id}</field>
|
||||
</record>
|
||||
<record id="ir_open_account_analytic_account" model="ir.values">
|
||||
<field eval="'tree_but_open'" name="key2"/>
|
||||
|
|
|
@ -142,10 +142,12 @@ class account_invoice_line(osv.osv):
|
|||
'sequence': fields.integer('Sequence Number'),
|
||||
'functional_field': fields.function(_fnct, arg=None, fnct_inv=None, fnct_inv_arg=None, type='char', fnct_search=None, obj=None, method=True, store=False, string="Source Account"),
|
||||
}
|
||||
|
||||
def _default_account(self, cr, uid, context=None):
|
||||
cr.execute("select id from account_account where code = 0 LIMIT 1")
|
||||
cr.execute("select id from account_account where parent_id IS NULL LIMIT 1")
|
||||
res=cr.fetchone()
|
||||
return res[0]
|
||||
|
||||
_defaults = {
|
||||
'state': lambda *a: 'article',
|
||||
# 'account_id': _default_account
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard string="Formatted Inv. + Message"
|
||||
<wizard string="Invoice + Message"
|
||||
model="account.invoice"
|
||||
name="wizard.notify_message"
|
||||
id="wizard_notify_message"
|
||||
|
@ -9,7 +9,7 @@
|
|||
/>
|
||||
|
||||
<report id="account_invoices_1"
|
||||
string="Formatted Inv."
|
||||
string="Invoice"
|
||||
model="account.invoice"
|
||||
name="account.invoice.layout"
|
||||
rml="account_invoice_layout/report/report_account_invoice_layout.rml"
|
||||
|
|
|
@ -82,7 +82,7 @@ view_form_update = """<?xml version="1.0"?>
|
|||
<separator string="Summary" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="profile" align="0.0" readonly="1"/>
|
||||
<newline/>
|
||||
<newline/>
|
||||
<field name="name" align="0.0" readonly="1"/>
|
||||
</group>
|
||||
</form>
|
||||
|
@ -110,7 +110,7 @@ class wizard_base_setup(wizard.interface):
|
|||
res.sort()
|
||||
return res
|
||||
|
||||
|
||||
|
||||
|
||||
def _get_company(self, cr, uid, data, context):
|
||||
pool=pooler.get_pool(cr.dbname)
|
||||
|
@ -167,7 +167,7 @@ class wizard_base_setup(wizard.interface):
|
|||
if 'profile' in data['form'] and data['form']['profile'] > 0:
|
||||
module_obj=pool.get('ir.module.module')
|
||||
module_obj.state_update(cr, uid, [data['form']['profile']], 'to install', ['uninstalled'], context)
|
||||
|
||||
|
||||
|
||||
company_obj=pool.get('res.company')
|
||||
partner_obj=pool.get('res.partner')
|
||||
|
@ -266,6 +266,7 @@ class wizard_base_setup(wizard.interface):
|
|||
"view_mode": 'form',
|
||||
'res_model': 'ir.module.module.configuration.wizard',
|
||||
'type': 'ir.actions.act_window',
|
||||
'context':{'menu':True},
|
||||
'target':'new',
|
||||
}
|
||||
|
||||
|
@ -277,7 +278,7 @@ class wizard_base_setup(wizard.interface):
|
|||
'default': -1,
|
||||
'required': True,
|
||||
},
|
||||
|
||||
|
||||
'name':{
|
||||
'string': 'Company Name',
|
||||
'type': 'char',
|
||||
|
|
|
@ -58,13 +58,12 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Delivery grids">
|
||||
<field name="name" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
<field name="carrier_id" select="1"/>
|
||||
<field name="sequence" select="1"/>
|
||||
<notebook>
|
||||
<page string="Grid definition">
|
||||
<field name="name" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
<field name="carrier_id" select="1"/>
|
||||
<field name="sequence" select="1"/>
|
||||
<separator colspan="4" string="Grid Lines"/>
|
||||
<field colspan="4" name="line_ids" nolabel="1" select="1"/>
|
||||
</page>
|
||||
<page string="Destination">
|
||||
|
|
|
@ -439,7 +439,7 @@
|
|||
<page string="Finnished Products">
|
||||
<field colspan="4" name="move_created_ids" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Operations">
|
||||
<page string="Work Orders">
|
||||
<field colspan="4" name="workcenter_lines" nolabel="1" widget="one2many_list"/>
|
||||
</page>
|
||||
<page string="Extra Information">
|
||||
|
|
|
@ -333,10 +333,9 @@ product_template()
|
|||
class product_product(osv.osv):
|
||||
def view_header_get(self, cr, uid, view_id, view_type, context):
|
||||
res = super(product_product, self).view_header_get(cr, uid, view_id, view_type, context)
|
||||
if res: return res
|
||||
if (not context.get('categ_id', False)):
|
||||
return False
|
||||
return _('Products: ')+self.pool.get('product.category').browse(cr, uid, context['categ_id'], context).name
|
||||
if (context.get('categ_id', False)):
|
||||
return _('Products: ')+self.pool.get('product.category').browse(cr, uid, context['categ_id'], context).name
|
||||
return res
|
||||
|
||||
def _product_price(self, cr, uid, ids, name, arg, context={}):
|
||||
res = {}
|
||||
|
|
|
@ -59,7 +59,7 @@ class profile_accounting_config_install_modules_wizard(osv.osv_memory):
|
|||
ids += mod_obj.search(cr, uid, [('name', '=', r)])
|
||||
mod_obj.action_install(cr, uid, ids, context=context)
|
||||
cr.commit()
|
||||
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
|
||||
db, pool = pooler.restart_pool(cr.dbname,force_demo=True, update_module=True)
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<record model="ir.module.module.configuration.step"
|
||||
id="profile_accounting.config_install_wizard">
|
||||
<field name="name">Accounting Profile : Install Extra modules</field>
|
||||
<field name="note">Install more modules. A few modules are proposed according to the service profile you selected. You will be able to install them based on our requirements.</field>
|
||||
<field name="note">Install more modules. A few modules are proposed according to the Account Profile you selected. You will be able to install them based on our requirements.</field>
|
||||
<field name="action_id" ref="action_config_install_module"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
|
|
@ -58,7 +58,7 @@ class profile_association_config_install_modules_wizard(osv.osv_memory):
|
|||
ids = mod_obj.search(cr, uid, [('name', '=', r)])
|
||||
mod_obj.action_install(cr, uid, ids, context=context)
|
||||
cr.commit()
|
||||
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
|
||||
db, pool = pooler.restart_pool(cr.dbname,force_demo=True, update_module=True)
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<record model="ir.module.module.configuration.step"
|
||||
id="config_install_module">
|
||||
<field name="name">Association Profile : Install Extra modules</field>
|
||||
<field name="note">Install more modules. A few modules are proposed according to the service profile you selected. You will be able to install them based on our requirements.</field>
|
||||
<field name="note">Install more modules. A few modules are proposed according to the association profile you selected. You will be able to install them based on our requirements.</field>
|
||||
<field name="action_id" ref="action_config_install_module"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
|
|
@ -67,7 +67,9 @@ class profile_manufacturing_config_install_modules_wizard(osv.osv_memory):
|
|||
help="This module allows you to manage a point of sale system. "\
|
||||
"It offers a basic form for pos operations. You must also check "\
|
||||
"our frontend point of sale for a perfect ergonomy with touchscreen "\
|
||||
"materials and payment processing hardware.")
|
||||
"materials and payment processing hardware."),
|
||||
'portal': fields.boolean('Portal',
|
||||
help="This module allows you to manage a Portal system.")
|
||||
}
|
||||
def action_cancel(self,cr,uid,ids,conect=None):
|
||||
return {
|
||||
|
@ -86,7 +88,7 @@ class profile_manufacturing_config_install_modules_wizard(osv.osv_memory):
|
|||
ids = mod_obj.search(cr, uid, [('name', '=', r)])
|
||||
mod_obj.action_install(cr, uid, ids, context=context)
|
||||
cr.commit()
|
||||
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
|
||||
db, pool = pooler.restart_pool(cr.dbname,force_demo=True, update_module=True)
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
<field name="sale_margin"/>
|
||||
<separator string="Relationship Management" colspan="4"/>
|
||||
<field name="crm_configuration"/>
|
||||
<separator string="Portal Management" colspan="4"/>
|
||||
<field name="portal"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<label string="" colspan="2"/>
|
||||
<group col="4" colspan="2">
|
||||
|
@ -39,7 +41,7 @@
|
|||
<record model="ir.module.module.configuration.step"
|
||||
id="config_install_module">
|
||||
<field name="name">Manufacturing Profile : Install Extra modules</field>
|
||||
<field name="note">Install more modules. A few modules are proposed according to the service profile you selected. You will be able to install them based on our requirements.</field>
|
||||
<field name="note">Install more modules. A few modules are proposed according to the manufacturing profile you selected. You will be able to install them based on our requirements.</field>
|
||||
<field name="action_id" ref="action_config_install_module"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
|
|
@ -43,6 +43,8 @@ class profile_service_config_install_modules_wizard(osv.osv_memory):
|
|||
'project_gtd':fields.boolean('Getting Things Done', help="GTD is a methodology to efficiently organise yourself and your tasks. This module fully integrates GTD principle with OpenERP's project management."),
|
||||
'scrum':fields.boolean('Scrum Methodology', help="Scrum is an 'agile development methodology', mainly used in IT projects. It helps you to manage teams, long term roadmaps, sprints, and so on."),
|
||||
'base_contact':fields.boolean('Contacts Management', help="Allows you to manage partners (enterprises), addresses of partners and contacts of these partners (employee/people). Install this if you plan to manage your relationships with partners and contacts."),
|
||||
'portal': fields.boolean('Portal',
|
||||
help="This module allows you to manage a Portal system.")
|
||||
}
|
||||
def action_cancel(self,cr,uid,ids,conect=None):
|
||||
return {
|
||||
|
@ -61,7 +63,7 @@ class profile_service_config_install_modules_wizard(osv.osv_memory):
|
|||
ids = mod_obj.search(cr, uid, [('name', '=', r)])
|
||||
mod_obj.action_install(cr,uid,ids,context=context)
|
||||
cr.commit()
|
||||
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
|
||||
db, pool = pooler.restart_pool(cr.dbname,force_demo=True, update_module=True)
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
<separator string="Relationship Management" colspan="4"/>
|
||||
<field name="crm_configuration"/>
|
||||
<field name="base_contact"/>
|
||||
|
||||
<separator string="Portal Management" colspan="4"/>
|
||||
<field name="portal"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<label string="" colspan="2"/>
|
||||
<group col="4" colspan="2">
|
||||
|
|
|
@ -151,21 +151,26 @@ class project(osv.osv):
|
|||
# toggle activity of projects, their sub projects and their tasks
|
||||
def set_template(self, cr, uid, ids, context={}):
|
||||
res = self.setActive(cr, uid, ids, value=False, context=context)
|
||||
return res
|
||||
|
||||
return res
|
||||
|
||||
def reset_project(self, cr, uid, ids, context={}):
|
||||
res = self.setActive(cr, uid, ids,value=True, context=context)
|
||||
return res
|
||||
|
||||
|
||||
def copy(self, cr, uid, id, default={},context={}):
|
||||
default = default or {}
|
||||
default['tasks'] = []
|
||||
default['child_id'] = []
|
||||
return super(project, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def duplicate_template(self, cr, uid, ids,context={}):
|
||||
for proj in self.browse(cr, uid, ids):
|
||||
parent_id=context.get('parent_id',False)
|
||||
new_id=self.pool.get('project.project').copy(cr, uid, proj.id,default={'name':proj.name+'(copy)','state':'template','parent_id':parent_id})
|
||||
for proj in self.browse(cr, uid, ids):
|
||||
parent_id=context.get('parent_id',False)
|
||||
new_id=self.pool.get('project.project').copy(cr, uid, proj.id,default={'name':proj.name+_(' (copy)'),'state':'open','parent_id':parent_id})
|
||||
cr.execute('select id from project_task where project_id=%d', (proj.id,))
|
||||
res = cr.fetchall()
|
||||
tasks_ids = [x[0] for x in res]
|
||||
for tasks_id in tasks_ids:
|
||||
self.pool.get('project.task').copy(cr, uid, tasks_id,default={'project_id':new_id,'active':False}, context=context)
|
||||
for (tasks_id,) in res:
|
||||
self.pool.get('project.task').copy(cr, uid, tasks_id,default={'project_id':new_id,'active':True}, context=context)
|
||||
cr.execute('select id from project_project where parent_id=%d', (proj.id,))
|
||||
res = cr.fetchall()
|
||||
project_ids = [x[0] for x in res]
|
||||
|
|
|
@ -7,13 +7,11 @@
|
|||
-->
|
||||
|
||||
<record id="project_project_9" model="project.project">
|
||||
<field name="planned_hours">584.0</field>
|
||||
<field name="warn_manager">1</field>
|
||||
<field name="name">Tiny ERP Integration</field>
|
||||
<field name="manager" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="project_project_21" model="project.project">
|
||||
<field name="planned_hours">216.0</field>
|
||||
<field name="warn_manager">1</field>
|
||||
<field name="priority">10</field>
|
||||
<field name="parent_id" ref="project_project_9"/>
|
||||
|
@ -22,7 +20,6 @@
|
|||
<field name="manager" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="project_project_22" model="project.project">
|
||||
<field name="planned_hours">264.0</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="parent_id" ref="project_project_9"/>
|
||||
<field name="name">Specific Developements</field>
|
||||
|
@ -30,7 +27,6 @@
|
|||
<field name="manager" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="project_project_23" model="project.project">
|
||||
<field name="planned_hours">104.0</field>
|
||||
<field name="priority">30</field>
|
||||
<field name="parent_id" ref="project_project_9"/>
|
||||
<field name="name">Install, data import, configuration</field>
|
||||
|
@ -40,6 +36,7 @@
|
|||
|
||||
<record id="project_task_116" model="project.task">
|
||||
<field name="planned_hours">38.0</field>
|
||||
<field name="remaining_hours">38.0</field>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="description">BoM, After sales returns, interventions. Tracability.</field>
|
||||
|
@ -47,18 +44,21 @@
|
|||
</record>
|
||||
<record id="project_task_130" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Data importation + Doc</field>
|
||||
</record>
|
||||
<record id="project_task_131" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Modifications asked by the customer.</field>
|
||||
</record>
|
||||
<record id="project_task_184" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="priority">0</field>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
|
@ -67,6 +67,7 @@
|
|||
<record id="project_task_186" model="project.task">
|
||||
<field name="sequence">15</field>
|
||||
<field name="planned_hours">8.0</field>
|
||||
<field name="remaining_hours">8.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Internal testing + Software Install</field>
|
||||
|
@ -75,6 +76,7 @@
|
|||
<record id="project_task_188" model="project.task">
|
||||
<field name="sequence">17</field>
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="priority">2</field>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
|
@ -83,6 +85,7 @@
|
|||
<record id="project_task_189" model="project.task">
|
||||
<field name="sequence">20</field>
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Parameters</field>
|
||||
|
@ -90,6 +93,7 @@
|
|||
<record id="project_task_190" model="project.task">
|
||||
<field name="sequence">20</field>
|
||||
<field name="planned_hours">32.0</field>
|
||||
<field name="remaining_hours">32.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Start of the doc redaction + MRP</field>
|
||||
|
@ -97,6 +101,7 @@
|
|||
<record id="project_task_192" model="project.task">
|
||||
<field name="sequence">25</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">MRP Tests</field>
|
||||
|
@ -104,6 +109,7 @@
|
|||
<record id="project_task_193" model="project.task">
|
||||
<field name="sequence">29</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">MRP; functionnal layer</field>
|
||||
|
@ -113,6 +119,7 @@
|
|||
<record id="project_task_194" model="project.task">
|
||||
<field name="sequence">30</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Products Adaptation</field>
|
||||
|
@ -120,6 +127,7 @@
|
|||
<record id="project_task_195" model="project.task">
|
||||
<field name="sequence">30</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Install + Super User Training</field>
|
||||
|
@ -127,6 +135,7 @@
|
|||
<record id="project_task_196" model="project.task">
|
||||
<field name="sequence">30</field>
|
||||
<field name="planned_hours">32.0</field>
|
||||
<field name="remaining_hours">32.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Customer docs</field>
|
||||
|
@ -134,6 +143,7 @@
|
|||
<record id="project_task_197" model="project.task">
|
||||
<field name="sequence">30</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Development of the presentation layer</field>
|
||||
|
@ -141,6 +151,7 @@
|
|||
<record id="project_task_198" model="project.task">
|
||||
<field name="sequence">40</field>
|
||||
<field name="planned_hours">32.0</field>
|
||||
<field name="remaining_hours">32.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Free Time</field>
|
||||
|
@ -148,6 +159,7 @@
|
|||
<record id="project_task_199" model="project.task">
|
||||
<field name="sequence">40</field>
|
||||
<field name="planned_hours">50.0</field>
|
||||
<field name="remaining_hours">50.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Specific tests</field>
|
||||
|
@ -155,6 +167,7 @@
|
|||
<record id="project_task_200" model="project.task">
|
||||
<field name="sequence">40</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Sale module</field>
|
||||
|
@ -162,6 +175,7 @@
|
|||
<record id="project_task_201" model="project.task">
|
||||
<field name="sequence">40</field>
|
||||
<field name="planned_hours">32.0</field>
|
||||
<field name="remaining_hours">32.0</field>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">In house trainings</field>
|
||||
|
@ -170,6 +184,7 @@
|
|||
<record id="project_task_202" model="project.task">
|
||||
<field name="sequence">50</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Validation + latest modifications.</field>
|
||||
|
@ -177,6 +192,7 @@
|
|||
<record id="project_task_203" model="project.task">
|
||||
<field name="sequence">50</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Adaptations buy module</field>
|
||||
|
@ -184,6 +200,7 @@
|
|||
<record id="project_task_204" model="project.task">
|
||||
<field name="sequence">60</field>
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Presentation of the software.</field>
|
||||
|
@ -191,6 +208,7 @@
|
|||
<record id="project_task_205" model="project.task">
|
||||
<field name="sequence">60</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Adaptations Stock module</field>
|
||||
|
@ -198,6 +216,7 @@
|
|||
<record id="project_task_206" model="project.task">
|
||||
<field name="sequence">70</field>
|
||||
<field name="planned_hours">24.0</field>
|
||||
<field name="remaining_hours">24.0</field>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="name">Latest in house tests</field>
|
||||
|
|
|
@ -21,20 +21,20 @@
|
|||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Administration">
|
||||
<field name="priority"/>
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
<field name="warn_manager"/>
|
||||
<field name="priority"/>
|
||||
<field name="timesheet_id"/>
|
||||
<field name="active" select="2"/>
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
<newline/>
|
||||
<separator colspan="4" string="Project's members"/>
|
||||
<field colspan="4" name="members" nolabel="1"/>
|
||||
<group col="6" colspan="8">
|
||||
<field name="state"/>
|
||||
<field name="state"/>
|
||||
<button name="set_template" string="Set as Template" type="object" states="open"/>
|
||||
<button name="reset_project" string="Reset as Project" type="object" states="template"/>
|
||||
<button name="duplicate_template" string="Duplicate Template" type="object" states="template"/>
|
||||
<button name="reset_project" string="Reset as Project" type="object" states="template"/>
|
||||
<button name="duplicate_template" string="Duplicate Template" type="object" states="template"/>
|
||||
</group>
|
||||
</page>
|
||||
<page groups="base.group_extended" string="Partner Info">
|
||||
|
@ -90,16 +90,6 @@
|
|||
</record>
|
||||
<menuitem action="open_view_all_project" id="menu_all_project" parent="project.menu_main"/>
|
||||
|
||||
<record id="open_view_project" model="ir.actions.act_window">
|
||||
<field name="name">New Project</field>
|
||||
<field name="res_model">project.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form,tree,calendar</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
</record>
|
||||
<menuitem action="open_view_project" id="menu_open_view_project" parent="menu_all_project"/>
|
||||
|
||||
|
||||
<record id="open_view_all_project_unclosed" model="ir.actions.act_window">
|
||||
<field name="name">Unclosed projects</field>
|
||||
<field name="res_model">project.project</field>
|
||||
|
@ -117,7 +107,7 @@
|
|||
<field name="domain">[('parent_id','=',False),('state','=','open')]</field>
|
||||
<field name="view_id" ref="view_project"/>
|
||||
</record>
|
||||
<menuitem action="open_view_all_project_unclosed_open" id="menu_all_project_unclosed_open" parent="project.menu_all_project_unclosed"/>
|
||||
<menuitem action="open_view_all_project_unclosed_open" id="menu_all_project_unclosed_open" parent="project.menu_all_project_unclosed"/>
|
||||
|
||||
<record id="open_view_project_open" model="ir.actions.act_window">
|
||||
<field name="name">Open projects</field>
|
||||
|
@ -128,7 +118,7 @@
|
|||
</record>
|
||||
<menuitem id="next_id_54" name="Projects" parent="project.menu_definitions"/><menuitem action="open_view_project_open" id="menu_open_view_project_open" parent="next_id_54"/>
|
||||
|
||||
<record id="open_view_template_project" model="ir.actions.act_window">
|
||||
<record id="open_view_template_project" model="ir.actions.act_window">
|
||||
<field name="name">Template projects</field>
|
||||
<field name="res_model">project.project</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -137,6 +127,14 @@
|
|||
</record>
|
||||
<menuitem action="open_view_template_project" id="menu_template_project" parent="next_id_54"/>
|
||||
|
||||
<record id="open_view_project" model="ir.actions.act_window">
|
||||
<field name="name">New Project</field>
|
||||
<field name="res_model">project.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form,tree,calendar</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
</record>
|
||||
<menuitem action="open_view_project" id="menu_open_view_project" parent="menu_all_project"/>
|
||||
|
||||
<record id="view_task_work_form" model="ir.ui.view">
|
||||
<field name="name">project.task.work.form</field>
|
||||
|
@ -318,18 +316,18 @@
|
|||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_project_task_graph">
|
||||
<field name="name">project.task.graph</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Project Tasks" type="bar">
|
||||
<field name="project_id"/>
|
||||
<field name="planned_hours" operator="+"/>
|
||||
<field name="delay_hours" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_project_task_graph">
|
||||
<field name="name">project.task.graph</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Project Tasks" type="bar">
|
||||
<field name="project_id"/>
|
||||
<field name="planned_hours" operator="+"/>
|
||||
<field name="delay_hours" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_task" model="ir.actions.act_window">
|
||||
<field name="name">All Tasks</field>
|
||||
|
|
|
@ -169,9 +169,9 @@
|
|||
<form string="Purchase Order Line">
|
||||
<notebook>
|
||||
<page string="Order Line">
|
||||
<field colspan="4" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order)"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order)"/>
|
||||
<field colspan="4" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order)"/>
|
||||
<field colspan="4" name="name"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="price_unit"/>
|
||||
|
|
|
@ -214,7 +214,8 @@ class sale_order(osv.osv):
|
|||
'partner_shipping_id':fields.many2one('res.partner.address', 'Shipping Address', readonly=True, required=True, states={'draft':[('readonly',False)]}),
|
||||
|
||||
'incoterm': fields.selection(_incoterm_get, 'Incoterm',size=3),
|
||||
'picking_policy': fields.selection([('direct','Partial Delivery'),('one','Complete Delivery')], 'Packing Policy', required=True),
|
||||
'picking_policy': fields.selection([('direct','Partial Delivery'),('one','Complete Delivery')],
|
||||
'Packing Policy', required=True, help="""If you don't have enough stock available to deliver all at once, do you accept partial shippings or not."""),
|
||||
'order_policy': fields.selection([
|
||||
('prepaid','Payment before delivery'),
|
||||
('manual','Shipping & Manual Invoice'),
|
||||
|
@ -939,15 +940,27 @@ class sale_config_picking_policy(osv.osv_memory):
|
|||
_name='sale.config.picking_policy'
|
||||
_columns = {
|
||||
'name':fields.char('Name', size=64),
|
||||
'picking_policy': fields.selection([('direct','Direct Delivery'),('one','All at once')], 'Packing Policy', required=True ),
|
||||
'picking_policy': fields.selection([
|
||||
('direct','Direct Delivery'),
|
||||
('one','All at once')
|
||||
], 'Packing Policy', required=True ),
|
||||
'order_policy': fields.selection([
|
||||
('manual','Invoice based on Sales Orders'),
|
||||
('picking','Invoice based on Deliveries'),
|
||||
], 'Shipping Policy', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
}
|
||||
_defaults={
|
||||
'picking_policy': lambda *a: 'direct',
|
||||
'order_policy': lambda *a: 'picking'
|
||||
}
|
||||
def set_default(self, cr, uid, ids, context=None):
|
||||
if 'name' in context:
|
||||
print context
|
||||
for o in self.browse(cr, uid, ids, context=context):
|
||||
print o.picking_policy, o.order_policy
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
ir_values_obj.set(cr,uid,'default',False,'picking_policy',['sale.order'],context['picking_policy'])
|
||||
ir_values_obj.set(cr,uid,'default',False,'picking_policy',['sale.order'],o.picking_policy)
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
ir_values_obj.set(cr,uid,'default',False,'order_policy',['sale.order'],o.order_policy)
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.shop</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_shop_tree"/>
|
||||
</record>
|
||||
<menuitem id="menu_shop_configuration" name="Configuration" parent="sale.menu_sale_root" sequence="1"/>
|
||||
|
@ -221,6 +222,7 @@
|
|||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
</record>
|
||||
<menuitem action="action_order_form" id="menu_sale_order" parent="sale.menu_sale_root"/>
|
||||
|
||||
|
@ -453,10 +455,12 @@
|
|||
<field name="model">sale.config.picking_policy</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Configure Picking Policy for Sale Order">
|
||||
<separator col="4" colspan="4" string="Configure Picking Policy for Sale Order"/>
|
||||
<form string="Sales Configuration">
|
||||
<separator colspan="4" string="Configure Sale Order Logistic"/>
|
||||
<newline/>
|
||||
<field name="picking_policy"/>
|
||||
<newline/>
|
||||
<field name="order_policy"/>
|
||||
<group col="4" colspan="4">
|
||||
<button icon="gtk-cancel" name="action_cancel" type="object" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" name="set_default" string="Set Default" type="object"/>
|
||||
|
|
|
@ -32,63 +32,174 @@ from osv import fields, osv
|
|||
|
||||
class product_product(osv.osv):
|
||||
_inherit = "product.product"
|
||||
# def view_header_get(self, cr, user, view_id, view_type, context):
|
||||
# print self, cr, user
|
||||
# res = super(product_product, self).view_header_get(cr, user, view_id, view_type, context)
|
||||
# if res: return res
|
||||
# if (not context.get('location', False)):
|
||||
# return False
|
||||
# cr.execute('select name from stock_location where id=%d', (context['location'],))
|
||||
# j = cr.fetchone()[0]
|
||||
# if j:
|
||||
# return 'Products: '+j
|
||||
# return False
|
||||
#
|
||||
def _get_product_available_func(states, what):
|
||||
def _product_available(self, cr, uid, ids, name, arg, context={}):
|
||||
if context.get('shop', False):
|
||||
cr.execute('select warehouse_id from sale_shop where id=%d', (int(context['shop']),))
|
||||
res2 = cr.fetchone()
|
||||
if res2:
|
||||
context['warehouse'] = res2[0]
|
||||
def __old_view_header_get(self, cr, user, view_id, view_type, context):
|
||||
res = super(product_product, self).view_header_get(cr, user, view_id, view_type, context)
|
||||
if res: return res
|
||||
if (context.get('location', False)):
|
||||
return _('Products: ')+self.pool.get('stock.location').browse(cr, uid, context['location'], context).name
|
||||
return res
|
||||
|
||||
if context.get('warehouse', False):
|
||||
cr.execute('select lot_stock_id from stock_warehouse where id=%d', (int(context['warehouse']),))
|
||||
res2 = cr.fetchone()
|
||||
if res2:
|
||||
context['location'] = res2[0]
|
||||
|
||||
if context.get('location', False):
|
||||
location_ids = [context['location']]
|
||||
else:
|
||||
cr.execute("select lot_stock_id from stock_warehouse")
|
||||
location_ids = [id for (id,) in cr.fetchall()]
|
||||
|
||||
# build the list of ids of children of the location given by id
|
||||
location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)])
|
||||
res = self.pool.get('stock.location')._product_get_multi_location(cr, uid, location_ids, ids, context, states, what)
|
||||
for id in ids:
|
||||
res.setdefault(id, 0.0)
|
||||
def get_product_available(self,cr,uid,ids,context={}):
|
||||
states=context.get('states',[])
|
||||
what=context.get('what',())
|
||||
if not ids:
|
||||
ids = self.search(cr, uid, [])
|
||||
res = {}.fromkeys(ids, 0.0)
|
||||
if not ids:
|
||||
return res
|
||||
|
||||
if context.get('shop', False):
|
||||
cr.execute('select warehouse_id from sale_shop where id=%d', (int(context['shop']),))
|
||||
res2 = cr.fetchone()
|
||||
if res2:
|
||||
context['warehouse'] = res2[0]
|
||||
|
||||
if context.get('warehouse', False):
|
||||
cr.execute('select lot_stock_id from stock_warehouse where id=%d', (int(context['warehouse']),))
|
||||
res2 = cr.fetchone()
|
||||
if res2:
|
||||
context['location'] = res2[0]
|
||||
|
||||
if context.get('location', False):
|
||||
location_ids = [context['location']]
|
||||
else:
|
||||
cr.execute("select lot_stock_id from stock_warehouse")
|
||||
location_ids = [id for (id,) in cr.fetchall()]
|
||||
|
||||
# build the list of ids of children of the location given by id
|
||||
location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)])
|
||||
|
||||
states_str = ','.join(map(lambda s: "'%s'" % s, states))
|
||||
|
||||
product2uom = {}
|
||||
for product in self.browse(cr, uid, ids, context=context):
|
||||
product2uom[product.id] = product.uom_id.id
|
||||
|
||||
prod_ids_str = ','.join(map(str, ids))
|
||||
location_ids_str = ','.join(map(str, location_ids))
|
||||
results = []
|
||||
results2 = []
|
||||
|
||||
from_date=context.get('from_date',False)
|
||||
to_date=context.get('to_date',False)
|
||||
date_str=False
|
||||
if from_date and to_date:
|
||||
date_str="date>='%s' and date<=%s"%(from_date,to_date)
|
||||
elif from_date:
|
||||
date_str="date>='%s'"%(from_date)
|
||||
elif to_date:
|
||||
date_str="date<='%s'"%(to_date)
|
||||
|
||||
if 'in' in what:
|
||||
# all moves from a location out of the set to a location in the set
|
||||
cr.execute(
|
||||
'select sum(product_qty), product_id, product_uom '\
|
||||
'from stock_move '\
|
||||
'where location_id not in ('+location_ids_str+') '\
|
||||
'and location_dest_id in ('+location_ids_str+') '\
|
||||
'and product_id in ('+prod_ids_str+') '\
|
||||
'and state in ('+states_str+') '+ (date_str and 'and '+date_str+' ' or '') +''\
|
||||
'group by product_id,product_uom'
|
||||
)
|
||||
results = cr.fetchall()
|
||||
if 'out' in what:
|
||||
# all moves from a location in the set to a location out of the set
|
||||
cr.execute(
|
||||
'select sum(product_qty), product_id, product_uom '\
|
||||
'from stock_move '\
|
||||
'where location_id in ('+location_ids_str+') '\
|
||||
'and location_dest_id not in ('+location_ids_str+') '\
|
||||
'and product_id in ('+prod_ids_str+') '\
|
||||
'and state in ('+states_str+') '+ (date_str and 'and '+date_str+' ' or '') + ''\
|
||||
'group by product_id,product_uom'
|
||||
)
|
||||
results2 = cr.fetchall()
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
for amount, prod_id, prod_uom in results:
|
||||
amount = uom_obj._compute_qty(cr, uid, prod_uom, amount,
|
||||
context.get('uom', False) or product2uom[prod_id])
|
||||
res[prod_id] += amount
|
||||
for amount, prod_id, prod_uom in results2:
|
||||
amount = uom_obj._compute_qty(cr, uid, prod_uom, amount,
|
||||
context.get('uom', False) or product2uom[prod_id])
|
||||
res[prod_id] -= amount
|
||||
return res
|
||||
|
||||
def _get_product_available_func(states, what):
|
||||
def _product_available(self, cr, uid, ids, field_names=False, arg=False, context={}):
|
||||
context.update({
|
||||
'states':states,
|
||||
'what':what
|
||||
})
|
||||
stock=self.get_product_available(cr,uid,ids,context=context)
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = {}.fromkeys(field_names, 0.0)
|
||||
for a in field_names:
|
||||
res[id][a] = stock.get(id, 0.0)
|
||||
return res
|
||||
|
||||
return _product_available
|
||||
|
||||
_product_qty_available = _get_product_available_func(('done',), ('in', 'out'))
|
||||
_product_virtual_available = _get_product_available_func(('confirmed','waiting','assigned','done'), ('in', 'out'))
|
||||
_product_outgoing_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('out',))
|
||||
_product_incoming_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('in',))
|
||||
|
||||
|
||||
_columns = {
|
||||
'qty_available': fields.function(_product_qty_available, method=True, type='float', string='Real Stock', help="Current quantities of products in selected locations or all internal if none have been selected."),
|
||||
'virtual_available': fields.function(_product_virtual_available, method=True, type='float', string='Virtual Stock', help="Futur stock for this product according to the selected location or all internal if none have been selected. Computed as: Real Stock - Outgoing + Incoming."),
|
||||
'incoming_qty': fields.function(_product_incoming_qty, method=True, type='float', string='Incoming', help="Quantities of products that are planned to arrive in selected locations or all internal if none have been selected."),
|
||||
'outgoing_qty': fields.function(_product_outgoing_qty, method=True, type='float', string='Outgoing', help="Quantities of products that are planned to leave in selected locations or all internal if none have been selected."),
|
||||
'qty_available': fields.function(_product_qty_available, method=True, type='float', string='Real Stock',multi='qty_available', help="Current quantities of products in selected locations or all internal if none have been selected."),
|
||||
'virtual_available': fields.function(_product_virtual_available, method=True, type='float', string='Virtual Stock',multi='qty_available', help="Futur stock for this product according to the selected location or all internal if none have been selected. Computed as: Real Stock - Outgoing + Incoming."),
|
||||
'incoming_qty': fields.function(_product_incoming_qty, method=True, type='float', string='Incoming',multi='qty_available', help="Quantities of products that are planned to arrive in selected locations or all internal if none have been selected."),
|
||||
'outgoing_qty': fields.function(_product_outgoing_qty, method=True, type='float', string='Outgoing',multi='qty_available', help="Quantities of products that are planned to leave in selected locations or all internal if none have been selected."),
|
||||
'track_production' : fields.boolean('Track Production Lots' , help="Force to use a Production Lot during production order"),
|
||||
'track_incoming' : fields.boolean('Track Incomming Lots', help="Force to use a Production Lot during receptions"),
|
||||
'track_outgoing' : fields.boolean('Track Outging Lots', help="Force to use a Production Lot during deliveries"),
|
||||
}
|
||||
def __old_fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
|
||||
res = super(product_product,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
|
||||
if ('location' in context) and context['location']:
|
||||
location_info = self.pool.get('stock.location').browse(cr, uid, context['location'])
|
||||
fields=res.get('fields',{})
|
||||
if fields:
|
||||
if location_info.usage == 'supplier':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Receptions'
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Received Qty'
|
||||
|
||||
if location_info.usage == 'internal':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Stock'
|
||||
|
||||
if location_info.usage == 'customer':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Deliveries'
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Delivered Qty'
|
||||
|
||||
if location_info.usage == 'inventory':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur P&L'
|
||||
res['fields']['qty_available']['string'] = 'P&L Qty'
|
||||
|
||||
if location_info.usage == 'procurement':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Qty'
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Unplanned Qty'
|
||||
|
||||
if location_info.usage == 'production':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Productions'
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Produced Qty'
|
||||
|
||||
return res
|
||||
product_product()
|
||||
|
||||
|
||||
class product_product(osv.osv):
|
||||
class product_template(osv.osv):
|
||||
_name = 'product.template'
|
||||
_inherit = 'product.template'
|
||||
_columns = {
|
||||
|
@ -126,7 +237,7 @@ class product_product(osv.osv):
|
|||
help='This account will be used, instead of the default one, to value output stock'),
|
||||
}
|
||||
|
||||
product_product()
|
||||
product_template()
|
||||
|
||||
|
||||
class product_category(osv.osv):
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<group name="status" position="after">
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Stocks" colspan="4"/>
|
||||
<separator string="Stocks" colspan="4"/>
|
||||
<field name="qty_available"/>
|
||||
<field name="virtual_available"/>
|
||||
<field name="incoming_qty"/>
|
||||
|
|
|
@ -201,69 +201,14 @@ class stock_location(osv.osv):
|
|||
})
|
||||
return result
|
||||
|
||||
def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={}, states=['done'], what=('in', 'out')):
|
||||
|
||||
product_obj = self.pool.get('product.product')
|
||||
states_str = ','.join(map(lambda s: "'%s'" % s, states))
|
||||
if not product_ids:
|
||||
product_ids = product_obj.search(cr, uid, [])
|
||||
res = {}.fromkeys(product_ids, 0.0)
|
||||
if not ids:
|
||||
return res
|
||||
|
||||
product2uom = {}
|
||||
for product in product_obj.browse(cr, uid, product_ids, context=context):
|
||||
product2uom[product.id] = product.uom_id.id
|
||||
|
||||
prod_ids_str = ','.join(map(str, product_ids))
|
||||
location_ids_str = ','.join(map(str, ids))
|
||||
results = []
|
||||
results2 = []
|
||||
|
||||
from_date=context.get('from_date',False)
|
||||
to_date=context.get('to_date',False)
|
||||
date_str=False
|
||||
if from_date and to_date:
|
||||
date_str="date>='%s' and date<=%s"%(from_date,to_date)
|
||||
elif from_date:
|
||||
date_str="date>='%s'"%(from_date)
|
||||
elif to_date:
|
||||
date_str="date<='%s'"%(to_date)
|
||||
|
||||
if 'in' in what:
|
||||
# all moves from a location out of the set to a location in the set
|
||||
cr.execute(
|
||||
'select sum(product_qty), product_id, product_uom '\
|
||||
'from stock_move '\
|
||||
'where location_id not in ('+location_ids_str+') '\
|
||||
'and location_dest_id in ('+location_ids_str+') '\
|
||||
'and product_id in ('+prod_ids_str+') '\
|
||||
'and state in ('+states_str+') '+ (date_str and 'and '+date_str+' ' or '') +''\
|
||||
'group by product_id,product_uom'
|
||||
)
|
||||
results = cr.fetchall()
|
||||
if 'out' in what:
|
||||
# all moves from a location in the set to a location out of the set
|
||||
cr.execute(
|
||||
'select sum(product_qty), product_id, product_uom '\
|
||||
'from stock_move '\
|
||||
'where location_id in ('+location_ids_str+') '\
|
||||
'and location_dest_id not in ('+location_ids_str+') '\
|
||||
'and product_id in ('+prod_ids_str+') '\
|
||||
'and state in ('+states_str+') '+ (date_str and 'and '+date_str+' ' or '') + ''\
|
||||
'group by product_id,product_uom'
|
||||
)
|
||||
results2 = cr.fetchall()
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
for amount, prod_id, prod_uom in results:
|
||||
amount = uom_obj._compute_qty(cr, uid, prod_uom, amount,
|
||||
context.get('uom', False) or product2uom[prod_id])
|
||||
res[prod_id] += amount
|
||||
for amount, prod_id, prod_uom in results2:
|
||||
amount = uom_obj._compute_qty(cr, uid, prod_uom, amount,
|
||||
context.get('uom', False) or product2uom[prod_id])
|
||||
res[prod_id] -= amount
|
||||
return res
|
||||
def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={}, states=['done'], what=('in', 'out')):
|
||||
product_obj = self.pool.get('product.product')
|
||||
context.update({
|
||||
'states':states,
|
||||
'what':what,
|
||||
'location':ids
|
||||
})
|
||||
return product_obj.get_product_available(cr,uid,product_ids,context=context)
|
||||
|
||||
def _product_get(self, cr, uid, id, product_ids=False, context={}, states=['done']):
|
||||
ids = id and [id] or []
|
||||
|
@ -374,22 +319,24 @@ class stock_picking(osv.osv):
|
|||
_description = "Packing list"
|
||||
def _set_maximum_date(self, cr, uid, ids, name, value, arg, context):
|
||||
if not value: return False
|
||||
for pick in self.browse(cr, uid, ids, context):
|
||||
for pick in self.browse(cr, uid, [ids], context):
|
||||
cr.execute("""update stock_move set
|
||||
date_planned=%s
|
||||
where
|
||||
picking_id=%d and
|
||||
(date_planned=%s or date_planned>%s)""", (value,pick.id,pick.max_date,value))
|
||||
(date_planned>%s)""", (value,pick.id,value))
|
||||
return True
|
||||
|
||||
def _set_minimum_date(self, cr, uid, ids, name, value, arg, context):
|
||||
if not value: return False
|
||||
for pick in self.browse(cr, uid, ids, context):
|
||||
print self.browse(cr, uid, [ids], context)
|
||||
for pick in self.browse(cr, uid,[ids], context):
|
||||
print value,type(value),pick.min_date
|
||||
cr.execute("""update stock_move set
|
||||
date_planned=%s
|
||||
where
|
||||
picking_id=%d and
|
||||
(date_planned=%s or date_planned<%s)""", (value,pick.id,pick.min_date,value))
|
||||
(date_planned<%s)""", (value,pick.id,value))
|
||||
return True
|
||||
|
||||
def get_min_max_date(self, cr, uid, ids, field_name, arg, context={}):
|
||||
|
@ -434,7 +381,7 @@ class stock_picking(osv.osv):
|
|||
], 'Status', readonly=True, select=True),
|
||||
'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date",
|
||||
method=True,store=True, type='datetime', string='Planned Date', select=1),
|
||||
'date':fields.datetime('Date create'),
|
||||
'date':fields.datetime('Date Order'),
|
||||
'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date",
|
||||
method=True,store=True, type='datetime', string='Max. Planned Date', select=2),
|
||||
'move_lines': fields.one2many('stock.move', 'picking_id', 'Move lines'),
|
||||
|
@ -1015,11 +962,8 @@ class stock_move(osv.osv):
|
|||
return result
|
||||
|
||||
def action_confirm(self, cr, uid, moves, context={}):
|
||||
ids = moves
|
||||
if not type(moves) == type([]):
|
||||
ids = map(lambda m: m.id, moves)
|
||||
ids = map(lambda m: m.id, moves)
|
||||
self.write(cr, uid, ids, {'state':'confirmed'})
|
||||
moves= self.pool.get('stock.move').browse(cr, uid, moves)
|
||||
for picking, todo in self._chain_compute(cr, uid, moves, context).items():
|
||||
ptype = self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
|
||||
pickid = self.pool.get('stock.picking').create(cr, uid, {
|
||||
|
@ -1387,71 +1331,4 @@ class stock_picking_move_wizard(osv.osv_memory):
|
|||
return {'type':'ir.actions.act_window_close' }
|
||||
|
||||
stock_picking_move_wizard()
|
||||
|
||||
class product_product(osv.osv):
|
||||
_inherit = 'product.product'
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
|
||||
res = super(product_product,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
|
||||
if ('location' in context) and context['location']:
|
||||
location_info = self.pool.get('stock.location').browse(cr, uid, context['location'])
|
||||
|
||||
if location_info.usage == 'supplier':
|
||||
res['fields']['virtual_available']['string'] = 'Futur Receptions'
|
||||
res['fields']['qty_available']['string'] = 'Received Qty'
|
||||
|
||||
if location_info.usage == 'internal':
|
||||
res['fields']['virtual_available']['string'] = 'Futur Stock'
|
||||
|
||||
if location_info.usage == 'customer':
|
||||
res['fields']['virtual_available']['string'] = 'Futur Deliveries'
|
||||
res['fields']['qty_available']['string'] = 'Delivered Qty'
|
||||
|
||||
if location_info.usage == 'inventory':
|
||||
res['fields']['virtual_available']['string'] = 'Futur P&L'
|
||||
res['fields']['qty_available']['string'] = 'P&L Qty'
|
||||
|
||||
if location_info.usage == 'procurement':
|
||||
res['fields']['virtual_available']['string'] = 'Futur Qty'
|
||||
res['fields']['qty_available']['string'] = 'Unplanned Qty'
|
||||
|
||||
if location_info.usage == 'production':
|
||||
res['fields']['virtual_available']['string'] = 'Futur Productions'
|
||||
res['fields']['qty_available']['string'] = 'Produced Qty'
|
||||
|
||||
return res
|
||||
|
||||
product_product()
|
||||
|
||||
|
||||
class report_inventory_latest(osv.osv):
|
||||
_name = "report.inventory.latest"
|
||||
_description = "Latest inventories by product."
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.datetime('Latest Date',readonly=True),
|
||||
'product': fields.many2one('product.product', 'Product', readonly=True, select=True),
|
||||
'inventory': fields.many2one('stock.inventory', 'Inventory Name', readonly=True, select=True),
|
||||
'qty': fields.float('Quantity', readonly=True, select=True),
|
||||
'uom' : fields.many2one('product.uom', 'UoM', readonly=True),
|
||||
# 'date' : fields.datetime('Latest Date',readonly=True),
|
||||
}
|
||||
_order = 'name desc'
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_inventory_latest as (
|
||||
select max(l.id) as id,
|
||||
l.product_id as product,
|
||||
l.product_qty as qty,
|
||||
l.product_uom as uom ,
|
||||
min(l.inventory_id) as inventory,
|
||||
i.date as name
|
||||
from stock_inventory_line l
|
||||
join stock_inventory i on (l.inventory_id=i.id)
|
||||
group by l.product_uom,l.product_qty,l.product_id,i.date
|
||||
|
||||
)""")
|
||||
report_inventory_latest()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -448,7 +448,7 @@
|
|||
<form string="Move Lines">
|
||||
<field name="address_id" invisible="True" context="{'context_display':'partner'}"/>
|
||||
<field name="picking_id" invisible="True"/>
|
||||
<field domain="[('picking_id','<>',picking_id),('state','in',['confirmed','assigned']),('partner_id','=',address_id)]" name="move_ids" select="1"/><newline/>
|
||||
<field domain="[('picking_id','<>',picking_id),('state','in',['confirmed','assigned'])]" name="move_ids" select="1"/><newline/>
|
||||
<group colspan="4">
|
||||
<button special="cancel" string="Cancel"/>
|
||||
<button name="action_move" string="Add" type="object"/>
|
||||
|
@ -492,12 +492,12 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree color="red:state=='cancel'" string="Packing list">
|
||||
<field name="name"/>
|
||||
<field name="address_id" select="1"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="origin"/>
|
||||
<field name="address_id" select="1"/>
|
||||
<field name="backorder_id"/>
|
||||
<field name="date"/>
|
||||
<field name="min_date"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -587,8 +587,9 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree color="red:state=='cancel'" string="Packing list">
|
||||
<field name="name"/>
|
||||
<field name="address_id" select="1"/>
|
||||
<field name="origin"/>
|
||||
<field name="address_id" select="1"/>
|
||||
<field name="backorder_id"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="min_date" select="1"/>
|
||||
<field name="state" select="1"/>
|
||||
|
@ -771,10 +772,12 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree color="red:state=='cancel'" string="Packing list">
|
||||
<field name="name"/>
|
||||
<field name="origin"/>
|
||||
<field name="address_id"/>
|
||||
<field name="backorder_id"/>
|
||||
<field name="date"/>
|
||||
<field name="min_date"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -940,13 +943,13 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree color="red:state=='cancel'" string="Packing list">
|
||||
<field colspan="4" name="name"/>
|
||||
<field name="address_id" select="1"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="name"/>
|
||||
<field name="origin"/>
|
||||
<field name="address_id"/>
|
||||
<field name="backorder_id"/>
|
||||
<field name="date"/>
|
||||
<field name="min_date"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -1342,11 +1345,10 @@
|
|||
<field name="view_mode">tree</field>
|
||||
<field name="domain">[('name','>=',time.strftime('%Y-%m-01'))]</field>
|
||||
</record>
|
||||
<menuitem
|
||||
id="next_id_61"
|
||||
name="Reporting"
|
||||
parent="stock.menu_stock_root"/>
|
||||
<menuitem action="action_report_stock_latest_form" id="menu_report_stock_latest" parent="next_id_61"/>
|
||||
|
||||
<menuitem action="action_report_stock_latest_form" id="menu_report_stock_latest" parent="next_id_62"/>
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -34,24 +34,27 @@ import time
|
|||
|
||||
def _action_open_window(self, cr, uid, data, context):
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'tree,form',
|
||||
'res_model': 'product.product',
|
||||
'type': 'ir.actions.act_window',
|
||||
'context':{'location': data['ids'][0],'from_date':data['form']['from_date'],'to_date':data['form']['to_date']},
|
||||
'domain':[('type','<>','service')]
|
||||
}
|
||||
'name': False,
|
||||
'view_type': 'form',
|
||||
"view_mode": 'tree,form',
|
||||
'res_model': 'product.product',
|
||||
'type': 'ir.actions.act_window',
|
||||
'context':{'location': data['ids'][0],'from_date':data['form']['from_date'],'to_date':data['form']['to_date']},
|
||||
'domain':[('type','<>','service')]
|
||||
}
|
||||
|
||||
|
||||
class product_by_location(wizard.interface):
|
||||
|
||||
form1 = '''<?xml version="1.0"?>
|
||||
<form string="View Stock of Products">
|
||||
<separator string="Stock Location Analysis" colspan="4"/>
|
||||
<field name="from_date"/>
|
||||
<newline/>
|
||||
<field name="to_date"/>
|
||||
<newline/>
|
||||
<label string=""/>
|
||||
<label string="(Keep empty to open the current situation)" align="0.0" colspan="3"/>
|
||||
</form>'''
|
||||
|
||||
form1_fields = {
|
||||
'from_date': {
|
||||
'string': 'From',
|
||||
|
@ -66,13 +69,11 @@ class product_by_location(wizard.interface):
|
|||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [ ('open', 'Open Products'),('end', 'Cancel')]}
|
||||
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Products','gtk-ok')]}
|
||||
},
|
||||
'open': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
product_by_location('stock.location.products')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue