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): unit=False, context=None):
uom_obj = self.pool.get('product.uom') uom_obj = self.pool.get('product.uom')
product_obj = self.pool.get('product.product') 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) prod = product_obj.browse(cr, uid, prod_id)
a = prod.product_tmpl_id.property_account_expense.id a = prod.product_tmpl_id.property_account_expense.id
if not a: if not a:

View File

@ -141,7 +141,7 @@
<field domain="[('type', '=', 'purchase')]" name="journal_id" select="2"/> <field domain="[('type', '=', 'purchase')]" name="journal_id" select="2"/>
<field name="type" readonly="1" select="2"/> <field name="type" readonly="1" select="2"/>
<field name="currency_id" on_change="onchange_currency_id(currency_id)" 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="[('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"/> <field domain="[('type','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
</group> </group>

View File

@ -40,8 +40,8 @@ class journal_print(report_sxw.rml_parse):
'sum_credit': self._sum_credit 'sum_credit': self._sum_credit
}) })
def preprocess(self, objects, datas, ids): def set_context(self, objects, data, ids, report_type = None):
super(journal_print, self).preprocess(objects, datas, ids) 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]) + ')') 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() res = self.cr.fetchall()
self.period_ids = ','.join([str(x[0]) for x in res]) 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) 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): def __init__(self, cr, uid, name, context):
super(general_ledger, self).__init__(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: else:
return self.comma_me(new) return self.comma_me(new)
def preprocess(self, objects, data, ids): def set_context(self, objects, data, ids, report_type = None):
# Transformation des date # Transformation des date
# #
# #
@ -189,7 +189,7 @@ class partner_balance(report_sxw.rml_parse):
"AND a.active", (data['form']['company_id'],)) "AND a.active", (data['form']['company_id'],))
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()]) 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): def lines(self,data):

View File

@ -138,7 +138,7 @@ class third_party_ledger(rml_parse.rml_parse):
string_map = date_string + ',' string_map = date_string + ','
return string_map return string_map
def preprocess(self, objects, data, ids): def set_context(self, objects, data, ids, report_type = None):
PARTNER_REQUEST = '' PARTNER_REQUEST = ''
if (data['model'] == 'res.partner'): if (data['model'] == 'res.partner'):
## Si on imprime depuis les partenaires ## Si on imprime depuis les partenaires
@ -223,7 +223,7 @@ class third_party_ledger(rml_parse.rml_parse):
self.partner_ids = ','.join(map(str, new_ids)) self.partner_ids = ','.join(map(str, new_ids))
objects = self.pool.get('res.partner').browse(self.cr, self.uid, 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): def lines(self, partner,data):
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')

View File

@ -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']))) 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: else:
return 'report' return 'report'
else: else:
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year')) raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
def _check_state(self, cr, uid, data, context): def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all': if data['form']['state'] == 'bydate' or data['form']['state'] == 'all':
data['form']['fiscalyear'] = False data['form']['fiscalyear'] = False
else : else :
data['form']['fiscalyear'] = True data['form']['fiscalyear'] = True
self._check_date(cr, uid, data, context) 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'] return data['form']

View File

