[FIX] Access rules for contract lines

created contract_group class

Some PEP8 in contract_group

Add contract groups in simple recurring contract. Moved invoice generation to contract group class

[ADD] acces rights on contract groups. [ADD] partner_change callbacks on group and contracts. Adapted sponsorship contract customizing to fit new model.

[FIX] headers, PEP8, YAGNI for simple_recurring_contract and sponsorship_compassion

Change simple_recurring_contract to recurring_contract. [ADD] mail.thread on contracts and contract groups.

[ADD] search on child code in contracts, module description, refactored module name

[RM] group checkbox in invoicer wizard. [MV] simple_recurring_contract to recurring_contract [FIX] Generation issue in advance billing

Changed module dependency from 'account_analytic_plans' to 'account_analytic_compassion

My bad... the module should not be dependent for the production or it would install the analytic plans over the already existing data. However in a test environment, we should not forget to install first the module 'account_analytic_compassion' before installing 'sponsorship_compassion'.

[FIX] Contract duplication. contract_group description. Moved fields in contract view. Removed debugging next_invoice_date track_visibility

Added default start date of contract.

New wizard allowing splitting payments. New folder hierarchy inside module. Ability to edit contracts directly from the Reconcile + Put in Fund wizard.

Added contracts modification from Split Payment Wizard.

French translation for module. Updated some texts.

Fixed XML indentation and references to module recurring_contract.

Updated references to module recurring_contract, docstring added, some cleanup.

Completion updated to fit contract_groups.

Small bug fix.

Added a new field 'num_pol_ga' that holds the contract number of a sponsor so that we can export from GP which have arbitrary values. This is useful for GIFT reference numbers.

Added account 1098. Added link to GP funds in product_product in order to find fund products when receiving a payment.

Added validation before sending messages to the middleware to prevent wrong user actions. Various bug fixes.

More explicit error messages to know which object raised the error.

PEP8 and small code cleaning.

Adds a default date to the next first of months in contracts.

Moved middleware server url to conf file

Fixed rebase conflict mistake

[ADD] child method on child allocation and update message

PEP8 + Headers modifications.

Added security rules, default actions and corrected the code to fit changes in other modules.

Changed allocation method so that allocation date is set for the child. Small code improvements.

Completion bug fix. Prepare new generation of BVR Reference

Remove debugging break points.

Removed useless import

Implementation of the UpdateProject message + various code fixes.

Corrected and unified error messages formatting.

Adds a default date to the next first of months in contracts.

New way of setting reference. Select default payment term and restrict to the terms of Compassion CH. Prevent user to rewind the next_invoice_date.

Bug fix in linkContact procedure.

Fund name typo fixed.

Fixed Payment Term bug where DD payment_term_line was replaced by another that had the same name. It caused DD invoices to have a wrong due_date.

Workflow improvement : clean_invoices on contract cancelled. Added methods to trigger workflow transitions from GP when exporting contracts.

Added verification that BVR Reference is valid, if modified by the user.

Small performance improvement on contract validation

Code formatting fixes.

[ADD] Project info retrieving

[ADD] Community prototypes for value retrieval for description generation.

[ADD] Access rights on child_property and child_property_value

[ADD] Compassion countries. [FIXED] headers

Added Unit Test Files in order to test information retrieval on projects. The tests should be completed as they don't cover everything yet.

Retrieving informations for project description generation

improved description generation

initial german description commit

french description splitted from child description file

improving german description generation

Finalizing german description generation + pep8 corrections

Improving German translation

german description generation improved (80%)

reviewed code corrected

pep8 errors corrected

Pep8 + code reviewed corrected

bug line 309-310, project_code -> None

bug line 301-302, project_code -> None

IntegrityError: null value in column 'iso_code'

bugs fixed + test OK

Refactoring of project_compassion.py

- Changed compassion.child.property.value class to compassion.translated.value
- Code cleaning and refactoring of project_compassion

