bzr revid: fp@tinyerp.com-20090520134711-8su8ep1kjek0je4c
This commit is contained in:
Fabien Pinckaers 2009-05-20 15:47:11 +02:00
commit e9f4db614a
35 changed files with 587 additions and 245 deletions

View File

@ -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:

View File

@ -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','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
</group>

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -40,8 +40,8 @@ class journal_print(report_sxw.rml_parse):
'sum_credit': self._sum_credit
})
def preprocess(self, objects, datas, ids):
super(journal_print, self).preprocess(objects, datas, ids)
def set_context(self, objects, data, ids, report_type = None):
super(journal_print, self).set_context(objects, data, ids, report_type)
self.cr.execute('select period_id, journal_id from account_journal_period where id in (' + ','.join([str(id) for id in ids]) + ')')
res = self.cr.fetchall()
self.period_ids = ','.join([str(x[0]) for x in res])

View File

@ -39,7 +39,7 @@ class general_ledger(rml_parse.rml_parse):
def preprocess(self, objects, data, ids):
def set_context(self, objects, data, ids, report_type = None):
##
@ -55,7 +55,7 @@ class general_ledger(rml_parse.rml_parse):
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
super(general_ledger, self).preprocess(objects, data, new_ids)
super(general_ledger, self).set_context(objects, data, ids, report_type)
def __init__(self, cr, uid, name, context):
super(general_ledger, self).__init__(cr, uid, name, context)

View File