@ -37,8 +37,29 @@ import wizard
import photo_shadow import photo_shadow
from tools import config from tools import config
def escape(s): def _to_unicode(s):
return str(s or '').replace('<br/>','').decode('latin1','replace').encode('utf-8') 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): class auction_catalog(report_rml):
@ -71,17 +92,17 @@ class auction_catalog(report_rml):
# name emelment # name emelment
key = 'name' key = 'name'
categ = doc.createElement(key) categ = doc.createElement(key)
categ.appendChild(doc.createTextNode(escape(res[0]["name"]))) categ.appendChild(doc.createTextNode(_to_decode(res[0]["name"])))
catalog.appendChild(categ) catalog.appendChild(categ)
#Auctuion Date element #Auctuion Date element
categ = doc.createElement("AuctionDate1") categ = doc.createElement("AuctionDate1")
categ.appendChild(doc.createTextNode(escape(res[0]['auction1']))) categ.appendChild(doc.createTextNode(_to_decode(res[0]['auction1'])))
catalog.appendChild(categ) catalog.appendChild(categ)
# Action Date 2 element # Action Date 2 element
categ = doc.createElement("AuctionDate2") categ = doc.createElement("AuctionDate2")
categ.appendChild(doc.createTextNode(escape(res[0]['auction2']))) categ.appendChild(doc.createTextNode(_to_decode(res[0]['auction2'])))
catalog.appendChild(categ) catalog.appendChild(categ)
# promotion element # promotion element
@ -113,15 +134,15 @@ class auction_catalog(report_rml):
products.appendChild(product) products.appendChild(product)
if cat['obj_desc']: if cat['obj_desc']:
infos = doc.createElement('infos') 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: for line in lines:
xline = doc.createElement('info') 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) infos.appendChild(xline)
product.appendChild(infos) product.appendChild(infos)
if cat['lot_num']: if cat['lot_num']:
lnum = doc.createElement('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) infos.appendChild(lnum)
if cat['image']: if cat['image']:
@ -146,7 +167,7 @@ class auction_catalog(report_rml):
for key in ('lot_est1','lot_est2'): for key in ('lot_est1','lot_est2'):
ref2 = doc.createElement(key) 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) product.appendChild(ref2)
oldlength = length oldlength = length
length += 2.0 length += 2.0

View File

@ -11,8 +11,8 @@
<!-- <stroke color="(0.6,0.3,0.1)"/>--> <!-- <stroke color="(0.6,0.3,0.1)"/>-->
<!-- <fill 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="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/flagey_logo.jpg"/>
<lines>1cm 3.0cm 20cm 3.0cm</lines> <lines>1cm 3.0cm 20cm 3.0cm</lines>
<setFont name="Helvetica" size="15"/> <setFont name="Helvetica" size="15"/>
<drawCentredString x="105mm" y="2.2cm">Hotel des ventes Flagey</drawCentredString> <drawCentredString x="105mm" y="2.2cm">Hotel des ventes Flagey</drawCentredString>
@ -30,7 +30,7 @@
<pageTemplate id="first"> <pageTemplate id="first">
<pageGraphics> <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/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>--> <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"/> <lineMode width="1mm"/>
<setFont name="Helvetica" size="26"/> <setFont name="Helvetica" size="26"/>

View File