[ADD] Compassion countries. [FIXED] headers

french description splitted from child description file

Added child information test

Fixed merging conflicts in child_compassion.py

compassion.child.property.value -> compassion.translated.value

deleted unnecessary files

deleted reference in sponsorship_compassion/__openerp__.py

small header changes before PR

Access rights for child_compassion corrected

Pep8 errors corrected

code reviewed corrected

Indentation fixed.

Fixed access rules in message_center.

Small code improvements.

- Refactor of case_study variable to json_data
- Add context to some methods

Modified the get_case_study method in order to adapt to changes made in Compass APIS

PEP8 errors fixed

Typo correction, class name correction.

Code improvements

- Replaced dict() creator by dictionary comprehensions
- Renaming of function _send_request to _cornerstone_fetch

Removed pdb breakpoint.

PEP8 Kiiillerrr git status!

PEP8 KILL number 2

Travis should be GREEN now !

relative imports

Adds a default date to the next first of months in contracts.

Improve the Manual Reconciliation Process by:

- Adding buttons for opening custom wizards
- Adding button for opening current partner

Fixes:

- Related contracts in reconcile wizards not
  properly retrieved.

Improvements on the contract views.

- [FIX] A simplified tree view in module reconcile_compassion was
        overwriting normal tree views. Now it is a separate view.
- [ADD] Frequency in contract tree view
- [ADD] Contracts in partner view are sorted on start_date
- [ADD] Contracts in partner view can be opened on current window.
- [FIX] PEP8 errors.

Added buttons to go to transactions and unreconciled move_lines from the
invoice view, to ease the verification of generated invoices in
account_statement_completion_compassion module.

Fix PEP8

[NEW] Added a wizard to generate Gift Invoices from an active contract.

It can be useful when a sponsor used a sponsorship reference in order
to pay for a gift. In this case, the user is able to create a gift
invoice in order to reconcile the credit.

Removed dependency on module account_banking_payment.

Extracted the ability to filter invoices collected in payment order by
payment term from the module account_banking_payment and included it
in module lsv_compassion, so that we can remove dependency which avoids
installing a lot of functionalities we don't use, and avoids installing
module account_banking which brings a lot of mess in accounting views.

PEP8 + headers correction on module lsv_compassion

Modify activation of contracts called by GP so that they can be activated one at a time (more reliable).

Removed useless pdb import

Small bug fix.

Corrected missing context in method.

Bug fix where view_id of invoice_view was the same as statement_view in module completion_compassion

Bug fix where it was not possible to unreconcile invoices.

New clean_invoices method that takes care of invoices paid in advance.

When a contract is cancelled, if there are paid invoices in advance by
the sponsor, it will :
	- cancel them
	- remove the invoice_line of contract
	- split payment and reconcile if possible
	- if not possible, put a move_line name that will warn the person
	  doing the manual reconcile.

Corrections on contracts cancellation.

- Invoices cancelled keep their lines so that we can see what was
  the invoice.
- Several bug fixes.
- Start date can be rewinded if the contract is in draft state.

Updated translations

Modified next_invoice_date calculation to consider only active contracts.

Cron bug fix

Bug fix in bvr_ref_compassion, PEP8 and Headers

Sponsorship validation improvement

- [ADD] Verify that a valid mandate exists for LSV,DD contracts

Fix generation if group has no next_invoice_date.

Add ability to close old assets.

Simulate messages sent when contracts exported from GP.

[FIX] adapt to the fact that GP sends only one id.