@ -147,7 +147,7 @@ class partner_balance(report_sxw.rml_parse):
else:
return self.comma_me(new)
def preprocess(self, objects, data, ids):
def set_context(self, objects, data, ids, report_type = None):
# Transformation des date
#
#
@ -168,7 +168,7 @@ class partner_balance(report_sxw.rml_parse):
self.date_lst_string =''
if self.date_lst:
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
## Compute Code
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
@ -189,7 +189,7 @@ class partner_balance(report_sxw.rml_parse):
"AND a.active", (data['form']['company_id'],))
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
super(partner_balance, self).preprocess(objects, data, ids)
super(partner_balance, self).set_context(objects, data, ids, report_type)
def lines(self,data):

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -138,7 +138,7 @@ class third_party_ledger(rml_parse.rml_parse):
string_map = date_string + ','
return string_map
def preprocess(self, objects, data, ids):
def set_context(self, objects, data, ids, report_type = None):
PARTNER_REQUEST = ''
if (data['model'] == 'res.partner'):
## Si on imprime depuis les partenaires
@ -160,7 +160,7 @@ class third_party_ledger(rml_parse.rml_parse):
self.transform_period_into_date_array(data)
elif data['form']['state'] == 'all':
self.transform_both_into_date_array(data)
self.date_lst_string = ''
if self.date_lst:
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
@ -182,12 +182,12 @@ class third_party_ledger(rml_parse.rml_parse):
'AND a.type IN ' + self.ACCOUNT_TYPE + " " \
"AND a.active", (data['form']['company_id'],))
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
partner_to_use = []
if self.date_lst and data['form']['soldeinit'] :
self.cr.execute(
"SELECT DISTINCT line.partner_id " \
"FROM account_move_line AS line, account_account AS account " \
@ -202,7 +202,7 @@ class third_party_ledger(rml_parse.rml_parse):
"AND account.active " ,
(self.date_lst[0],self.date_lst[len(self.date_lst)-1],data['form']['company_id']))
# else:
#
#
# self.cr.execute(
# "SELECT DISTINCT line.partner_id " \
# "FROM account_move_line AS line, account_account AS account " \
@ -214,16 +214,16 @@ class third_party_ledger(rml_parse.rml_parse):
# "AND account.company_id = %s " \
# "AND account.active " ,
# (data['form']['company_id']))
res = self.cr.dictfetchall()
for res_line in res:
partner_to_use.append(res_line['partner_id'])
new_ids = partner_to_use
self.partner_ids = ','.join(map(str, new_ids))
objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids)
super(third_party_ledger, self).preprocess(objects, data, new_ids)
super(third_party_ledger, self).set_context(objects, data, new_ids, report_type)
def lines(self, partner,data):
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
@ -232,9 +232,9 @@ class third_party_ledger(rml_parse.rml_parse):
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
# if data['form']['soldeinit'] :
#
#
# self.cr.execute(
# "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
# "FROM account_move_line l " \
@ -271,8 +271,8 @@ class third_party_ledger(rml_parse.rml_parse):
sum = r['debit'] - r['credit']
r['progress'] = sum
full_account.append(r)
return full_account
return full_account
def _sum_debit_partner(self, partner,data):
@ -306,7 +306,7 @@ class third_party_ledger(rml_parse.rml_parse):
" " + RECONCILE_TAG + " " \
"AND date IN (" + self.date_lst_string + ") " ,
(partner.id,))
contemp = self.cr.fetchone()
if contemp != None:
result_tmp = contemp[0] or 0.0
@ -336,7 +336,7 @@ class third_party_ledger(rml_parse.rml_parse):
else:
result_tmp = result_tmp + 0.0
if self.date_lst_string:
if self.date_lst_string:
self.cr.execute(
"SELECT sum(credit) " \
"FROM account_move_line " \
@ -345,7 +345,7 @@ class third_party_ledger(rml_parse.rml_parse):
" " + RECONCILE_TAG + " " \
"AND date IN (" + self.date_lst_string + ") " ,
(partner.id,))
contemp = self.cr.fetchone()
if contemp != None:
result_tmp = contemp[0] or 0.0
@ -386,7 +386,7 @@ class third_party_ledger(rml_parse.rml_parse):
" " + RECONCILE_TAG + " " \
"AND date IN (" + self.date_lst_string + ") "
)
contemp = self.cr.fetchone()
if contemp != None:
result_tmp = contemp[0] or 0.0
@ -419,7 +419,7 @@ class third_party_ledger(rml_parse.rml_parse):
result_tmp = contemp[0] or 0.0
else:
result_tmp = result_tmp + 0.0
if self.date_lst_string:
self.cr.execute(
"SELECT sum(credit) " \

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -28,7 +28,7 @@ from tools.translate import _
period_form = '''<?xml version="1.0"?>
<form string="Select Date-Period">
<field name="company_id"/>
<field name="result_selection"/>
<newline/>
@ -53,7 +53,7 @@ period_form = '''<?xml version="1.0"?>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
</form>'''
period_fields = {
@ -85,7 +85,7 @@ period_fields = {
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
@ -104,9 +104,9 @@ class wizard_report(wizard.interface):
data['form']['reconcil'] = False
data['form']['soldeinit'] = True
return data['form']
def _check_date(self, cr, uid, data, context):
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date1'])
cr.execute(sql)
@ -116,17 +116,18 @@ class wizard_report(wizard.interface):
raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']) , str(res[0]['date_stop'])))
else:
return 'report'
else:
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all':
data['form']['fiscalyear'] = False
else :
data['form']['fiscalyear'] = True
self._check_date(cr, uid, data, context)
acc_id = pooler.get_pool(cr.dbname).get('account.invoice').search(cr, uid, [('state','=','open')])
if not acc_id:
raise wizard.except_wizard(_('No Data Available'), _('No records found for your selection!'))
return data['form']

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -37,8 +37,29 @@ import wizard
import photo_shadow
from tools import config
def escape(s):
return str(s or '').replace('<br/>','').decode('latin1','replace').encode('utf-8')
def _to_unicode(s):
try:
return s.decode('utf-8')
except UnicodeError:
try:
return s.decode('latin')
except UnicodeError:
try:
return s.encode('ascii')
except UnicodeError:
return s
def _to_decode(s):
try:
return s.encode('utf-8')
except UnicodeError:
try:
return s.encode('latin')
except UnicodeError:
try:
return s.decode('ascii')
except UnicodeError:
return s
class auction_catalog(report_rml):
@ -71,22 +92,22 @@ class auction_catalog(report_rml):
# name emelment
key = 'name'
categ = doc.createElement(key)
categ.appendChild(doc.createTextNode(escape(res[0]["name"])))
categ.appendChild(doc.createTextNode(_to_decode(res[0]["name"])))
catalog.appendChild(categ)
#Auctuion Date element
categ = doc.createElement("AuctionDate1")
categ.appendChild(doc.createTextNode(escape(res[0]['auction1'])))
categ.appendChild(doc.createTextNode(_to_decode(res[0]['auction1'])))
catalog.appendChild(categ)
# Action Date 2 element
categ = doc.createElement("AuctionDate2")
categ.appendChild(doc.createTextNode(escape(res[0]['auction2'])))
categ.appendChild(doc.createTextNode(_to_decode(res[0]['auction2'])))
catalog.appendChild(categ)
# promotion element
promo = doc.createElement('promotion1')
fp = file(config['addons_path']+'/auction/report/images/flagey_logo.jpg','r')
file_data = fp.read()
promo.appendChild(doc.createTextNode(base64.encodestring(file_data)))
@ -113,15 +134,15 @@ class auction_catalog(report_rml):
products.appendChild(product)
if cat['obj_desc']:
infos = doc.createElement('infos')
lines = re.split('<br/>|\n', unicode(cat['obj_desc'],'utf-8').encode('latin1'))
lines = re.split('<br/>|\n', _to_unicode(cat['obj_desc']))
for line in lines:
xline = doc.createElement('info')
xline.appendChild(doc.createTextNode(escape(line.decode('latin-1','replace').encode('utf-8'))))
xline.appendChild(doc.createTextNode(_to_decode(line)))
infos.appendChild(xline)
product.appendChild(infos)
if cat['lot_num']:
lnum = doc.createElement('lot_num')
lnum.appendChild(doc.createTextNode(escape(cat['lot_num'])))
lnum.appendChild(doc.createTextNode(_to_decode(str(cat['lot_num']))))
infos.appendChild(lnum)
if cat['image']:
@ -146,7 +167,7 @@ class auction_catalog(report_rml):
for key in ('lot_est1','lot_est2'):
ref2 = doc.createElement(key)
ref2.appendChild(doc.createTextNode( escape(cat[key] or 0.0)))
ref2.appendChild(doc.createTextNode( _to_decode(str(cat[key] or 0.0))))
product.appendChild(ref2)
oldlength = length
length += 2.0

View File

@ -11,8 +11,8 @@
<!-- <stroke color="(0.6,0.3,0.1)"/>-->
<!-- <fill color="(0.6,0.3,0.1)"/>-->
<image x="7cm" y="25cm" file="/home/tiny/terp/4.2/server/bin/addons/auction/report/images/aeko_logo.jpg"/>
<image x="7cm" y="25cm" file="/home/pinky/code/terp/branches/extra_addons/trunk/auction/report/images/flagey_logo.jpg"/>
<image x="7cm" y="25cm" file="addons/auction/report/images/aeko_logo.jpg"/>
<image x="7cm" y="25cm" file="addons/auction/report/images/flagey_logo.jpg"/>
<lines>1cm 3.0cm 20cm 3.0cm</lines>
<setFont name="Helvetica" size="15"/>
<drawCentredString x="105mm" y="2.2cm">Hotel des ventes Flagey</drawCentredString>
@ -30,7 +30,7 @@
<pageTemplate id="first">
<pageGraphics>
<!-- <image x="1.0cm" y="27.3cm" file="/home/tiny/terp/4.2/server/bin/addons/auction/report/images/flagey_head.png"/>-->
- <image x="1.0cm" y="27.3cm" file="/home/pinky/code/terp/branches/extra_addons/trunk/auction/report/images/flagey_logo.jpg"/>
- <image x="1.0cm" y="27.3cm" file="addons/auction/report/images/flagey_logo.jpg"/>
<drawRightString x="19.0cm" y="27.6cm"> Vente antiquitée le <xsl:value-of select="date:day-name(catalog/AuctionDate1)"/> &#160;<xsl:value-of select="date:day-in-month(catalog/AuctionDate1)"/>&#160;<xsl:value-of select="date:month-name(catalog/AuctionDate1)"/> &#160;<xsl:value-of select="date:year(catalog/AuctionDate1)"/></drawRightString>-->
<lineMode width="1mm"/>
<setFont name="Helvetica" size="26"/>

View File

@ -46,7 +46,8 @@ class res_partner_contact(osv.osv):
'birthdate':fields.date('Birth Date'),
'active' : fields.boolean('Active'),
'partner_id':fields.related('job_ids','address_id','partner_id',type='many2one', relation='res.partner', string='Main Employer'),
'function_id':fields.related('job_ids','function_id',type='many2one', relation='res.partner.function', string='Main Job'),
'function_id':fields.related('job_ids','function_id',type='many2one', relation='res.partner.function', string='Main Function'),
'job_id':fields.related('job_ids',type='many2one', relation='res.partner.job', string='Main Job'),
'email': fields.char('E-Mail', size=240),
}
_defaults = {
@ -87,6 +88,7 @@ class res_partner_address(osv.osv):
_inherit='res.partner.address'
_description ='Partner Address'
_columns = {
'job_id':fields.related('job_ids','contact_id','job_id',type='many2one', relation='res.partner.job', string='Main Job'),
'job_ids':fields.one2many('res.partner.job', 'address_id', 'Contacts'),
}
res_partner_address()
@ -98,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,

View File

@ -40,6 +40,7 @@
<field name="active"/>
<field name="partner_id" invisible="1" select="2"/>
<field name="function_id" invisible="1" select="2"/>
<field name="job_id" invisible="1" select="2" />
<field name="job_ids" colspan="4" nolabel="1" mode="tree,form">
<form string="Functions and Addresses">
<field name="function_id"/>
@ -153,42 +154,42 @@
</record>
<!-- don't display the categories, since it is displayed in an other tab-->
<record model="ir.ui.view" id="view_partner_form_inherit2">
<field name="name">res.partner.form</field>
<field name="type">form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="category_id" position="replace">
</field>
</field>
</record>
<record model="ir.ui.view" id="view_partner_form_inherit2">
<field name="name">res.partner.form</field>
<field name="type">form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="category_id" position="replace">
</field>
</field>
</record>
<!-- don't display the categories label-->
<record model="ir.ui.view" id="view_partner_form_inherit2bis">
<field name="name">res.partner.form</field>
<field name="type">form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<separator colspan="4" string="Categories" position="replace"/>
</field>
</record>
<record model="ir.ui.view" id="view_partner_form_inherit2bis">
<field name="name">res.partner.form</field>
<field name="type">form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<separator colspan="4" string="Categories" position="replace"/>
</field>
</record>
<record model="ir.ui.view" id="view_partner_form_inherit3">
<field name="name">res.partner.form</field>
<field name="type">form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Categories">
<separator colspan="4" string="Categories"/>
<field colspan="4" name="category_id" nolabel="1" select="2"/>
</page>
</notebook>
</field>
</record>
<record model="ir.ui.view" id="view_partner_form_inherit3">
<field name="name">res.partner.form</field>
<field name="type">form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Categories">
<separator colspan="4" string="Categories"/>
<field colspan="4" name="category_id" nolabel="1" select="2"/>
</page>
</notebook>
</field>
</record>
<!-- Views for Addresses -->
@ -268,6 +269,7 @@
<field name="partner_id" position="replace">
<field name='partner_id' select='1'/>
<field name='type' select='2'/>
<field name='job_id' invisible="1" select="2"/>
</field>
</field>
</record>

View File

@ -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"

View File

@ -21,4 +21,5 @@
##############################################################################
import document
import document_ics_config_wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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,

View File

@ -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:

View File

@ -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>

View File

@ -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">

View File

@ -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:

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -12,7 +12,7 @@
<field domain="[('type','=','normal'),('state', '&lt;&gt;', '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"/>

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_timesheet_invoice_factor access_hr_timesheet_invoice_factor_hr_user hr_timesheet_invoice.factor hr_timesheet_invoice.factor.hr.user model_hr_timesheet_invoice_factor hr.group_hr_user 1 0 0 0
3 access_hr_timesheet_invoice_factor access_hr_timesheet_invoice_factor_acc_inv hr_timesheet_invoice.factor hr_timesheet_invoice.factor.account.invoice model_hr_timesheet_invoice_factor account.group_account_invoice 1 1 1 1

View File

@ -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 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_timesheet_sheet_sheet hr_timesheet_sheet.sheet model_hr_timesheet_sheet_sheet hr.group_hr_user 1 1 1 1
3 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
4 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

View File

@ -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,

View File

@ -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

View File

@ -19,6 +19,7 @@
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
@ -32,23 +33,70 @@
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="7,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="8,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="8,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="8,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="9,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="9,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,0" stop="9,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="10,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="10,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="10,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="11,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="11,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="11,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="12,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="12,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="12,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="13,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="13,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="13,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="14,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="14,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,0" stop="14,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
<blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P1" fontName="Times-Roman" fontSize="9.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P4" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P5" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P6" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P5" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P6" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P7" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P8" fontName="Times-Roman" fontSize="8.0" leading="10"/>
<paraStyle name="P9" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
@ -59,14 +107,15 @@
<paraStyle name="P14" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P15" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P16" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P17" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="P17" fontName="Times-Roman" textColor="blue" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Times-Bold" fontSize="10"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="cat" fontName="Times-Bold" textColor="blue" fontSize="14.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
</stylesheet>
<story>
<para style="P8">
@ -84,49 +133,49 @@
<para style="P8">
<font color="white"> </font>
</para>
<blockTable colWidths="482.0" style="Table1">
<blockTable colWidths="535" style="Table1">
<tr>
<td>
<para style="P2">Products Price List</para>
</td>
</tr>
</blockTable>
<para style="P8">
<para style="P10">
<font color="white"> </font>
</para>
<blockTable colWidths="117.0,364.0" style="Table2">
</blockTable>
<para style="P7">
<font color="white"> </font>
</para>
<blockTable colWidths="143.0,392.0" style="Table2">
<tr>
<td>
<para style="P1">Price List Name:</para>
<para style="Standard">Price List Name:</para>
</td>
<td>
<para style="P3">[[ get_pricelist(data['form']['price_list']) ]]</para>
<para style="Standard">[[ get_pricelist(data['form']['price_list']) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P1">Currency :</para>
<para style="Standard">Currency :</para>
</td>
<td>
<para style="P3">[[ get_currency ( data['form']['price_list']) ]]</para>
<para style="Standard">[[ get_currency ( data['form']['price_list']) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P1">Printing Date :</para>
<para style="Standard">Printing Date :</para>
</td>
<td>
<para style="P3">[[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]]</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="Standard">[[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]]</para>
</td>
</tr>
</blockTable>
<para style="P3">
<para style="P10">
<font color="white"> </font>
</para>
<blockTable colWidths="80.0,80.0,80.0,80.0,80.0,80.0" style="Table7">
<blockTable colWidths="130.0,81.0,81.0,81.0,81.0,81.0" style="Table5">
<tr>
<td>
<para style="P6">Description</para>
@ -148,37 +197,33 @@
</td>
</tr>
</blockTable>
<blockTable colWidths="482.0" style="Table3">
<tr>
<td>
<para style="P17">
<font face="Times-Roman">[[repeatIn(get_categories(objects,data['form']), 'c')]][[ c['name'] ]]</font>
</para>
<blockTable colWidths="79.0,79.0,79.0,79.0,79.0,79.0" style="Table5">
<tr>
<td>
<para style="P12">[[repeatIn(c['products'], 'p')]][[ p['code'] and '[' + p['code'] + '] ' or '' ]] [[ p['name'] ]]</para>
</td>
<td>
<para style="P7">[[p['qty1'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty2'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty3'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty4'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty5'] ]]</para>
</td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
<section>
<para style="cat">[[repeatIn(get_categories(objects,data['form']), 'c')]][[ c['name'] ]]</para>
<blockTable colWidths="130.0,81.0,81.0,81.0,81.0,81.0" style="Table3">
<tr>
<td>
<para style="Standard"><font>[[repeatIn(c['products'], 'p')]]</font>[[ p['code'] and '[' + p['code'] + '] ' or '' ]] [[ p['name'] ]]</para>
</td>
<td>
<para style="P7">[[p['qty1'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty2'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty3'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty4'] ]]</para>
</td>
<td>
<para style="P7">[[ p['qty5'] ]]</para>
</td>
</tr>
</blockTable>
</section>
<para style="P1">
<font color="white"> </font>
</para>

View File

@ -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"/>

View File

@ -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()

View File

@ -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"/>

View File

@ -135,7 +135,7 @@ class report_timesheet_invoice(osv.osv):
l.account_id as account_id,
a.user_id as manager_id,
sum(l.unit_amount) as quantity,
sum(l.unit_amount * t.list_price) as revenue
sum(l.unit_amount * t.list_price) as amount_invoice
from account_analytic_line l
left join hr_timesheet_invoice_factor f on (l.to_invoice=f.id)
left join account_analytic_account a on (l.account_id=a.id)

View File

@ -764,6 +764,7 @@ class sale_order_line(osv.osv):
line.procurement_id.id, context)
create_ids = []
sales = {}
for line in self.browse(cr, uid, ids, context):
if not line.invoiced:
if line.product_id:
@ -802,7 +803,14 @@ class sale_order_line(osv.osv):
})
cr.execute('insert into sale_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id))
self.write(cr, uid, [line.id], {'invoiced':True})
sales[line.order_id.id] = True
create_ids.append(inv_id)
# Trigger workflow events
wf_service = netsvc.LocalService("workflow")
for sid in sales.keys():
wf_service.trg_write(uid, 'sale.order', sid, cr)
return create_ids
def button_cancel(self, cr, uid, ids, context={}):

View File

@ -115,6 +115,7 @@
<tr>
<td>
<para style="terp_default_Bold_9">Invoiced to</para>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.partner_id.name or '']]</para>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.name or '']]</para>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.street or '']]</para>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.zip or '']]</para>
@ -122,6 +123,7 @@
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.country_id and o.sale_id.partner_invoice_id.country_id.name or '']]</para>
</td>
<td>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.partner_id.name or '']]</para>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.name or '']]</para>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.street or '']]</para>
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.zip or '']]</para>

View File

@ -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'),

View File

@ -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"/>