@ -46,7 +46,8 @@ class res_partner_contact(osv.osv):
'birthdate':fields.date('Birth Date'), 'birthdate':fields.date('Birth Date'),
'active' : fields.boolean('Active'), 'active' : fields.boolean('Active'),
'partner_id':fields.related('job_ids','address_id','partner_id',type='many2one', relation='res.partner', string='Main Employer'), '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), 'email': fields.char('E-Mail', size=240),
} }
_defaults = { _defaults = {
@ -87,6 +88,7 @@ class res_partner_address(osv.osv):
_inherit='res.partner.address' _inherit='res.partner.address'
_description ='Partner Address' _description ='Partner Address'
_columns = { _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'), 'job_ids':fields.one2many('res.partner.job', 'address_id', 'Contacts'),
} }
res_partner_address() res_partner_address()
@ -98,7 +100,8 @@ class res_partner_job(osv.osv):
return [] return []
res = [] res = []
for r in self.browse(cr, uid, ids): 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 return res
def search(self, cr, user, args, offset=0, limit=None, order=None, def search(self, cr, user, args, offset=0, limit=None, order=None,

View File

@ -40,6 +40,7 @@
<field name="active"/> <field name="active"/>
<field name="partner_id" invisible="1" select="2"/> <field name="partner_id" invisible="1" select="2"/>
<field name="function_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"> <field name="job_ids" colspan="4" nolabel="1" mode="tree,form">
<form string="Functions and Addresses"> <form string="Functions and Addresses">
<field name="function_id"/> <field name="function_id"/>
@ -268,6 +269,7 @@
<field name="partner_id" position="replace"> <field name="partner_id" position="replace">
<field name='partner_id' select='1'/> <field name='partner_id' select='1'/>
<field name='type' select='2'/> <field name='type' select='2'/>
<field name='job_id' invisible="1" select="2"/>
</field> </field>
</field> </field>
</record> </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) # return super(ir_model_fields, self).search(cr, uid, args, offset, limit, order, context)
#ir_model_fields() #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): class report_creator(osv.osv):
_name = "base_report_creator.report" _name = "base_report_creator.report"

View File

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

View File

@ -30,7 +30,7 @@
'website': 'http://www.openerp.com', 'website': 'http://www.openerp.com',
'depends': ['document', 'crm_configuration'], 'depends': ['document', 'crm_configuration'],
'init_xml': ['document_data.xml'], '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'], 'demo_xml': ['document_demo.xml'],
'installable': True, 'installable': True,
'active': False, 'active': False,

View File

@ -28,6 +28,7 @@ import base64
import datetime import datetime
import time import time
import random import random
import tools
ICS_TAGS = { ICS_TAGS = {
'summary':'normal', 'summary':'normal',
@ -35,7 +36,7 @@ ICS_TAGS = {
'dtstart':'date' , 'dtstart':'date' ,
'dtend':'date' , 'dtend':'date' ,
'created':'date' , 'created':'date' ,
'dt-stamp':'date' , 'dtstamp':'date' ,
'last-modified':'normal' , 'last-modified':'normal' ,
'url':'normal' , 'url':'normal' ,
'attendee':'multiple', 'attendee':'multiple',
@ -50,7 +51,7 @@ class document_directory_ics_fields(osv.osv):
_name = 'document.directory.ics.fields' _name = 'document.directory.ics.fields'
_columns = { _columns = {
'field_id': fields.many2one('ir.model.fields', 'Open ERP Field', required=True), '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') 'content_id': fields.many2one('document.directory.content', 'Content', required=True, ondelete='cascade')
} }
document_directory_ics_fields() document_directory_ics_fields()
@ -105,6 +106,12 @@ class document_directory_content(osv.osv):
return True return True
def process_read_ics(self, cr, uid, node, context={}): 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 import vobject
obj_class = self.pool.get(node.content.ics_object_id.model) obj_class = self.pool.get(node.content.ics_object_id.model)
# Can be improved to use context and active_id ! # Can be improved to use context and active_id !
@ -113,21 +120,31 @@ class document_directory_content(osv.osv):
cal = vobject.iCalendar() cal = vobject.iCalendar()
for obj in obj_class.browse(cr, uid, ids, context): for obj in obj_class.browse(cr, uid, ids, context):
event = cal.add('vevent') 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: for field in node.content.ics_field_ids:
value = getattr(obj, field.field_id.name) value = getattr(obj, field.field_id.name)
if (not value) and field.name=='uid': 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}) obj_class.write(cr, uid, [obj.id], {field.field_id.name: value})
if ICS_TAGS[field.name]=='normal': if ICS_TAGS[field.name]=='normal':
if type(value)==type(obj): if type(value)==type(obj):
value=value.name value=value.name
value = value or '' value = value or ''
event.add(field.name).value = value or '' event.add(field.name).value = value or ''
elif ICS_TAGS[field.name]=='date': elif ICS_TAGS[field.name]=='date' and value:
dt = value or time.strftime('%Y-%m-%d %H:%M:%S') if field.name == 'dtstart':
if len(dt)==10: date_start = start_date = datetime.datetime.fromtimestamp(time.mktime(time.strptime(value , "%Y-%m-%d %H:%M:%S")))
dt = dt+' 09:00:00' if field.name == 'dtend' and isinstance(value, float):
value = datetime.datetime.strptime(dt, '%Y-%m-%d %H:%M:%S') 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 event.add(field.name).value = value
s= StringIO.StringIO(cal.serialize().encode('utf8')) s= StringIO.StringIO(cal.serialize().encode('utf8'))
s.name = node s.name = node
@ -138,8 +155,36 @@ document_directory_content()
class crm_case(osv.osv): class crm_case(osv.osv):
_inherit = 'crm.case' _inherit = 'crm.case'
_columns = { _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() crm_case()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -6,6 +6,20 @@
<field name="code">.ics</field> <field name="code">.ics</field>
<field name="name">ICS Calendar</field> <field name="name">ICS Calendar</field>
</record> </record>
</data> </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> </openerp>

View File

@ -26,6 +26,11 @@
<field name="field_id" ref="crm.field_crm_case_date"/> <field name="field_id" ref="crm.field_crm_case_date"/>
<field name="content_id" ref="dir_content_calendar"/> <field name="content_id" ref="dir_content_calendar"/>
</record> </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"> <record model="document.directory.ics.fields" id="dir_field2">
<field name="name">summary</field> <field name="name">summary</field>
<field name="field_id" ref="crm.field_crm_case_name"/> <field name="field_id" ref="crm.field_crm_case_name"/>
@ -38,7 +43,7 @@
</record> </record>
<record model="document.directory.ics.fields" id="dir_field4"> <record model="document.directory.ics.fields" id="dir_field4">
<field name="name">description</field> <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"/> <field name="content_id" ref="dir_content_calendar"/>
</record> </record>
<record model="document.directory.ics.fields" id="dir_field5"> <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

@ -21,5 +21,30 @@
</field> </field>
</record> </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> </data>
</openerp> </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={}): def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}):
res = {} 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) res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount,unit, context)
return res return res

