@@ -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:
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
<field domain="[('type', '=', 'purchase')]" name="journal_id" select="2"/>
|
||||
<field name="type" readonly="1" select="2"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id)" select="2"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank)" select="1"/>
|
||||
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank)" select="1" context="{'default_customer': 0}" />
|
||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
||||
<field domain="[('type','<>','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
|
||||
</group>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -21,4 +21,5 @@
|
||||
##############################################################################
|
||||
|
||||
import document
|
||||
import document_ics_config_wizard
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -6,6 +6,20 @@
|
||||
<field name="code">.ics</field>
|
||||
<field name="name">ICS Calendar</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="seq_type_crm_case_code" model="ir.sequence.type">
|
||||
<field name="name">CRM Case Code</field>
|
||||
<field name="code">crm.case</field>
|
||||
</record>
|
||||
<record id="seq_sale_order" model="ir.sequence">
|
||||
<field name="name">CRM Case</field>
|
||||
<field name="code">crm.case</field>
|
||||
<field name="prefix">CASE</field>
|
||||
<field name="padding">3</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
</openerp>
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
<field name="field_id" ref="crm.field_crm_case_date"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field6">
|
||||
<field name="name">dtend</field>
|
||||
<field name="field_id" ref="crm.field_crm_case_date_deadline"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field2">
|
||||
<field name="name">summary</field>
|
||||
<field name="field_id" ref="crm.field_crm_case_name"/>
|
||||
@@ -38,7 +43,7 @@
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field4">
|
||||
<field name="name">description</field>
|
||||
<field name="field_id" ref="crm_configuration.field_crm_case_note"/>
|
||||
<field name="field_id" ref="crm.field_crm_case_description"/>
|
||||
<field name="content_id" ref="dir_content_calendar"/>
|
||||
</record>
|
||||
<record model="document.directory.ics.fields" id="dir_field5">
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_document_ics_config_directories" model="ir.ui.view">
|
||||
<field name="name">Configure Calendars for Sections</field>
|
||||
<field name="model">document.ics.crm.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Configure Calendars for CRM Sections">
|
||||
<separator colspan="4" string="Create Pre-Configured Calendars"/>
|
||||
<newline/>
|
||||
<field name="meeting"/>
|
||||
<field name="opportunity"/>
|
||||
<field name="phonecall"/>
|
||||
<field name="lead"/>
|
||||
<field name="claims"/>
|
||||
<field name="bugs"/>
|
||||
<field name="helpdesk"/>
|
||||
<field name="jobs"/>
|
||||
<field name="fund"/>
|
||||
<newline/>
|
||||
<group col="4" colspan="4">
|
||||
<button icon="gtk-cancel" name="action_cancel" type="object" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-go-forward" name="action_create" string="Next" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_document_ics_config_directories" model="ir.actions.act_window">
|
||||
<field name="name">Configure Calendars for Sections </field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.ics.crm.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- register configuration wizard -->
|
||||
<record id="config_wizard_step_case_section_menu" model="ir.actions.todo">
|
||||
<field name="name">Create Calendars for CRM Case Section</field>
|
||||
<field name="note">This Configuration step use to create Calendars in document for all Case Sections</field>
|
||||
<field name="action_id" ref="action_view_document_ics_config_directories"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -20,6 +20,31 @@
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_case_inherit_form">
|
||||
<field name="name">crm.case.code.form</field>
|
||||
<field name="model">crm.case</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="crm.crm_case-view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="priority" position="after">
|
||||
<field name="code"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_case_inherit_form1">
|
||||
<field name="name">crm.case.inherit.form1</field>
|
||||
<field name="model">crm.case</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="crm.crm_case-view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date" position="replace">
|
||||
<field name="date" on_change="on_change_duration(date, duration)" required="1"/>
|
||||
<field name="duration" string="Duration(In Hour)" on_change="on_change_duration(date, duration)" widget="float_time"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<field domain="[('type','=','normal'),('state', '<>', 'close')]" name="account_id"/>
|
||||
<field name="name"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" sum="Total time"/>
|
||||
<field name="product_id" required="1" domain="[('type','=','service')]"/>
|
||||
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" required="1" domain="[('type','=','service')]"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
|
||||
<field name="amount" sum="Total cost"/>
|
||||
<field name="general_account_id"/>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
@@ -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 = """<?xml version="1.0"?>
|
||||
|
||||
@@ -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
|
||||
"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
|
||||
|
+1
-1
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
@@ -262,7 +262,7 @@
|
||||
<group colspan="6" col="6">
|
||||
<field name="name" select="1" attrs="{'readonly':[('state','=','done')]}" />
|
||||
<field name="project_id" required="1" select="1" attrs="{'readonly':[('state','=','done')]}" />
|
||||
<field name="total_hours" widget="float_time" attrs="{'readonly':[('state','=','done')]}" />
|
||||
<field name="total_hours" widget="float_time"/>
|
||||
<field name="user_id" select="1" attrs="{'readonly':[('state','=','done')]}" />
|
||||
<field name="date_deadline" select="2" attrs="{'readonly':[('state','=','done')]}" />
|
||||
<field name="progress" widget="progressbar"/>
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -77,10 +77,12 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat Data">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="code"/>
|
||||
<field name="ref"/>
|
||||
<field name="intrastat_id"/>
|
||||
<field name="weight"/>
|
||||
<field name="value"/>
|
||||
<field name="supply_units"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="type"/>
|
||||
</tree>
|
||||
@@ -93,7 +95,7 @@
|
||||
<field name="res_model">report.intrastat</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
|
||||
<field name="domain">[('name','=',time.strftime('%b.%Y'))]</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="next_id_89" name="This Month" parent="stock.next_id_61"/>
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -653,7 +653,7 @@
|
||||
</field>
|
||||
<group col="7" colspan="4">
|
||||
<label colspan="6"/>
|
||||
<button name="%(move_split)d" string="Split in Two" type="action"/>
|
||||
<button name="%(move_split)d" string="Split in Two" type="action" states="assigned,confirmed,draft,auto" />
|
||||
</group>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state" readonly="1"/>
|
||||
|
||||
Reference in New Issue
Block a user