[IMP] marketing campaigns

bzr revid: fp@tinyerp.com-20100610204126-xdpydbodgvgc2mpm
This commit is contained in:
Fabien Pinckaers
2010-06-10 22:41:26 +02:00
parent 4760a832f3
commit de2d11830d
2 changed files with 15 additions and 9 deletions
@@ -106,17 +106,17 @@ class marketing_campaign_segment(osv.osv):
type='many2one', relation='ir.model',
string='Object'),
'ir_filter_id': fields.many2one('ir.filters', 'Filter', help=""),
'sync_last_date': fields.datetime('Date'),
'sync_mode': fields.selection([('create_date', 'Create'),
('write_date', 'Write')],
'Mode'),
'sync_last_date': fields.datetime('Latest Synchronization'),
'sync_mode': fields.selection([('create_date', 'Sync only on creation'),
('write_date', 'Sync at each modification')],
'Synchronization Mode'),
'state': fields.selection([('draft', 'Draft'),
('running', 'Running'),
('done', 'Done'),
('cancelled', 'Cancelled')],
'State',),
'date_run': fields.datetime('Running'),
'date_done': fields.datetime('Done'),
'date_run': fields.datetime('Launching Date'),
'date_done': fields.datetime('End Date'),
}
_defaults = {
@@ -169,6 +169,11 @@ class marketing_campaign_segment(osv.osv):
object_ids = model_obj.search(cr, uid, criteria)
for o_ids in model_obj.browse(cr, uid, object_ids, context=context) :
# avoid duplicated workitem for the same resource
if segment.sync_mode == 'write_date':
segids = self.pool.get('marketing.campaign.workitem').search(cr, uid, [('res_id','=',o_ids.id),('segment_id','=',segment.id)])
if segids:
continue
for act_id in act_ids:
wi_vals = {
'segment_id': segment.id,
@@ -184,7 +184,8 @@
<separator string="Synchronization" colspan="2"/>
<field name="sync_last_date"/>
<field name="sync_mode" required="True"/>
<button string="Synchroniz" states="draft,running" name="synchroniz" icon="gtk-apply" type="object"/>
<label string="" colspan="1"/>
<button string="Synchronize" states="running" name="synchroniz" icon="gtk-apply" type="object"/>
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2"/>
@@ -195,8 +196,8 @@
<group col="10" colspan="4">
<field name="state" readonly="1" select="2" nolabel="1"/>
<button name="state_running_set" string="Run" states="draft" icon="gtk-apply"/>
<button name="state_done_set" string="Done" states="running" icon="gtk-ok"/>
<button name="state_cancel_set" string="Cancelled" states="running" icon="gtk-cancel"/>
<button name="state_done_set" string="Close" states="running" icon="gtk-ok"/>
<button name="state_cancel_set" string="Cancel" states="running" icon="gtk-cancel"/>
</group>
</form>
</field>