Browse Source

[FIX] #688, partner_relations: creating equal but non-overlapping relations was not allowed

Conflicts:
	partner_relations/model/res_partner_relation_all.py
pull/103/head
Stefan Rijnhart 10 years ago
committed by Sandy Carter
parent
commit
4967c79bd6
  1. 37
      partner_relations/i18n/nl.po
  2. 31
      partner_relations/model/res_partner_relation.py

37
partner_relations/i18n/nl.po

@ -68,6 +68,11 @@ msgstr "Heeft koppeling"
msgid "Has relation with" msgid "Has relation with"
msgstr "Heeft koppeling met" msgstr "Heeft koppeling met"
#. module: partner_relations
#: field:res.partner,search_relation_partner_category_id:0
msgid "Has relation with a partner in category"
msgstr "Heeft koppeling met relatie van de categorie"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation.type,name_inverse:0 #: field:res.partner.relation.type,name_inverse:0
msgid "Inverse name" msgid "Inverse name"
@ -82,17 +87,17 @@ msgstr "Inverse type"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation,left_partner_id:0 #: field:res.partner.relation,left_partner_id:0
msgid "Left partner" msgid "Left partner"
msgstr "Linker relatie"
msgstr "Linkerrelatie"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation.type,partner_category_left:0 #: field:res.partner.relation.type,partner_category_left:0
msgid "Left partner category" msgid "Left partner category"
msgstr "Linker relatielabel"
msgstr "Linker-relatielabel"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation.type,contact_type_left:0 #: field:res.partner.relation.type,contact_type_left:0
msgid "Left partner type" msgid "Left partner type"
msgstr "Linker relatietype"
msgstr "Linker-relatietype"
#. module: partner_relations #. module: partner_relations
#: view:res.partner.relation.type:0 #: view:res.partner.relation.type:0
@ -120,6 +125,12 @@ msgstr "Categorie andere record"
msgid "Other record's partner type" msgid "Other record's partner type"
msgstr "Type andere record" msgstr "Type andere record"
#. module: partner_relations
#: code:addons/partner_relations/model/res_partner_relation.py:259
#, python-format
msgid "Overlapping relation"
msgstr "Overlappende koppeling"
#. module: partner_relations #. module: partner_relations
#: model:ir.model,name:partner_relations.model_res_partner_relation_type #: model:ir.model,name:partner_relations.model_res_partner_relation_type
#: model:ir.model,name:partner_relations.model_res_partner_relation_type_inverse #: model:ir.model,name:partner_relations.model_res_partner_relation_type_inverse
@ -135,7 +146,7 @@ msgstr "Relatie"
#. module: partner_relations #. module: partner_relations
#: model:ir.model,name:partner_relations.model_res_partner_category #: model:ir.model,name:partner_relations.model_res_partner_category
msgid "Partner Categories" msgid "Partner Categories"
msgstr "Relatie Categorieën"
msgstr "Relatielabels"
#. module: partner_relations #. module: partner_relations
#: model:ir.model,name:partner_relations.model_res_partner_relation #: model:ir.model,name:partner_relations.model_res_partner_relation
@ -169,7 +180,7 @@ msgstr "Koppeling"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation,is_relation_expired:0 #: field:res.partner.relation,is_relation_expired:0
msgid "Relation is expired" msgid "Relation is expired"
msgstr "Koppeling is afgelopen"
msgstr "Koppeling is beëindigd"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation,is_relation_future:0 #: field:res.partner.relation,is_relation_future:0
@ -195,17 +206,17 @@ msgstr "Koppelingen"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation,right_partner_id:0 #: field:res.partner.relation,right_partner_id:0
msgid "Right partner" msgid "Right partner"
msgstr "Rechter relatie"
msgstr "Rechterrelatie"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation.type,partner_category_right:0 #: field:res.partner.relation.type,partner_category_right:0
msgid "Right partner category" msgid "Right partner category"
msgstr "Rechter relatielabel"
msgstr "Rechter-relatielabel"
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation.type,contact_type_right:0 #: field:res.partner.relation.type,contact_type_right:0
msgid "Right partner type" msgid "Right partner type"
msgstr "Rechter relatietype"
msgstr "Rechter-relatietype"
#. module: partner_relations #. module: partner_relations
#: view:res.partner.relation.type:0 #: view:res.partner.relation.type:0
@ -221,18 +232,24 @@ msgstr "Begindatum"
#. module: partner_relations #. module: partner_relations
#: constraint:res.partner.relation:0 #: constraint:res.partner.relation:0
msgid "The left partner is not applicable for this relation type." msgid "The left partner is not applicable for this relation type."
msgstr "De linker relatie is niet geldig voor dit type koppeling."
msgstr "De linkerrelatie is niet geldig voor dit type koppeling."
#. module: partner_relations #. module: partner_relations
#: constraint:res.partner.relation:0 #: constraint:res.partner.relation:0
msgid "The right partner is not applicable for this relation type." msgid "The right partner is not applicable for this relation type."
msgstr "De rechter relatie is niet geldig voor dit type koppeling."
msgstr "De rechterrelatie is niet geldig voor dit type koppeling."
#. module: partner_relations #. module: partner_relations
#: constraint:res.partner.relation:0 #: constraint:res.partner.relation:0
msgid "The starting date cannot be after the ending date." msgid "The starting date cannot be after the ending date."
msgstr "De begindatum mag niet na de einddatum liggen." msgstr "De begindatum mag niet na de einddatum liggen."
#. module: partner_relations
#: code:addons/partner_relations/model/res_partner_relation.py:260
#, python-format
msgid "There is already a similar relation with overlapping dates"
msgstr "Er is al een soortgelijke, overlappende koppeling."
#. module: partner_relations #. module: partner_relations
#: field:res.partner.relation,type_id:0 #: field:res.partner.relation,type_id:0
#: field:res.partner.relation,type_selection_id:0 #: field:res.partner.relation,type_selection_id:0

31
partner_relations/model/res_partner_relation.py

@ -19,7 +19,7 @@
# 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.orm import Model
from openerp.osv.orm import Model, except_orm
from openerp.osv import fields from openerp.osv import fields
from openerp.tools.translate import _ from openerp.tools.translate import _
@ -241,17 +241,24 @@ class ResPartnerRelation(Model):
for this in self.browse(cr, uid, ids, context=context): for this in self.browse(cr, uid, ids, context=context):
if not this.active: if not this.active:
continue continue
if self.search(
cr, uid,
[
('type_id', '=', this.type_id.id),
('active', '=', True),
('id', '!=', this.id),
('left_partner_id', '=', this.left_partner_id.id),
('right_partner_id', '=', this.right_partner_id.id),
],
context=context):
return False
domain = [
('type_id', '=', this.type_id.id),
('active', '=', True),
('id', '!=', this.id),
('left_partner_id', '=', this.left_partner_id.id),
('right_partner_id', '=', this.right_partner_id.id),
]
if this.date_start:
domain += ['|', ('date_end', '=', False),
('date_end', '>=', this.date_start)]
if this.date_end:
domain += ['|', ('date_start', '=', False),
('date_start', '<=', this.date_end)]
if self.search(cr, uid, domain, context=context):
raise except_orm(
_('Overlapping relation'),
_('There is already a similar relation '
'with overlapping dates'))
return True return True

Loading…
Cancel
Save