[FIX] bad coding error :(

[FIX] I am stupid.

Another cron bug fixed.

Fixed next_invoice_date calculation on groups.

The calculation now takes only contracts in active states (waiting + active)
and is recalculated if contracts change state or next_invoice_date.

Bug fix on next_invoice_date calculation.

PEP8 erorrs

PEP8 errors again.

Merge conflict fixed

Travis errors corrected

Invoice generation and validation commits.

The invoice generation and validation does now commit the changes
in order to avoid restarting the whole process if an error occurs
during the execution.

- Generation : commit the invoices each time a contract_group is done.
- Validation : commit each generated invoice.

The process is also logged into the console so that we can keep an
eye at the execution and know when it is performing or not.

Removed old refs to files moved in child_compassion module

Method _next_invoice_date is no more required in sponsorship_compassion

Replaced logg info that didn't display the number of invoices to validate.

Bug fix where a set was not converted to a list.

Fixed default context parameter

Improve the Manual Reconciliation Process by:

- Adding buttons for opening custom wizards
- Adding button for opening current partner

Fixes:

- Related contracts in reconcile wizards not
  properly retrieved.

Improvements on the contract views.

- [FIX] A simplified tree view in module reconcile_compassion was
        overwriting normal tree views. Now it is a separate view.
- [ADD] Frequency in contract tree view
- [ADD] Contracts in partner view are sorted on start_date
- [ADD] Contracts in partner view can be opened on current window.
- [FIX] PEP8 errors.

Added buttons to go to transactions and unreconciled move_lines from the
invoice view, to ease the verification of generated invoices in
account_statement_completion_compassion module.

[NEW] Added a wizard to generate Gift Invoices from an active contract.

It can be useful when a sponsor used a sponsorship reference in order
to pay for a gift. In this case, the user is able to create a gift
invoice in order to reconcile the credit.

Removed dependency on module account_banking_payment.

Extracted the ability to filter invoices collected in payment order by
payment term from the module account_banking_payment and included it
in module lsv_compassion, so that we can remove dependency which avoids
installing a lot of functionalities we don't use, and avoids installing
module account_banking which brings a lot of mess in accounting views.

PEP8 + headers correction on module lsv_compassion

Small bug fix.

New clean_invoices method that takes care of invoices paid in advance.

When a contract is cancelled, if there are paid invoices in advance by
the sponsor, it will :
	- cancel them
	- remove the invoice_line of contract
	- split payment and reconcile if possible
	- if not possible, put a move_line name that will warn the person
	  doing the manual reconcile.

Corrections on contracts cancellation.

- Invoices cancelled keep their lines so that we can see what was
  the invoice.
- Several bug fixes.
- Start date can be rewinded if the contract is in draft state.

Sponsorship validation improvement

- [ADD] Verify that a valid mandate exists for LSV,DD contracts

compassion.child.property.value -> compassion.translated.value

deleted unnecessary files

Small code improvements.

- Refactor of case_study variable to json_data
- Add context to some methods

New module for pushing contracts to GP.

Addition of information to sync contracts with GP.

- Exit details for children based on REST webservice GetExitDetails.
- State for children
- End reasons for contracts

Synchronization improvements and bug fixes.

- Changed the state view on the child
- Contract is now pushed as soon as it is created so that we can access it for sending a mailing to the sponsor from GP.
- Contract is updated when it is validated (to know when will be the first payment).
- Added various security checks to avoid synchronization errors
- Contract are update also when a group is modified
- Code refactoring

BVR ref is set in GP even for LSV,DD contract groups.

- [NEW] BVR ref is always set in GP
- [FIX] CODESPE can be empty in draft state, must be set before validating
  	a contract.
- PEP8 corrections

New wizard for cancelling contracts.

Instead of directly cancelling contracts, a wizard asks for ending reason
and will update child status and everything (must still be implemented).

Improved end sponsorship wizard.

[Fix] Update child status if draft contract is modified.

New workflow for children states.

- Improves children states transitions
- Children are directly linked to their sponsor
- Keep in memory if child has already been sponsored
  ('R' state -> waiting new sponsor)

Rebased on usability-improvements branch.

- This branch is now on top of :
	- compassion-projects
	- usability-improvements
- Conflicts resolved

Bug fixes.

Add child state in tree view...

- [NEW] Child state in tree view, with colors
- [NEW] Child filters and search options
- [FIX] Bug on end wizard, transfer_country field required only if checkbox
  is selected.
- [FIX] Only available children can be selected for new sponsorships
- [NEW] Remove quick create options from contract view

Track changes on children

- [NEW] Added mail thread in view of children
- [NEW] Updated the tracked fields
- [FIX] Sponsor_id field is not editable

New child exit details based on GP ending reasons.

- [NEW] Child exit_details as they are in GP.
- [FIX] Don't set a sponsor when contract is edited and child removed.
- [FIX] Children in 'waiting new sponsor' state can be sponsored :)
- [FIX] Don't update twice the state of the child.