View File

@ -12,7 +12,7 @@
<field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" name="account_id"/> <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" name="account_id"/>
<field name="name"/> <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="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="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
<field name="amount" sum="Total cost"/> <field name="amount" sum="Total cost"/>
<field name="general_account_id"/> <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" "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_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","hr_timesheet_invoice.factor","model_hr_timesheet_invoice_factor","account.group_account_invoice",1,1,1,1 "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

@ -2,4 +2,3 @@
"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","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_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_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
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)), 'cycle': fields.float('Nbr of cycle', digits=(16,2)),
'hour': fields.float('Nbr of hour', digits=(16,2)), 'hour': fields.float('Nbr of hour', digits=(16,2)),
'sequence': fields.integer('Sequence', required=True), '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 = { _defaults = {
'sequence': lambda *a: 1, '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 ) payment_id = self.pool.get('pos.payment').create(cr, uid, args )
wf_service = netsvc.LocalService("workflow") 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) wf_service.trg_write(uid, 'pos.order', order_id, cr)
return payment_id return payment_id

View File

@ -19,6 +19,7 @@
<blockTableStyle id="Table2"> <blockTableStyle id="Table2">
<blockAlignment value="LEFT"/> <blockAlignment value="LEFT"/>
<blockValign value="TOP"/> <blockValign value="TOP"/>
</blockTableStyle> </blockTableStyle>
<blockTableStyle id="Table7"> <blockTableStyle id="Table7">
<blockAlignment value="LEFT"/> <blockAlignment value="LEFT"/>
@ -32,23 +33,70 @@
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/> <blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
</blockTableStyle> </blockTableStyle>
<blockTableStyle id="Table3"> <blockTableStyle id="Table3">
<blockAlignment value="LEFT"/> <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<blockValign value="TOP"/> <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>
<blockTableStyle id="Table5"> <blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/> <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> </blockTableStyle>
<initialize> <initialize>
<paraStyle name="all" alignment="justify"/> <paraStyle name="all" alignment="justify"/>
</initialize> </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="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="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="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="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="LEFT" 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="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="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"/> <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="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="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="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="P17" fontName="Times-Roman" textColor="blue" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/> <paraStyle name="Standard" fontName="Times-Bold" fontSize="10"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> <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="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 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="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="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/> <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> </stylesheet>
<story> <story>
<para style="P8"> <para style="P8">
@ -84,49 +133,49 @@
<para style="P8"> <para style="P8">
<font color="white"> </font> <font color="white"> </font>
</para> </para>
<blockTable colWidths="482.0" style="Table1"> <blockTable colWidths="535" style="Table1">
<tr> <tr>
<td> <td>
<para style="P2">Products Price List</para> <para style="P2">Products Price List</para>
</td> </td>
</tr> </tr>
<para style="P10">
<font color="white"> </font>
</para>
</blockTable> </blockTable>
<para style="P8"> <para style="P7">
<font color="white"> </font> <font color="white"> </font>
</para> </para>
<blockTable colWidths="117.0,364.0" style="Table2"> <blockTable colWidths="143.0,392.0" style="Table2">
<tr> <tr>
<td> <td>
<para style="P1">Price List Name:</para> <para style="Standard">Price List Name:</para>
</td> </td>
<td> <td>
<para style="P3">[[ get_pricelist(data['form']['price_list']) ]]</para> <para style="Standard">[[ get_pricelist(data['form']['price_list']) ]]</para>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<para style="P1">Currency :</para> <para style="Standard">Currency :</para>
</td> </td>
<td> <td>
<para style="P3">[[ get_currency ( data['form']['price_list']) ]]</para> <para style="Standard">[[ get_currency ( data['form']['price_list']) ]]</para>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<para style="P1">Printing Date :</para> <para style="Standard">Printing Date :</para>
</td> </td>
<td> <td>
<para style="P3">[[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]]</para> <para style="Standard">[[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]]</para>
<para style="P4">
<font color="white"> </font>
</para>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
<para style="P3"> <para style="P10">
<font color="white"> </font> <font color="white"> </font>
</para> </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> <tr>
<td> <td>
<para style="P6">Description</para> <para style="P6">Description</para>
@ -148,16 +197,13 @@
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
<blockTable colWidths="482.0" style="Table3"> <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> <tr>
<td> <td>
<para style="P17"> <para style="Standard"><font>[[repeatIn(c['products'], 'p')]]</font>[[ p['code'] and '[' + p['code'] + '] ' or '' ]] [[ p['name'] ]]</para>
<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>
<td> <td>
<para style="P7">[[p['qty1'] ]]</para> <para style="P7">[[p['qty1'] ]]</para>
@ -176,9 +222,8 @@
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
</td> </section>
</tr>
</blockTable>
<para style="P1"> <para style="P1">
<font color="white"> </font> <font color="white"> </font>
</para> </para>

