diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py
index aff75a80192..f9e09ba78ab 100644
--- a/addons/account/account_analytic_line.py
+++ b/addons/account/account_analytic_line.py
@@ -77,7 +77,8 @@ class account_analytic_line(osv.osv):
unit=False, context=None):
uom_obj = self.pool.get('product.uom')
product_obj = self.pool.get('product.product')
- if unit_amount and prod_id:
+# if unit_amount and prod_id:
+ if prod_id:
prod = product_obj.browse(cr, uid, prod_id)
a = prod.product_tmpl_id.property_account_expense.id
if not a:
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 9715598eb9c..b48d4ab1606 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -141,7 +141,7 @@
-
+
diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py
index 1729f086122..c7ae8077d75 100644
--- a/addons/base_contact/base_contact.py
+++ b/addons/base_contact/base_contact.py
@@ -100,7 +100,8 @@ class res_partner_job(osv.osv):
return []
res = []
for r in self.browse(cr, uid, ids):
- res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] +", "+ r.function_id.name))
+ funct = r.function_id and (", " + r.function_id.name) or ""
+ res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] + funct ))
return res
def search(self, cr, user, args, offset=0, limit=None, order=None,
diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py
index 93f2ff837c0..fbe94e38bf3 100644
--- a/addons/base_report_creator/base_report_creator.py
+++ b/addons/base_report_creator/base_report_creator.py
@@ -47,31 +47,6 @@ from tools.translate import _
# return super(ir_model_fields, self).search(cr, uid, args, offset, limit, order, context)
#ir_model_fields()
-class ir_model(osv.osv):
- _inherit = 'ir.model'
-
- def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
- res_model_ids = super(ir_model,self).search(cr, uid, args, offset, limit, order, context=context, count=count)
- try:
- if 'model_ids' in context and context['model_ids'][0][2]:
- model_ids = context['model_ids'][0][2]
- result = []
- name_list = []
- if model_ids:
- obj = self.read(cr, uid, model_ids,['model'])
- for name in obj:
- name_list.append(name['model'])
- cr.execute("SELECT model_id, relation FROM ir_model_fields WHERE relation in (%s)" % (','.join(map(lambda x: "'"+str(x)+"'",name_list))))
-
- for r in cr.fetchall():
- result.append(r[0])
- return result
- return res_model_ids
-
- except Exception,e:
- pass
-
-ir_model()
class report_creator(osv.osv):
_name = "base_report_creator.report"
diff --git a/addons/document_ics/__init__.py b/addons/document_ics/__init__.py
index faf96b9d189..a651d00614b 100644
--- a/addons/document_ics/__init__.py
+++ b/addons/document_ics/__init__.py
@@ -21,4 +21,5 @@
##############################################################################
import document
+import document_ics_config_wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/document_ics/__terp__.py b/addons/document_ics/__terp__.py
index d5adf71e88f..9e3d85295da 100644
--- a/addons/document_ics/__terp__.py
+++ b/addons/document_ics/__terp__.py
@@ -30,7 +30,7 @@
'website': 'http://www.openerp.com',
'depends': ['document', 'crm_configuration'],
'init_xml': ['document_data.xml'],
- 'update_xml': ['document_view.xml', 'security/ir.model.access.csv'],
+ 'update_xml': ['document_view.xml', 'security/ir.model.access.csv','document_ics_config_wizard.xml'],
'demo_xml': ['document_demo.xml'],
'installable': True,
'active': False,
diff --git a/addons/document_ics/document.py b/addons/document_ics/document.py
index f936c352d83..048a82c7680 100644
--- a/addons/document_ics/document.py
+++ b/addons/document_ics/document.py
@@ -28,6 +28,7 @@ import base64
import datetime
import time
import random
+import tools
ICS_TAGS = {
'summary':'normal',
@@ -35,7 +36,7 @@ ICS_TAGS = {
'dtstart':'date' ,
'dtend':'date' ,
'created':'date' ,
- 'dt-stamp':'date' ,
+ 'dtstamp':'date' ,
'last-modified':'normal' ,
'url':'normal' ,
'attendee':'multiple',
@@ -50,7 +51,7 @@ class document_directory_ics_fields(osv.osv):
_name = 'document.directory.ics.fields'
_columns = {
'field_id': fields.many2one('ir.model.fields', 'Open ERP Field', required=True),
- 'name': fields.selection(map(lambda x: (x,x), ICS_TAGS.keys()),'ICS Value', required=True),
+ 'name': fields.selection(map(lambda x: (x, x), ICS_TAGS.keys()), 'ICS Value', required=True),
'content_id': fields.many2one('document.directory.content', 'Content', required=True, ondelete='cascade')
}
document_directory_ics_fields()
@@ -105,6 +106,12 @@ class document_directory_content(osv.osv):
return True
def process_read_ics(self, cr, uid, node, context={}):
+ def ics_datetime(idate, short=False):
+ if short:
+ return datetime.date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d')))
+ else:
+ return datetime.datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
+
import vobject
obj_class = self.pool.get(node.content.ics_object_id.model)
# Can be improved to use context and active_id !
@@ -113,21 +120,31 @@ class document_directory_content(osv.osv):
cal = vobject.iCalendar()
for obj in obj_class.browse(cr, uid, ids, context):
event = cal.add('vevent')
+ # Fix dtstamp et last-modified with create and write date on the object line
+ perm = obj_class.perm_read(cr, uid, [obj.id], context)
+ event.add('created').value = ics_datetime(time.strftime('%Y-%m-%d %H:%M:%S'))
+ event.add('dtstamp').value = ics_datetime(perm[0]['create_date'][:19])
+ if perm[0]['write_date']:
+ event.add('last-modified').value = ics_datetime(perm[0]['write_date'][:19])
for field in node.content.ics_field_ids:
value = getattr(obj, field.field_id.name)
if (not value) and field.name=='uid':
- value = 'OpenERP-'+str(random.randint(1999999999, 9999999999))
+ value = 'OpenERP-%s_%s@%s' % (node.content.ics_object_id.model, str(obj.id), cr.dbname,)
obj_class.write(cr, uid, [obj.id], {field.field_id.name: value})
if ICS_TAGS[field.name]=='normal':
if type(value)==type(obj):
value=value.name
value = value or ''
event.add(field.name).value = value or ''
- elif ICS_TAGS[field.name]=='date':
- dt = value or time.strftime('%Y-%m-%d %H:%M:%S')
- if len(dt)==10:
- dt = dt+' 09:00:00'
- value = datetime.datetime.strptime(dt, '%Y-%m-%d %H:%M:%S')
+ elif ICS_TAGS[field.name]=='date' and value:
+ if field.name == 'dtstart':
+ date_start = start_date = datetime.datetime.fromtimestamp(time.mktime(time.strptime(value , "%Y-%m-%d %H:%M:%S")))
+ if field.name == 'dtend' and isinstance(value, float):
+ value = (start_date + datetime.timedelta(hours=value)).strftime('%Y-%m-%d %H:%M:%S')
+ if len(value)==10:
+ value = ics_datetime(value, True)
+ else:
+ value = ics_datetime(value)
event.add(field.name).value = value
s= StringIO.StringIO(cal.serialize().encode('utf8'))
s.name = node
@@ -138,8 +155,36 @@ document_directory_content()
class crm_case(osv.osv):
_inherit = 'crm.case'
_columns = {
- 'code': fields.char('Calendar Code', size=64)
+ 'code': fields.char('Calendar Code', size=64),
+ 'date_deadline': fields.datetime('Deadline', help="Deadline Date is automatically computed from Start Date + Duration"),
}
+
+ _defaults = {
+ 'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'crm.case'),
+ }
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ """
+ code field must be unique in ICS file
+ """
+ if not default: default = {}
+ if not context: context = {}
+ default.update({'code': self.pool.get('ir.sequence').get(cr, uid, 'crm.case'), 'id': False})
+ return super(crm_case, self).copy(cr, uid, id, default, context)
+
+ def on_change_duration(self, cr, uid, id, date, duration):
+ if not date:
+ return {}
+ start_date = datetime.datetime.fromtimestamp(time.mktime(time.strptime(date, "%Y-%m-%d %H:%M:%S")))
+ if duration >= 0 :
+ end = start_date + datetime.timedelta(hours=duration)
+ if duration < 0:
+ raise osv.except_osv(_('Warning !'),
+ _('You can not set negative Duration.'))
+
+ res = {'value' : {'date_deadline' : end.strftime('%Y-%m-%d %H:%M:%S')}}
+ return res
+
crm_case()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/document_ics/document_data.xml b/addons/document_ics/document_data.xml
index 5e2873aee6f..d2e83a35f40 100644
--- a/addons/document_ics/document_data.xml
+++ b/addons/document_ics/document_data.xml
@@ -6,6 +6,20 @@
.ics
ICS Calendar
-
+
+
+
+
+ CRM Case Code
+ crm.case
+
+
+ CRM Case
+ crm.case
+ CASE
+ 3
+
+
+
diff --git a/addons/document_ics/document_demo.xml b/addons/document_ics/document_demo.xml
index eb939cfd515..964be6511e0 100644
--- a/addons/document_ics/document_demo.xml
+++ b/addons/document_ics/document_demo.xml
@@ -26,6 +26,11 @@
+
+ dtend
+
+
+
summary
@@ -38,7 +43,7 @@
description
-
+
diff --git a/addons/document_ics/document_ics_config_wizard.py b/addons/document_ics/document_ics_config_wizard.py
new file mode 100644
index 00000000000..9a2b738ce50
--- /dev/null
+++ b/addons/document_ics/document_ics_config_wizard.py
@@ -0,0 +1,133 @@
+ # -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import time
+import tools
+from osv import fields, osv, orm
+import os
+import mx.DateTime
+import base64
+import pooler
+
+SECTION_NAME = {
+ 'meeting' : 'Meetings',
+ 'lead':'Prospects',
+ 'opportunity':'Opportunities',
+ 'jobs':'Jobs',
+ 'bugs':'Bug Tracking',
+ 'fund':'Fund Raising',
+ 'helpdesk':'HelpDesk',
+ 'claims':'Claims',
+ 'phonecall':'Phone Calls',
+ }
+
+ICS_TAGS = {
+ 'summary':'Description',
+ 'uid':'Calendar Code' ,
+ 'dtstart':'Date' ,
+ 'dtend':'Deadline' ,
+ 'url':'Partner Email' ,
+ 'description':'Your action',
+ }
+
+class document_ics_crm_wizard(osv.osv_memory):
+ _name='document.ics.crm.wizard'
+ _columns = {
+ 'name':fields.char('Name', size=64),
+ 'meeting' : fields.boolean('Calendar of Meetings', help="Manages the calendar of meetings of the users."),
+ 'lead' : fields.boolean('Prospect', help="Allows you to track and manage prospects which are pre-sales requests or contacts, the very first contact with a customer request."),
+ 'opportunity' : fields.boolean('Business Opportunities', help="Tracks identified business opportunities for your sales pipeline."),
+ 'jobs' : fields.boolean('Jobs Hiring Process', help="Help you to organise the jobs hiring process: evaluation, meetings, email integration..."),
+ 'document_ics':fields.boolean('Shared Calendar', help=" Will allow you to synchronise your Open ERP calendars with your phone, outlook, Sunbird, ical, ..."),
+ 'bugs' : fields.boolean('Bug Tracking', help="Used by companies to track bugs and support requests on softwares"),
+ 'helpdesk': fields.boolean('Helpdesk', help="Manages an Helpdesk service."),
+ 'fund' : fields.boolean('Fund Raising Operations', help="This may help associations in their fund raising process and tracking."),
+ 'claims' : fields.boolean('Claims', help="Manages the supplier and customers claims, including your corrective or preventive actions."),
+ 'phonecall' : fields.boolean('Phone Calls', help="Help you to encode the result of a phone call or to planify a list of phone calls to process."),
+ }
+ _defaults = {
+ 'meeting': lambda *args: True,
+ 'opportunity': lambda *args: True,
+ 'phonecall': lambda *args: True,
+ }
+
+ def action_create(self, cr, uid, ids, context=None):
+ data=self.read(cr, uid, ids, [])[0]
+ dir_obj = self.pool.get('document.directory')
+ dir_cont_obj = self.pool.get('document.directory.content')
+ dir_id = dir_obj.search(cr, uid, [('name', '=', 'Calendars')])
+ if dir_id:
+ dir_id = dir_id[0]
+ else:
+ dir_id = dir_obj.create(cr, uid, {'name': 'Calendars' ,'user_id' : uid, 'type': 'directory'})
+ for section in ['meeting', 'lead', 'opportunity', 'jobs', 'bugs', 'fund', 'helpdesk', 'claims', 'phonecall']:
+ if (not data[section]):
+ continue
+ else:
+ section_id=self.pool.get('crm.case.section').search(cr, uid, [('name', '=', SECTION_NAME[section])])
+ if not section_id:
+ continue
+ else:
+ object_id=self.pool.get('ir.model').search(cr, uid, [('name', '=', 'Case')])[0]
+
+ vals_cont={
+ 'name': SECTION_NAME[section],
+ 'sequence': 1,
+ 'directory_id': dir_id,
+ 'suffix': section,
+ 'extension': '.ics',
+ 'ics_object_id': object_id,
+ 'ics_domain': [('section_id', '=', section_id[0])],
+ 'include_name' : False
+ }
+
+ content_id = dir_cont_obj.create(cr, uid, vals_cont)
+
+ ics_obj=self.pool.get('document.directory.ics.fields')
+ for tag in ['description', 'url', 'summary', 'dtstart', 'dtend', 'uid']:
+ field_id = self.pool.get('ir.model.fields').search(cr, uid, [('model_id.name', '=', 'Case'), ('field_description', '=', ICS_TAGS[tag])])[0]
+ vals_ics={
+ 'field_id': field_id ,
+ 'name': tag ,
+ 'content_id': content_id ,
+ }
+ ics_obj.create(cr, uid, vals_ics)
+
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.actions.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
+ def action_cancel(self, cr, uid, ids, conect=None):
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.actions.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
+
+document_ics_crm_wizard()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/document_ics/document_ics_config_wizard.xml b/addons/document_ics/document_ics_config_wizard.xml
new file mode 100644
index 00000000000..9c2132bc89d
--- /dev/null
+++ b/addons/document_ics/document_ics_config_wizard.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+ Configure Calendars for Sections
+ document.ics.crm.wizard
+ form
+
+
+
+
+
+
+ Configure Calendars for Sections
+ ir.actions.act_window
+ document.ics.crm.wizard
+ form
+ form
+ new
+
+
+
+
+
+
+
+
+
diff --git a/addons/document_ics/document_view.xml b/addons/document_ics/document_view.xml
index bdc82d5e6d2..1623be30af6 100644
--- a/addons/document_ics/document_view.xml
+++ b/addons/document_ics/document_view.xml
@@ -20,6 +20,31 @@
-
+
+
+ crm.case.code.form
+ crm.case
+ form
+
+
+
+
+
+
+
+
+
+ crm.case.inherit.form1
+ crm.case
+ form
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py
index 70d4a80c501..7ceca8495d5 100644
--- a/addons/hr_timesheet/hr_timesheet.py
+++ b/addons/hr_timesheet/hr_timesheet.py
@@ -56,7 +56,8 @@ class hr_analytic_timesheet(osv.osv):
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}):
res = {}
- if prod_id and unit_amount:
+# if prod_id and unit_amount:
+ if prod_id:
res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount,unit, context)
return res
diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml
index c9f7214ecca..e6769788cbb 100644
--- a/addons/hr_timesheet/hr_timesheet_view.xml
+++ b/addons/hr_timesheet/hr_timesheet_view.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/addons/hr_timesheet_invoice/security/ir.model.access.csv b/addons/hr_timesheet_invoice/security/ir.model.access.csv
index c56f26ab3ee..670f835a50d 100644
--- a/addons/hr_timesheet_invoice/security/ir.model.access.csv
+++ b/addons/hr_timesheet_invoice/security/ir.model.access.csv
@@ -1,3 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_hr_timesheet_invoice_factor","hr_timesheet_invoice.factor","model_hr_timesheet_invoice_factor","hr.group_hr_user",1,0,0,0
-"access_hr_timesheet_invoice_factor","hr_timesheet_invoice.factor","model_hr_timesheet_invoice_factor","account.group_account_invoice",1,1,1,1
+"access_hr_timesheet_invoice_factor_hr_user","hr_timesheet_invoice.factor.hr.user","model_hr_timesheet_invoice_factor","hr.group_hr_user",1,0,0,0
+"access_hr_timesheet_invoice_factor_acc_inv","hr_timesheet_invoice.factor.account.invoice","model_hr_timesheet_invoice_factor","account.group_account_invoice",1,1,1,1
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
index e950aacd78a..45205b03d2d 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
@@ -158,18 +158,29 @@ class invoice_create(wizard.interface):
pool.get('account.invoice.line').create(cr, uid, curr_line)
strids = ','.join(map(str, data['ids']))
cr.execute("update account_analytic_line set invoice_id=%%s WHERE account_id = %%s and id IN (%s)" % strids, (last_invoice,account.id,))
+
pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)
-
- return {
- 'domain': "[('id','in', ["+','.join(map(str,invoices))+"])]",
- 'name': _('Invoices'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'out_invoice'}",
- 'type': 'ir.actions.act_window'
- }
+
+ mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
+ act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
+
+ mod_id = mod_obj.search(cr, uid, [('name', '=', 'action_invoice_tree1')])[0]
+ res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
+ act_win = act_obj.read(cr, uid, res_id, [])
+ act_win['domain'] = [('id','in',[(','.join(map(str,invoices)))]),('type','=','out_invoice')]
+ act_win['name'] = _('Invoices')
+ return act_win
+
+# return {
+# 'domain': "[('id','in', ["+','.join(map(str,invoices))+"])]",
+# 'name': _('Invoices'),
+# 'view_type': 'form',
+# 'view_mode': 'tree,form',
+# 'res_model': 'account.invoice',
+# 'view_id': False,
+# 'context': "{'type':'out_invoice'}",
+# 'type': 'ir.actions.act_window'
+# }
_create_form = """
diff --git a/addons/hr_timesheet_sheet/security/ir.model.access.csv b/addons/hr_timesheet_sheet/security/ir.model.access.csv
index 2962ede66ee..193035bbca2 100644
--- a/addons/hr_timesheet_sheet/security/ir.model.access.csv
+++ b/addons/hr_timesheet_sheet/security/ir.model.access.csv
@@ -1,5 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_timesheet_sheet_sheet","hr_timesheet_sheet.sheet","model_hr_timesheet_sheet_sheet","hr.group_hr_user",1,1,1,1
"access_hr_timesheet_sheet_sheet_day","hr_timesheet_sheet.sheet.day","model_hr_timesheet_sheet_sheet_day","hr.group_hr_user",1,1,1,1
-"access_hr_timesheet_sheet_sheet_account","hr_timesheet_sheet.sheet.account","model_hr_timesheet_sheet_sheet_account","hr.group_hr_user",1,1,1,1
-"access_hr_timesheet_invoice_factor","hr_timesheet_invoice.hr_timesheet_invoice.factor","hr_timesheet_invoice.model_hr_timesheet_invoice_factor","hr.group_hr_user",1,0,0,0
\ No newline at end of file
+"access_hr_timesheet_sheet_sheet_account","hr_timesheet_sheet.sheet.account","model_hr_timesheet_sheet_sheet_account","hr.group_hr_user",1,1,1,1
\ No newline at end of file
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 303f8491625..42c0525eaf7 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -729,7 +729,7 @@ class mrp_production_workcenter_line(osv.osv):
'cycle': fields.float('Nbr of cycle', digits=(16,2)),
'hour': fields.float('Nbr of hour', digits=(16,2)),
'sequence': fields.integer('Sequence', required=True),
- 'production_id': fields.many2one('mrp.production', 'Production Order', select=True),
+ 'production_id': fields.many2one('mrp.production', 'Production Order', select=True, ondelete='cascade'),
}
_defaults = {
'sequence': lambda *a: 1,
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index db2ced31c97..cc948c0cb18 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -434,7 +434,7 @@ class pos_order(osv.osv):
payment_id = self.pool.get('pos.payment').create(cr, uid, args )
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'pos.order', order_id, 'payment', cr)
+ wf_service.trg_validate(uid, 'pos.order', order_id, 'paid', cr)
wf_service.trg_write(uid, 'pos.order', order_id, cr)
return payment_id
diff --git a/addons/point_of_sale/security/ir.model.access.csv b/addons/point_of_sale/security/ir.model.access.csv
index 36fa9c41d46..38d754a31af 100644
--- a/addons/point_of_sale/security/ir.model.access.csv
+++ b/addons/point_of_sale/security/ir.model.access.csv
@@ -12,3 +12,4 @@
"access_stock_picking_pos_user","stock.picking pos_user","stock.model_stock_picking","point_of_sale.group_pos_user",1,1,1,1
"access_sale_shop_pos_user","sale.shop pos_user","sale.model_sale_shop","point_of_sale.group_pos_user",1,0,0,0
"access_pos_order_stock_worker","pos.order stock_worker","model_pos_order","stock.group_stock_user",1,0,0,0
+"access_stock_move_pos_user","stock.move pos_user","stock.model_stock_move","point_of_sale.group_pos_user",1,1,1,1
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 2784a0780bc..97f4dc0eb28 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -262,7 +262,7 @@
-
+
diff --git a/addons/report_intrastat/report_intrastat.py b/addons/report_intrastat/report_intrastat.py
index 6b467f08c41..c45ac1085ae 100644
--- a/addons/report_intrastat/report_intrastat.py
+++ b/addons/report_intrastat/report_intrastat.py
@@ -55,7 +55,9 @@ class report_intrastat(osv.osv):
_description = "Intrastat report"
_auto = False
_columns = {
- 'name': fields.date('Month', readonly=True),
+ 'name': fields.many2one('account.period', 'Period', readonly=True,select=True),
+ 'supply_units':fields.float('Supply Units', readonly=True),
+ 'ref':fields.char('Origin',size=64, readonly=True),
'code': fields.char('Country code', size="2", readonly=True),
'intrastat_id': fields.many2one('report.intrastat.code', 'Intrastat code', readonly=True),
'weight': fields.float('Weight', readonly=True),
@@ -66,56 +68,63 @@ class report_intrastat(osv.osv):
def init(self, cr):
cr.execute("""
create or replace view report_intrastat as (
- select
- to_char(m.create_date, 'YYYY-MM-01') as name,
- min(m.id) as id,
- pt.intrastat_id as intrastat_id,
- case when l.usage in ('supplier', 'customer') then upper(pc.code) else upper(c.code) end as code,
- sum(case when pol.price_unit is not null
- then pol.price_unit * m.product_qty
- else
- case when sol.price_unit is not null
- then sol.price_unit * m.product_qty
- else 0
- end
- end) as value,
- sum(pt.weight_net * m.product_qty) as weight,
- case when l.usage in ('supplier', 'customer') then 'import' else 'export' end as type,
- case when ppl.currency_id is not null
- then ppl.currency_id
- else spl.currency_id
- end as currency_id
- from
- stock_move m
- left join (product_template pt
- left join product_product pp on (pp.product_tmpl_id = pt.id))
- on (m.product_id = pt.id)
- left join (res_partner_address a
- left join res_country c on (c.id = a.country_id))
- on (a.id = m.address_id)
- left join (stock_picking sp
- left join (res_partner_address pa
- left join res_country pc on (pc.id = pa.country_id))
- on (pa.id = sp.address_id))
- on (sp.id = m.picking_id)
- left join stock_location l on (l.id = m.location_id)
- left join stock_location dl on (dl.id = m.location_dest_id)
- left join (purchase_order_line pol
- left join (purchase_order po
- left join product_pricelist ppl on (ppl.id = po.pricelist_id))
- on (po.id = pol.order_id))
- on (pol.id = m.purchase_line_id)
- left join (sale_order_line sol
- left join (sale_order so
- left join product_pricelist spl on (spl.id = so.pricelist_id))
- on (so.id = sol.order_id))
- on (sol.id = m.sale_line_id)
- where
- m.state != 'draft'
- and ((l.usage in ('supplier', 'customer') and dl.usage not in ('supplier', 'customer'))
- or (dl.usage in ('supplier', 'customer') and l.usage not in ('supplier', 'customer')))
- and (c.intrastat is not null or pc.intrastat is not null)
- group by to_char(m.create_date, 'YYYY-MM-01'), pt.intrastat_id, c.code, pc.code, l.usage, dl.usage, ppl.currency_id, spl.currency_id
+ select
+ inv.period_id as name,
+ min(inv_line.id) as id,
+ intrastat.id as intrastat_id,
+ upper(inv_country.code) as code,
+ sum(case when inv_line.price_unit is not null
+ then inv_line.price_unit * inv_line.quantity
+ else 0
+ end) as value,
+ sum(
+ case when uom.category_id != puom.category_id then pt.weight_net * inv_line.quantity
+ else
+ case when uom.factor_inv_data > 0
+ then
+ pt.weight_net * inv_line.quantity * uom.factor_inv_data
+ else
+ pt.weight_net * inv_line.quantity / uom.factor
+ end
+ end
+ ) as weight,
+ sum(
+ case when uom.category_id != puom.category_id then inv_line.quantity
+ else
+ case when uom.factor_inv_data > 0
+ then
+ inv_line.quantity * uom.factor_inv_data
+ else
+ inv_line.quantity / uom.factor
+ end
+ end
+ ) as supply_units,
+
+ inv.currency_id as currency_id,
+ inv.number as ref,
+ case when inv.type in ('out_invoice','in_refund')
+ then 'export'
+ else 'import'
+ end as type
+ from
+ account_invoice inv
+ left join account_invoice_line inv_line on inv_line.invoice_id=inv.id
+ left join (product_template pt
+ left join product_product pp on (pp.product_tmpl_id = pt.id))
+ on (inv_line.product_id = pt.id)
+ left join product_uom uom on uom.id=inv_line.uos_id
+ left join product_uom puom on puom.id = pt.uom_id
+ left join report_intrastat_code intrastat on pt.intrastat_id = intrastat.id
+ left join (res_partner_address inv_address
+ left join res_country inv_country on (inv_country.id = inv_address.country_id))
+ on (inv_address.id = inv.address_invoice_id)
+
+ where
+ inv.state in ('open','paid')
+ and inv_line.product_id is not null
+ and inv_country.intrastat=true
+
+ group by inv.period_id,intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id
)""")
report_intrastat()
diff --git a/addons/report_intrastat/report_intrastat_view.xml b/addons/report_intrastat/report_intrastat_view.xml
index 9432091beca..51841c13bb5 100644
--- a/addons/report_intrastat/report_intrastat_view.xml
+++ b/addons/report_intrastat/report_intrastat_view.xml
@@ -77,10 +77,12 @@
-
+
+
+
@@ -93,7 +95,7 @@
report.intrastat
form
tree
- [('name','=',time.strftime('%Y-%m-01'))]
+ [('name','=',time.strftime('%b.%Y'))]
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 35c39d6ceeb..638fb7ca658 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -425,7 +425,7 @@ class stock_picking(osv.osv):
'date_done':fields.datetime('Date Done'),
'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'),
+ 'move_lines': fields.one2many('stock.move', 'picking_id', 'Move lines',states={'done':[('readonly',True)],'cancel':[('readonly',True)]}),
'auto_picking': fields.boolean('Auto-Packing'),
'address_id': fields.many2one('res.partner.address', 'Partner'),
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 65fa1fc504d..370a5b52f81 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -653,7 +653,7 @@
-
+