Added end_reason to contract_view.

- [FIX] set end_date on contract cancellation

Update Sponsor category when contract activated/terminated

- [NEW] Add 'Sponsor' category to partner upon contract creation
- [NEW] Replace 'Sponsor' by 'Old Sponsor' category
	upon contract termination if no other active contracts exist.
- [DEL] Remove tracking of 'sponsor_id' field in child_compassion as
	it is redundant with the 'state' field.

New Origin of contracts.

Added origin of contracts.

Redefined view of contracts.

New module Events_compassion

Origin Events are now linked to custom objects event.compassion.
Not complete yet...

Renamed module to 'event_compassion', bug fixes and improvements.

- Upon event creation, create analytic account, analytic distribution
  and origin and link everything correctly
- [MERGE] module crm_child_sponsorship is merged into module event_compassion
- Ability to create event from opportunity (updated and fixed)
- Fixed regression bug where num_pol_ga field was removed from contracts_view
- [FIX] move lines and contracts are correctly linked to events
- [FIX] sponsorship origin name was not good for events
- [TODO] : add button create event in kanban view of Opportunities
- [TODO] : Fix acces rights to objects
- [TODO] : PEP8 fix

New button in kanban view to create events from opportunities

PEP8 + Access rules fix

Delegation is not part of workflow, but simple states.

Fixed analytic accounts and various small fixes.

- Changed analytic codes so that they are unique regarding what is already
  existing on production database
- Added analytic accounts for advertisement and campaigns
- Added concert event category
- ...

Plan instances are linked to default analytic plan...

Lot of bug fixes

Event creation modifications...

- Push the analytic distribution to sponsorship origin object
- Push user_id and partner_id to analytic account
- Bug fix in message center (activate_from_gp)

Added Affectat Creation in GP when invoice is paid.

Fixed merge conflicts.

Added button to create sponsorship from partner view

Sync the origin of new contracts (only channel and type)

New way of keeping situation of contract up to date. Not fully working yet...

Project suspensions and invoice cancellation

- Cancel invoices due during project suspension period
- Update GP when invoices are cancelled
- Numerous bug fixes
- PEP8 corrections

Ambassadors have analytic accounts and portal users.

- [FIX] Origin and Channel are not editable in active states
- [NEW] All portal users have an associated analytic account

Make date fields of contract more clear.

- Change names of dates
- Compute automatically next_invoice_date of new contracts

Name of origin - event contains year of event.

Small improvements on LSV,DD communication

- Remove quantity information for non-sponsorship products
- Remove "standard" on sponsorshipt product (.po need update!)
- Bug fix on cancellation from GP

Bug fixes

Bug fixes

LSV,DD Communications improvements + PEP8

Include date of previous sponsorship origin

Include date of previous sponsorship origin

Search views improved, menus reorganisation

- Search views improved for better finding
- Menus reorganization
- Added contracts origin menuitem

Bug fix on message_center

Added number of won sponsorships in an event.

Remove gp_sync field.

- Remove useless gp_sync field
- Bug fixes
- Small code improvements
- To be tested...

GIFT_TYPES Names are in one place and translated.

- Plus corrections on gp_sync. Contracts that are not compatible with
  GP can not be created.
