|
@ -18,12 +18,13 @@ |
|
|
# You should have received a copy of the GNU Affero General Public License |
|
|
# You should have received a copy of the GNU Affero General Public License |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# |
|
|
# |
|
|
############################################################################## |
|
|
|
|
|
|
|
|
######################################################################## |
|
|
|
|
|
|
|
|
from openerp.osv import fields |
|
|
from openerp.osv import fields |
|
|
from openerp.osv.orm import Model |
|
|
from openerp.osv.orm import Model |
|
|
from .. import match_algorithm |
|
|
from .. import match_algorithm |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class fetchmail_server_folder(Model): |
|
|
class fetchmail_server_folder(Model): |
|
|
_name = 'fetchmail.server.folder' |
|
|
_name = 'fetchmail.server.folder' |
|
|
_rec_name = 'path' |
|
|
_rec_name = 'path' |
|
@ -40,13 +41,14 @@ class fetchmail_server_folder(Model): |
|
|
algorithms = [] |
|
|
algorithms = [] |
|
|
for cls in self._get_match_algorithms().itervalues(): |
|
|
for cls in self._get_match_algorithms().itervalues(): |
|
|
algorithms.append((cls.__name__, cls.name)) |
|
|
algorithms.append((cls.__name__, cls.name)) |
|
|
return tuple(sorted(algorithms, lambda a, b: cmp(a[0], b[0]))) |
|
|
|
|
|
|
|
|
algorithms.sort() |
|
|
|
|
|
return algorithms |
|
|
|
|
|
|
|
|
_columns = { |
|
|
_columns = { |
|
|
'sequence': fields.integer('Sequence'), |
|
|
'sequence': fields.integer('Sequence'), |
|
|
'path': fields.char( |
|
|
'path': fields.char( |
|
|
'Path', size=256, help='The path to your mail ' |
|
|
'Path', size=256, help='The path to your mail ' |
|
|
'folder. Typically would be something like \'INBOX.myfolder\'', |
|
|
|
|
|
|
|
|
"folder. Typically would be something like 'INBOX.myfolder'", |
|
|
required=True), |
|
|
required=True), |
|
|
'model_id': fields.many2one( |
|
|
'model_id': fields.many2one( |
|
|
'ir.model', 'Model', required=True, |
|
|
'ir.model', 'Model', required=True, |
|
@ -56,12 +58,12 @@ class fetchmail_server_folder(Model): |
|
|
help='The field in your model that contains the field to match ' |
|
|
help='The field in your model that contains the field to match ' |
|
|
'against.\n' |
|
|
'against.\n' |
|
|
'Examples:\n' |
|
|
'Examples:\n' |
|
|
'\'email\' if your model is res.partner, or ' |
|
|
|
|
|
'\'partner_id.email\' if you\'re matching sale orders'), |
|
|
|
|
|
|
|
|
"'email' if your model is res.partner, or " |
|
|
|
|
|
"'partner_id.email' if you're matching sale orders"), |
|
|
'model_order': fields.char( |
|
|
'model_order': fields.char( |
|
|
'Order (model)', size=128, |
|
|
'Order (model)', size=128, |
|
|
help='Fields to order by, this mostly useful in conjunction ' |
|
|
help='Fields to order by, this mostly useful in conjunction ' |
|
|
'with \'Use 1st match\''), |
|
|
|
|
|
|
|
|
"with 'Use 1st match'"), |
|
|
'match_algorithm': fields.selection( |
|
|
'match_algorithm': fields.selection( |
|
|
_get_match_algorithms_sel, |
|
|
_get_match_algorithms_sel, |
|
|
'Match algorithm', required=True, translate=True, |
|
|
'Match algorithm', required=True, translate=True, |
|
@ -70,14 +72,14 @@ class fetchmail_server_folder(Model): |
|
|
'mail_field': fields.char( |
|
|
'mail_field': fields.char( |
|
|
'Field (email)', size=128, |
|
|
'Field (email)', size=128, |
|
|
help='The field in the email used for matching. Typically ' |
|
|
help='The field in the email used for matching. Typically ' |
|
|
'this is \'to\' or \'from\''), |
|
|
|
|
|
|
|
|
"this is 'to' or 'from'"), |
|
|
'server_id': fields.many2one('fetchmail.server', 'Server'), |
|
|
'server_id': fields.many2one('fetchmail.server', 'Server'), |
|
|
'delete_matching': fields.boolean( |
|
|
'delete_matching': fields.boolean( |
|
|
'Delete matches', |
|
|
'Delete matches', |
|
|
help='Delete matched emails from server'), |
|
|
help='Delete matched emails from server'), |
|
|
'flag_nonmatching': fields.boolean( |
|
|
'flag_nonmatching': fields.boolean( |
|
|
'Flag nonmatching', |
|
|
'Flag nonmatching', |
|
|
help='Flag emails in the server that don\'t match any object ' |
|
|
|
|
|
|
|
|
help="Flag emails in the server that don't match any object " |
|
|
'in OpenERP'), |
|
|
'in OpenERP'), |
|
|
'match_first': fields.boolean( |
|
|
'match_first': fields.boolean( |
|
|
'Use 1st match', |
|
|
'Use 1st match', |
|
@ -107,4 +109,3 @@ class fetchmail_server_folder(Model): |
|
|
'view_type': 'form', |
|
|
'view_type': 'form', |
|
|
'view_mode': 'form', |
|
|
'view_mode': 'form', |
|
|
} |
|
|
} |
|
|
|
|
|
|