View File

@ -262,7 +262,7 @@
<group colspan="6" col="6"> <group colspan="6" col="6">
<field name="name" select="1" attrs="{'readonly':[('state','=','done')]}" /> <field name="name" select="1" attrs="{'readonly':[('state','=','done')]}" />
<field name="project_id" required="1" 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="user_id" select="1" attrs="{'readonly':[('state','=','done')]}" />
<field name="date_deadline" select="2" attrs="{'readonly':[('state','=','done')]}" /> <field name="date_deadline" select="2" attrs="{'readonly':[('state','=','done')]}" />
<field name="progress" widget="progressbar"/> <field name="progress" widget="progressbar"/>

View File

@ -55,7 +55,9 @@ class report_intrastat(osv.osv):
_description = "Intrastat report" _description = "Intrastat report"
_auto = False _auto = False
_columns = { _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), 'code': fields.char('Country code', size="2", readonly=True),
'intrastat_id': fields.many2one('report.intrastat.code', 'Intrastat code', readonly=True), 'intrastat_id': fields.many2one('report.intrastat.code', 'Intrastat code', readonly=True),
'weight': fields.float('Weight', readonly=True), 'weight': fields.float('Weight', readonly=True),
@ -67,55 +69,62 @@ class report_intrastat(osv.osv):
cr.execute(""" cr.execute("""
create or replace view report_intrastat as ( create or replace view report_intrastat as (
select select
to_char(m.create_date, 'YYYY-MM-01') as name, inv.period_id as name,
min(m.id) as id, min(inv_line.id) as id,
pt.intrastat_id as intrastat_id, intrastat.id as intrastat_id,
case when l.usage in ('supplier', 'customer') then upper(pc.code) else upper(c.code) end as code, upper(inv_country.code) as code,
sum(case when pol.price_unit is not null sum(case when inv_line.price_unit is not null
then pol.price_unit * m.product_qty then inv_line.price_unit * inv_line.quantity
else
case when sol.price_unit is not null
then sol.price_unit * m.product_qty
else 0 else 0
end
end) as value, end) as value,
sum(pt.weight_net * m.product_qty) as weight, sum(
case when l.usage in ('supplier', 'customer') then 'import' else 'export' end as type, case when uom.category_id != puom.category_id then pt.weight_net * inv_line.quantity
case when ppl.currency_id is not null else
then ppl.currency_id case when uom.factor_inv_data > 0
else spl.currency_id then
end as currency_id 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 from
stock_move m 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_template pt
left join product_product pp on (pp.product_tmpl_id = pt.id)) left join product_product pp on (pp.product_tmpl_id = pt.id))
on (m.product_id = pt.id) on (inv_line.product_id = pt.id)
left join (res_partner_address a left join product_uom uom on uom.id=inv_line.uos_id
left join res_country c on (c.id = a.country_id)) left join product_uom puom on puom.id = pt.uom_id
on (a.id = m.address_id) left join report_intrastat_code intrastat on pt.intrastat_id = intrastat.id
left join (stock_picking sp left join (res_partner_address inv_address
left join (res_partner_address pa left join res_country inv_country on (inv_country.id = inv_address.country_id))
left join res_country pc on (pc.id = pa.country_id)) on (inv_address.id = inv.address_invoice_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 where
m.state != 'draft' inv.state in ('open','paid')
and ((l.usage in ('supplier', 'customer') and dl.usage not in ('supplier', 'customer')) and inv_line.product_id is not null
or (dl.usage in ('supplier', 'customer') and l.usage not in ('supplier', 'customer'))) and inv_country.intrastat=true
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 group by inv.period_id,intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id
)""") )""")
report_intrastat() report_intrastat()

View File

@ -78,9 +78,11 @@
<tree string="Intrastat Data"> <tree string="Intrastat Data">
<field name="name"/> <field name="name"/>
<field name="code"/> <field name="code"/>
<field name="ref"/>
<field name="intrastat_id"/> <field name="intrastat_id"/>
<field name="weight"/> <field name="weight"/>
<field name="value"/> <field name="value"/>
<field name="supply_units"/>
<field name="currency_id"/> <field name="currency_id"/>
<field name="type"/> <field name="type"/>
</tree> </tree>
@ -93,7 +95,7 @@
<field name="res_model">report.intrastat</field> <field name="res_model">report.intrastat</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree</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> </record>
<menuitem id="next_id_89" name="This Month" parent="stock.next_id_61"/> <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, l.account_id as account_id,
a.user_id as manager_id, a.user_id as manager_id,
sum(l.unit_amount) as quantity, 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 from account_analytic_line l
left join hr_timesheet_invoice_factor f on (l.to_invoice=f.id) 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) 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) line.procurement_id.id, context)
create_ids = [] create_ids = []
sales = {}
for line in self.browse(cr, uid, ids, context): for line in self.browse(cr, uid, ids, context):
if not line.invoiced: if not line.invoiced:
if line.product_id: 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)) 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}) self.write(cr, uid, [line.id], {'invoiced':True})
sales[line.order_id.id] = True
create_ids.append(inv_id) 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 return create_ids
def button_cancel(self, cr, uid, ids, context={}): def button_cancel(self, cr, uid, ids, context={}):

View File

@ -115,6 +115,7 @@
<tr> <tr>
<td> <td>
<para style="terp_default_Bold_9">Invoiced to</para> <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.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.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> <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> <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>
<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.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.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> <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'), 'date_done':fields.datetime('Date Done'),
'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date", '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), 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'), 'auto_picking': fields.boolean('Auto-Packing'),
'address_id': fields.many2one('res.partner.address', 'Partner'), 'address_id': fields.many2one('res.partner.address', 'Partner'),

View File

@ -653,7 +653,7 @@
</field> </field>
<group col="7" colspan="4"> <group col="7" colspan="4">
<label colspan="6"/> <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>
<group col="10" colspan="4"> <group col="10" colspan="4">
<field name="state" readonly="1"/> <field name="state" readonly="1"/>