- Standardization of error messages in gp_sync module

Ability to sponsor delegated, on internet children

- [NEW] Method to remove children from the website

Replace Analytic Distributions by Analytic Accounts in Events,Origins

Fixed activation of contracts

Fixed analytic account bug

Several bug fixes...

Translations bug fixed

Add analytic accoun to move lines

Invoice generation is not synchronized to GP.

New features and bug fixes.

PEP8 + Origin creation fixed

Don't prevent to create Projects from Events. Other bug fixes.

Small corrections

Code refactoring

- Bug fixed where contracts ended with 'depart_child' as ending
  reason were not correctly updated in GP.
- Code refactoring

Code refactor

Fixed PEP8 errors

Code corrections

- [New] Sponsorship and General Fund are automatically selected
        for new contracts.
- [New] Contract names are more friendly
- [FIX] Various code fixes

Bug fixes and test on sponsorship_sync_gp added and working!

- [FIX] Don't override the language in the context but create local
        context when english is needed.
- [NEW] Module sponsorship_sync_gp provides a test that will simulate
        the whole lifecycle of a sponsorship and test synchronization
        with GP at every stage. The test is passing.

small fixes and changes

moved button 'generated_invoices' after 'confirm' in bank statements.

bug fixed

bug fixed

better_zip module is renamed to base_location

Changed move_lines to analytic_lines

Simplified origins.

- SUB Sponsorships are only one origin and previous sponsorship is linked
  directly in the contract.
- 'Is already a sponsor' is of type 'other', as we don't need a category
  only for this origin.
- Search view of contracts improved and simplified.

Generated invoices from statement show journal type sale

End sponsorship Wizard Simplified.

Ability to depart unsponsored children.
GMC Mapping of Gift Types

- Add a mapping for transmitting gifts to GMC
- Bug fixed for depart action
- Prepare depart method

Further development regarding GMC. Not yet functional.

Message center big update

- New child state : deallocated, for deallocation of children
- New message states : new, pending, success, fail
- We can now receive message acknowledgements
- Incoming actions adapted but not yet ready
- Code refactoring
- UPSERT constituent when sponsor name changed
- ...

New tests for GMC Messages.

- Various bug fixes
- Tests are not working yet
- New method for middleware fetching gift information easily

Small bug fix

child_translated_values_view created

Add functionalities to get Infos button

fix project_compassion_views and create country_compassion_view

create english child description

fix repetitions in child_description_en.py and PEP8

fix country name in view, create child_description_it.py and PEP8

child_description_de|en|it.py refactored + PEP8

Fix code review

Resolve conflicts

reviewed code corrected

reviewed code corrected + PEP8

Add unique_id field in case study

Modified request_id to string field

Use working child codes in tests.

include child unique id in case study retrieval

Message Center bug fixes + PEP8

... Tests are now OK !

add request_id field. try to keep form view after process.

Fixed write child code bug

Don't raise error if none image is found for child

import logger

Incoming messages events and child pictures object.

- Incoming messages can have different events.
  Update method on Children handle the events differently
  (casestudy, picture, transfer)
- New object for storing children pictures (TODO)

Moved child pictures in a separate object

- Child pictures are attached to a new object
- UpdateChild message will now get only the pictures for event
  NewPictures.
- Write_date accessible to middleware from object res_partner

Retrieve suspension information, reset failed messages.

Need key is now a functional field

Fixed import error

small bug fix

set object_id on messages after allocation

set object_id on messages after allocation

Update relational fields of messages, small corrections

Update relational fields of messages, small corrections

Improvement on relation fields message_center

create get_exit_details method

Conflicts:
	child_compassion/workflow/child_workflow.xml

retrieve child exit details

rebase + bugs fixed

Conflicts:
	child_compassion/i18n/fr_CH.po

PEP8 errors corrected

PEP8 errors corrected, again

bug fixed + PEP8