[IMG] base_calendar, note_pad
bzr revid: chm@openerp.com-20120919143553-lmlvshitpkkftyln
This commit is contained in:
parent
7543985b1b
commit
245002e48d
|
@ -20,7 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Calendar Layer',
|
'name': 'Calendar',
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
'depends': ['base', 'base_status', 'mail', 'base_action_rule'],
|
'depends': ['base', 'base_status', 'mail', 'base_action_rule'],
|
||||||
'description': """
|
'description': """
|
||||||
|
@ -51,6 +51,7 @@ If you need to manage your meetings, you should install the CRM module.
|
||||||
],
|
],
|
||||||
'test' : ['test/base_calendar_test.yml'],
|
'test' : ['test/base_calendar_test.yml'],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
'application': True,
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
'certificate': '00694071962960352821',
|
'certificate': '00694071962960352821',
|
||||||
'images': ['images/base_calendar1.jpeg','images/base_calendar2.jpeg','images/base_calendar3.jpeg','images/base_calendar4.jpeg',],
|
'images': ['images/base_calendar1.jpeg','images/base_calendar2.jpeg','images/base_calendar3.jpeg','images/base_calendar4.jpeg',],
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
|
@ -20,15 +20,16 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Contacts',
|
'name': 'Address Book',
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
'category': 'Tools',
|
'category': 'Tools',
|
||||||
'description': """
|
'description': """
|
||||||
This module gives you a quick view of your address book, accessible from your home page.
|
This module gives you a quick view of your address book, accessible from your home page.
|
||||||
|
You can track your suppliers, customers and other contacts.
|
||||||
""",
|
""",
|
||||||
'author': 'OpenERP SA',
|
'author': 'OpenERP SA',
|
||||||
'website': 'http://openerp.com',
|
'website': 'http://openerp.com',
|
||||||
'summary': 'Contacts, Address book',
|
'summary': 'Contacts, People and Companies',
|
||||||
'depends': [
|
'depends': [
|
||||||
'mail',
|
'mail',
|
||||||
],
|
],
|
||||||
|
|
|
@ -59,19 +59,12 @@ class note_note(osv.osv):
|
||||||
rec_id = self.create(cr, uid, {'memo': name}, context=context)
|
rec_id = self.create(cr, uid, {'memo': name}, context=context)
|
||||||
return self.name_get(cr, uid, [rec_id], context)[0]
|
return self.name_get(cr, uid, [rec_id], context)[0]
|
||||||
|
|
||||||
def _from_xml(self, mappings):
|
|
||||||
return chr(int( mappings.group(1) ))
|
|
||||||
|
|
||||||
|
|
||||||
#read the first line (convert hml into text)
|
#read the first line (convert hml into text)
|
||||||
def _get_note_first_line(self, cr, uid, ids, name="", args={}, context=None):
|
def _get_note_first_line(self, cr, uid, ids, name="", args={}, context=None):
|
||||||
res = {}
|
res = {}
|
||||||
for note in self.browse(cr, uid, ids, context=context):
|
for note in self.browse(cr, uid, ids, context=context):
|
||||||
text_note = (note.memo or '').strip().split('\n')[0]
|
res[note.id] = (note.memo and html2plaintext(note.memo) or "").strip().replace('*','').split("\n")[0]
|
||||||
text_note = re.sub(r'(\S?)(<br[ /]*>|<[/]?p>|<[/]?div>|<table>)[\s\S]*',r'\1',text_note)
|
|
||||||
text_note = re.sub(r'<[^>]+>','',text_note)
|
|
||||||
text_note = html2plaintext(text_note)
|
|
||||||
res[note.id] = text_note
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
#unactivate a sticky note and record the date
|
#unactivate a sticky note and record the date
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<record id="note_1" model="note.note">
|
<record id="note_1" model="note.note">
|
||||||
<field name="name">Customer report #349872</field>
|
<field name="name">Customer report #349872</field>
|
||||||
<field name="memo"><![CDATA[Customer report #349872
|
<field name="memo"><![CDATA[<b>Customer report #349872</b>
|
||||||
<br/><br/>* Calendar app in Home
|
<br/><br/>* Calendar app in Home
|
||||||
<br/>* The base_calendar module should create a menu in Home, like described above.
|
<br/>* The base_calendar module should create a menu in Home, like described above.
|
||||||
<br/>* This module should become a main application (in the first screen at installation)
|
<br/>* This module should become a main application (in the first screen at installation)
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_2" model="note.note">
|
<record id="note_2" model="note.note">
|
||||||
<field name="memo"><![CDATA[Call Fabien
|
<field name="memo"><![CDATA[<b>Call Fabien</b>
|
||||||
<br/><br/>* Followed by the telephone conversation and mail about D.544.3
|
<br/><br/>* Followed by the telephone conversation and mail about D.544.3
|
||||||
]]>
|
]]>
|
||||||
</field>
|
</field>
|
||||||
|
@ -48,21 +48,21 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_3" model="note.note">
|
<record id="note_3" model="note.note">
|
||||||
<field name="memo"><![CDATA[Call Marc
|
<field name="memo"><![CDATA[<b>Call Marc</b>
|
||||||
<br/><br/>]]>
|
<br/><br/>]]>
|
||||||
</field>
|
</field>
|
||||||
<field name="stage_id" ref="note_stage_01"/>
|
<field name="stage_id" ref="note_stage_01"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_4" model="note.note">
|
<record id="note_4" model="note.note">
|
||||||
<field name="memo"><![CDATA[Project N.947.5
|
<field name="memo"><![CDATA[<b>Project N.947.5</b>
|
||||||
<br/><br/>]]>
|
<br/><br/>]]>
|
||||||
</field>
|
</field>
|
||||||
<field name="stage_id" ref="note_stage_02"/>
|
<field name="stage_id" ref="note_stage_02"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_5" model="note.note">
|
<record id="note_5" model="note.note">
|
||||||
<field name="memo"><![CDATA[Shop for family dinner
|
<field name="memo"><![CDATA[<b>Shop for family dinner</b>
|
||||||
<br/>* stuffed turkey
|
<br/>* stuffed turkey
|
||||||
<br/>* wine
|
<br/>* wine
|
||||||
]]>
|
]]>
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_6" model="note.note">
|
<record id="note_6" model="note.note">
|
||||||
<field name="memo"><![CDATA[Idea to develop
|
<field name="memo"><![CDATA[<b>Idea to develop</b>
|
||||||
<br/><br/>* Create a module note_pad
|
<br/><br/>* Create a module note_pad
|
||||||
it transforms the html editable memo text field into widget='pad', similar to project_pad depends on 'memo' and 'pad' modules
|
it transforms the html editable memo text field into widget='pad', similar to project_pad depends on 'memo' and 'pad' modules
|
||||||
]]>
|
]]>
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_7" model="note.note">
|
<record id="note_7" model="note.note">
|
||||||
<field name="memo"><![CDATA[Read some documentation about OpenERP before diving into the code
|
<field name="memo"><![CDATA[<b>Read some documentation about OpenERP before diving into the code</b>
|
||||||
<br/><br/>* Open ERP: a modern approach to integrated business management
|
<br/><br/>* Open ERP: a modern approach to integrated business management
|
||||||
<br/>* Open ERP for Retail and Industrial Management
|
<br/>* Open ERP for Retail and Industrial Management
|
||||||
]]>
|
]]>
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_8" model="note.note">
|
<record id="note_8" model="note.note">
|
||||||
<field name="memo"><![CDATA[New computer specs
|
<field name="memo"><![CDATA[<b>New computer specs</b>
|
||||||
<br/><br/>* Motherboard
|
<br/><br/>* Motherboard
|
||||||
according to processor
|
according to processor
|
||||||
<br/>* Processor
|
<br/>* Processor
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_9" model="note.note">
|
<record id="note_9" model="note.note">
|
||||||
<field name="memo"><![CDATA[Read those books
|
<field name="memo"><![CDATA[<b>Read those books</b>
|
||||||
<br/><br/>* Open ERP: a modern approach to integrated business management
|
<br/><br/>* Open ERP: a modern approach to integrated business management
|
||||||
<br/>* Open ERP for Retail and Industrial Management
|
<br/>* Open ERP for Retail and Industrial Management
|
||||||
]]>
|
]]>
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_10" model="note.note">
|
<record id="note_10" model="note.note">
|
||||||
<field name="memo"><![CDATA[Read some documentation about OpenERP before diving into the code
|
<field name="memo"><![CDATA[<b>Read some documentation about OpenERP before diving into the code</b>
|
||||||
<br/><br/>* Open ERP: a modern approach to integrated business management
|
<br/><br/>* Open ERP: a modern approach to integrated business management
|
||||||
<br/>* Open ERP for Retail and Industrial Management
|
<br/>* Open ERP for Retail and Industrial Management
|
||||||
]]>
|
]]>
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="note_12" model="note.note">
|
<record id="note_12" model="note.note">
|
||||||
<field name="memo"><![CDATA[Read some documentation about OpenERP before diving into the code
|
<field name="memo"><![CDATA[<b>Read some documentation about OpenERP before diving into the code</b>
|
||||||
<br/><br/>* Open ERP: a modern approach to integrated business management
|
<br/><br/>* Open ERP: a modern approach to integrated business management
|
||||||
<br/>* Open ERP for Retail and Industrial Management
|
<br/>* Open ERP for Retail and Industrial Management
|
||||||
]]>
|
]]>
|
||||||
|
|
|
@ -31,11 +31,5 @@ class note_pad_note(osv.osv):
|
||||||
_pad_fields = ['note_pad']
|
_pad_fields = ['note_pad']
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'note_pad_url': fields.char('Pad Url',
|
'note_pad_url': fields.char('Pad Url', pad_content_field='memo'),
|
||||||
pad_content_field='memo',
|
|
||||||
size=250 ),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#_defaults = {
|
|
||||||
# 'note_pad_url': lambda self, cr, uid, context: self.pad_generate_url(cr, uid, context),
|
|
||||||
#}
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class pad_common(osv.osv_memory):
|
||||||
s = string.ascii_uppercase + string.digits
|
s = string.ascii_uppercase + string.digits
|
||||||
salt = ''.join([s[random.randint(0, len(s) - 1)] for i in range(10)])
|
salt = ''.join([s[random.randint(0, len(s) - 1)] for i in range(10)])
|
||||||
# contruct the url
|
# contruct the url
|
||||||
url = '%s/p/%s-%s-%s' % (pad_server, cr.dbname, self._name, salt)
|
url = '%s/p/%s-%s-%s' % (pad_server, cr.dbname.replace('_','-'), self._name, salt)
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def pad_get_content(self, cr, uid, url, context=None):
|
def pad_get_content(self, cr, uid, url, context=None):
|
||||||
|
@ -35,22 +35,21 @@ class pad_common(osv.osv_memory):
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# reverse engineer protocol to be setHtml without using the api key
|
# reverse engineer protocol to be setHtml without using the api key
|
||||||
# override read and copy to generate url and store the content if empty
|
|
||||||
|
|
||||||
def default_get(self, cr, uid, fields, context=None):
|
|
||||||
data = super(pad_common, self).default_get(cr, uid, fields, context)
|
|
||||||
for k in fields:
|
|
||||||
field = self._all_columns[k].column
|
|
||||||
if hasattr(field,'pad_content_field'):
|
|
||||||
data[k] = self.pad_generate_url(cr, uid, context=context)
|
|
||||||
return data
|
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None):
|
def write(self, cr, uid, ids, vals, context=None):
|
||||||
|
self._set_pad_value(cr, uid, vals, context)
|
||||||
|
return super(pad_common, self).write(cr, uid, ids, vals, context=context)
|
||||||
|
|
||||||
|
def create(self, cr, uid, vals, context=None):
|
||||||
|
self._set_pad_value(cr, uid, vals, context)
|
||||||
|
return super(pad_common, self).create(cr, uid, vals, context=context)
|
||||||
|
|
||||||
|
# Set the pad content in vals
|
||||||
|
def _set_pad_value(self, cr, uid, vals, context=None):
|
||||||
for k,v in vals.items():
|
for k,v in vals.items():
|
||||||
field = self._all_columns[k].column
|
field = self._all_columns[k].column
|
||||||
if hasattr(field,'pad_content_field'):
|
if hasattr(field,'pad_content_field'):
|
||||||
vals[field.pad_content_field] = self.pad_get_content(cr, uid, v, context=context)
|
vals[field.pad_content_field] = self.pad_get_content(cr, uid, v, context=context)
|
||||||
return super(pad_common, self).write(cr, uid, ids, vals, context=context)
|
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default=None, context=None):
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
if not default:
|
if not default:
|
||||||
|
|
|
@ -16,8 +16,15 @@ instance.web.form.FieldPad = instance.web.form.AbstractField.extend({
|
||||||
var self = this;
|
var self = this;
|
||||||
var _super = self._super;
|
var _super = self._super;
|
||||||
_super.apply(self,[val]);
|
_super.apply(self,[val]);
|
||||||
this._dirty_flag = true;
|
if (val === false || val === "") {
|
||||||
|
self.field_manager.dataset.call('pad_generate_url').then(function(r) {
|
||||||
|
_super.apply(self,[r]);
|
||||||
self.render_value();
|
self.render_value();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
self.render_value();
|
||||||
|
}
|
||||||
|
this._dirty_flag = true;
|
||||||
},
|
},
|
||||||
render_value: function() {
|
render_value: function() {
|
||||||
console.log("display");
|
console.log("display");
|
||||||
|
|
Loading…
Reference in New Issue