From: Ludovic CHEVALIER Date: Wed, 24 Apr 2019 08:43:50 +0000 (+0200) Subject: [MODULE] ~reset X-Git-Url: http://git.cyclocoop.org/?p=burette%2Fcyclofficine_ivry.git;a=commitdiff_plain;h=d1985ea285fa2592e2474fed8af8dc1dd3158471 [MODULE] ~reset --- diff --git a/__init__.py b/__init__.py index e85a6a4..833a3fa 100644 --- a/__init__.py +++ b/__init__.py @@ -1,3 +1,27 @@ # -*- coding: utf-8 -*- +############################################################################## +# +# cyclofficine_ivry module for OpenERP, Custom module for La Cyclofficine +# de ivry -import cyclofficine_ivry +# Copyright (C) 2019 cyclofficine_ivry +# () +# +# This file is a part of cyclofficine_ivry +# +# cyclofficine_ivry is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# cyclofficine_ivry is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/__openerp__.py b/__openerp__.py index 2332135..5d2e317 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -1,31 +1,52 @@ # -*- coding: utf-8 -*- +############################################################################## +# +# cyclofficine_ivry module for OpenERP, Custom module for La Cyclofficine +# d'Ivry +# +# Copyright (C) 2019 cyclofficine_ivry +# () +# +# This file is a part of cyclofficine_ivry +# along with this program. If not, see . +# +############################################################################## { - 'name': 'Cyclofficine Ivry', - 'version': '2013.10.25', - 'category': 'Association', - 'complexity': "normal", - 'description': """ -Cyclofficine Ivry -================= + 'name': 'Custom Cyclofficine d\'Ivry', + 'version': '0.1', + 'category': 'Association', + 'complexity': "normal", + 'description': """ +This module is a profile module for Cyclofficine d'Ivry +======================================================= +It installs the profile for bike co-ops to manage some features like: + * search customers by member identifier and membership informations in customers views; + * import initial datas; + * … """, - 'author': 'Cyclofficine', - 'website': 'http://cyclocoop.org', - 'depends': [ - 'bikecoop', - 'bikecoop_l10n_fr', - 'remembership', - ], - 'update_xml': [ - 'data/partner.xml', - 'data/base.xml', - 'data/product.xml', - 'data/membership.xml', - 'data/members.xml', - 'view/members.xml', - ], - 'installable': True, - 'auto_install': False, - 'images': [], + 'author': 'La Cyclofficine d\'Ivry', + 'website': 'http://cyclocoop.org/index.php/les-ateliers/ivry-sur-seine', + 'depends': [ + 'account_cancel', + 'bikecoop', + 'bikecoop_l10n_fr', + 'nrt_point_of_sale', + ], + 'init_xml': [ + ], + 'update_xml': [ + 'data/base.xml', + 'data/products_categories.xml', + 'data/products_products.xml', + 'sec/data/members.xml', + 'sec/data/users.xml', + 'view/members.xml', + ], + 'installable': True, + 'auto_install': False, + 'images': [], } + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/cyclofficine_ivry.py b/cyclofficine_ivry.py deleted file mode 100644 index 3b20220..0000000 --- a/cyclofficine_ivry.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from openerp.osv import osv -from openerp.osv import fields -import netsvc - - -class Partner(osv.osv): - _inherit = 'res.partner' - _order = 'member_ident' - _columns = { - 'member_ident': fields.integer('Member identifier'), - } - -Partner() - -class account_invoice(osv.osv): - _inherit = 'account.invoice' - def draft2open(self, cr, uid, ids): - print ("DEV: [account_invoice] [draft2open]: %s" % str([uid, ids])) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.invoice', ids[0], 'invoice_open', cr) - return ids - -account_invoice() diff --git a/data/base.xml b/data/base.xml index b700e0d..9d65e69 100644 --- a/data/base.xml +++ b/data/base.xml @@ -1,25 +1,63 @@ + - - - - PARIS - ivry@cyclocoop.org - True - Cyclofficine d'Ivry - (+33) - 6, bd de Brandebourg - - default - http://cyclocoop.org - 94200 - - - - - Cyclofficine d'Ivry - - - Atelier vélo coopératif - - - + + + La Cyclofficine d'Ivry + cyclocoop.org + 6 boulevard Brandebourg + + 94200 + IVRY-SUR-SEINE + 09 72 38 67 65 + 06 48 89 89 21 + + ivry@cyclocoop.org + + + + + La Cyclofficine d'Ivry + + + 531975290 000 36 + 9499Z + La Cyclofficine c'est ma coopine! + N° SIRET : 531975290 000 36 - Code NAF : 9499Z + + + + + + Crédit coopératif Paris Alesia + 42559 + CCOPFRPPXXX + 99 rue de la Tombe-Issoire + 75014 + PARIS + + + + + iban + 42559 + 10000 + 08012912645 + FR76 4255 9100 0008 0129 1264 506 + 06 + + La Cyclofficine d'Ivry + 6 boulevard Brandebourg + 94200 + IVRY-SUR-SEINE + + Crédit coopératif Paris Alésia + 42559 + + + + + + + + + diff --git a/data/members.deb.dependencies b/data/members.deb.dependencies deleted file mode 100644 index d2b2419..0000000 --- a/data/members.deb.dependencies +++ /dev/null @@ -1,3 +0,0 @@ -libtext-csv-perl -libtext-trim-perl -libxml-generator-perl diff --git a/data/members.import b/data/members.import deleted file mode 100755 index ea2fdd0..0000000 --- a/data/members.import +++ /dev/null @@ -1,320 +0,0 @@ -#!/usr/bin/perl -our $partner = "cyclofficine_ivry"; - -our $VERSION = '2013.10.27'; -use strict; -use warnings FATAL => qw(all); -use utf8; -use open qw/:std :utf8/; -require Data::Dumper; -require Encode; -require IO::Wrap; -require Text::CSV; -#require Text::CSV::Encoded; -require XML::Generator; -require Text::Trim; - -sub parse_date (@) { - ($_) = @_; - my ($jj,$mm,undef,$yy) = ($_ =~ m{^\s*([0-3]?[0-9])\s*/\s*([0-1]?[0-9])\s*/\s*(20)?([0-9][0-9])\s*$}); - return "20$yy-$mm-$jj"; - } -sub parse_amount (@) { - my ($_) = @_; - my %amounts = - ( "gratuit" => 0 - , "Gratuit" => 0 - , "offert" => 0 - , "Offert" => 0 - , "?" => 0 - ); - $_ = Text::Trim::trim($_); - if (exists $amounts{$_}) { - return $amounts{$_}; - } - else { - ($_) = ($_ =~ m{^\s*([0-9]+),00\s*€?.$}); - return $_; - } - } -sub parse_payment_mean (@) { - ($_) = @_; - my %payment_means = - ( "Espèces" => "cash" - , "Offert" => "cash" - , "Chèque" => "bank" - ); - $_ = Text::Trim::trim($_); - return exists $payment_means{$_} - ? $payment_means{$_} - : "cash"; - } -sub parse_discount ($) { - ($_) = @_; - my %discounts = - ( "Chômeur" => "unemployed" - , "Chmeur" => "unemployed" - , "Atelier vélo IdF" => "velorution_idf" - , "Étudiant" => "student" - , "Etudiant" => "student" - , "etudiant" => "student" - , "Retraité" => "retired" - ); - $_ = Text::Trim::trim($_); - return exists $discounts{$_} - ? $discounts{$_} - : "standard"; - } -sub parse_gender (@) { - ($_) = @_; - my %genders = - ( "Ass." => "association" - , "M." => "male" - , "Mme" => "female" - , "Mme." => "female" - ); - $_ = Text::Trim::trim($_); - return exists $genders{$_} - ? $genders{$_} - : undef; - } - -our $last_number = -1; -our $greatest_number = -1; -sub member_of_csv_line (@) { - my ($members, $csv_line, $csv_lines_rejected, $csv_lines_to_reparse) = @_; - print STDERR ("member_of_csv_line: csv_line=".Data::Dumper::Dumper($csv_line)); - my $number = Text::Trim::trim($csv_line->{number}); - if (not $number) { - push @$csv_lines_rejected, $csv_line; - } - else { - my $member = {}; - if (not $number or not ($number =~ m/^[0-9]+$/)) { - if (defined $csv_lines_to_reparse) { - push @$csv_lines_to_reparse, $csv_line; - return; - } - else { - $greatest_number = $greatest_number + 1; - print STDERR "WARNING: renumérotation: ".($number?$number:"undef")." -> $greatest_number\n"; - $csv_line->{comment} - =($csv_line->{comment}?"$csv_line->{comment}. ":"") - ."(n° malformé d'origine : ".($number?$number:"undef").")"; - $number = "$greatest_number"; - } - } - if ($number =~ m/^[0-9]+$/) { - $number = $number + 0; - if ($last_number + 1 != $number + 0) { - print STDERR "WARNING: discontinuité: attendu=".($last_number + 1)." eu=".($number + 0)."\n"; - } - $last_number = $number; - $greatest_number = $number - if $number > $greatest_number; - - if ($csv_line->{name} or $csv_line->{email}) { - if (exists $members->{$number}) { - $member = $members->{$number}; - } - else { - $member = {}; - $members->{$number} = $member; - } - $member->{number} = $number; - $member->{name} - = $csv_line->{name} - unless $member->{name}; - $member->{firstname} - = $csv_line->{firstname} - unless $member->{firstname}; - $member->{email} - = $csv_line->{email} - unless $member->{email}; - $member->{cotisations} - = [] - unless exists $member->{cotisations}; - push @{$member->{cotisations}}, - { amount => parse_amount($csv_line->{cotisation_amount}) - , date => parse_date($csv_line->{cotisation_date}) - , discount => parse_discount($csv_line->{cotisation_discount}) - , mean => parse_payment_mean($csv_line->{cotisation_mean}) - }; - $member->{zip} - =($csv_line->{zip} - ? $csv_line->{zip} - : undef) - unless $member->{zip}; - $member->{gender} - =($csv_line->{gender} - ? parse_gender($csv_line->{gender}) - : undef) - unless $member->{gender}; - $member->{city} - =($csv_line->{city} - ? $csv_line->{city} - : ($member->{zip} and ($member->{zip} =~ m/^750[0-2][0-9]$/) ? "Paris" : undef)) - unless $member->{city}; - $member->{country} - = ($member->{zip} and ($member->{zip} =~ m/^UK$/) - ? "Royaume-Uni" - : "France") - unless $member->{country}; - $member->{phone} - =($csv_line->{landline_phone} - ? $csv_line->{landline_phone} - :($csv_line->{mobile_phone} - ? $csv_line->{mobile_phone} - : undef)) - unless $member->{phone}; - $member->{street} - =($csv_line->{street} - ? $csv_line->{street} - : undef) - unless $member->{street}; - $member->{comment} - =($csv_line->{comment} - ? $csv_line->{comment} - : undef) - unless $member->{comment}; - } - else { - push @$csv_lines_rejected, $csv_line; - } - } - } - } -sub xml_of_member (@) { - my ($xml, $member, $xml_data, $xml_data_noupdate) = @_; - print STDERR ("xml_of_member: member=".Data::Dumper::Dumper($member)); - push @$xml_data, $xml->record - ( { id => "res_partner_${partner}_".$member->{number} - , model => "res.partner" - } - , $xml->field({name => "name"}, $member->{name} . ($member->{firstname} ? " ".$member->{firstname} : "")) - , $xml->field({name => "member_ident"}, $member->{number}) - , $xml->field({name => "type"}, "default") - , ($member->{zip} ? $xml->field({name => "zip"}, $member->{zip}) : ()) - , ($member->{city} ? $xml->field({name => "city"}, $member->{city}) : ()) - , ($member->{country}? $xml->field({name => "country_id", model => "res.country", search => "[('name','=','".$member->{country}."')]"}) : ()) - , ($member->{email} ? $xml->field({name => "email"}, $member->{email}) : ()) - , ($member->{phone} ? $xml->field({name => "phone"}, $member->{phone}) : ()) - , ($member->{street} ? $xml->field({name => "street"}, $member->{street}) : ()) - , ($member->{comment}? $xml->field({name => "comment"}, $member->{comment}) : ()) - ); - die unless $member->{cotisations}; - foreach my $cotisation (@{$member->{cotisations}}) { - push @$xml_data_noupdate, $xml->function - ( { model => "account.invoice" - , name => "pay_and_reconcile" - } - , $xml->xmlcmnt('ids') - , $xml->function - ( { model => "account.invoice" - , name => "draft2open" - } - , $xml->function - ( { model => "res.partner" - , name => "create_membership_invoice" - } - , $xml->xmlcmnt('partner_id') - , $xml->value({eval => "ref('res_partner_${partner}_".$member->{number}."')"}) - , $xml->xmlcmnt('product_id') - , $xml->value({eval => "ref('product_".$cotisation->{discount}."_member')"}) - , $xml->xmlcmnt('context') - , $xml->value({eval => "{'amount':".$cotisation->{amount}.", 'date_from':'".$cotisation->{date}."'}"}) - ) - ) - , $xml->xmlcmnt('pay_amount') - , $xml->value ({eval => "$cotisation->{amount}"}) - , $xml->xmlcmnt('pay_account_id') - , $xml->value ({model => "account.account", search => "[('name', '=', 'Cash')]"}) - , $xml->xmlcmnt("mean: $cotisation->{mean}") - , $xml->xmlcmnt('period_id') - , $xml->value ({model => "account.period", search => "[('name', '=', time.strftime('%m/%Y'))]"}) - , $xml->xmlcmnt('pay_journal_id') - , $xml->value ({model => "account.journal", search => "[('name', '=', 'Cash')]"}) - , $xml->xmlcmnt('writeoff_acc_id') - , $xml->value ({model => "account.account", search => "[('name', '=', 'Cash')]"}) - , $xml->xmlcmnt('writeoff_period_id') - , $xml->value ({model => "account.period", search => "[('name', '=', time.strftime('%m/%Y'))]"}) - , $xml->xmlcmnt('writeoff_journal_id') - , $xml->value ({model => "account.journal", search => "[('name', '=', 'Cash')]"}) - , $xml->xmlcmnt('context') - , $xml->value ({eval => "{}"}) - , $xml->xmlcmnt('name') - , $xml->value ({eval => "str('Import de paiement automatique')"}) - ); - } - } - -sub main () { - my $csv = Text::CSV->new - ({binary => 1 - , eol => $/ - , sep_char => ';' - }); - my $xml = XML::Generator->new - ( escape => 'always' - , conformance => 'strict' - , empty => 'self' - , pretty => 2 - ); - my $in = IO::Wrap::wraphandle(\*STDIN); - - my $csv_head = $csv->getline($in); - #print STDERR ("head: ", join("|", @$csv_head), "\n"); - #$csv->column_names(@$csv_head); - $csv->column_names (qw ( - number - cotisation_date - cotisation_amount - cotisation_mean - cotisation_discount - gender - firstname - name - birth - email - landline_phone - mobile_phone - street - zip - city - comment - )); - my $xml_data = []; - my $xml_data_noupdate = []; - my $csv_lines_rejected = []; - my $csv_lines_to_reparse = []; - my $members = {}; - while (my $csv_line = $csv->getline_hr($in)) { - #print STDERR ("csv_line: ", join("|", @$csv_line), "\n"); - member_of_csv_line($members, $csv_line, $csv_lines_rejected, $csv_lines_to_reparse); - } - print STDERR "csv_lines_to_reparse=".Data::Dumper::Dumper($csv_lines_to_reparse); - foreach my $csv_line (@$csv_lines_to_reparse) { - member_of_csv_line($members, $csv_line, $csv_lines_rejected, undef); - } - foreach my $number (sort {$a <=> $b} (keys %$members)) { - xml_of_member($xml, $members->{$number}, $xml_data, $xml_data_noupdate); - } - push @$xml_data_noupdate, $xml->record - ( { id => "remembership.member_ident_sequence" - , model => "ir.sequence" - } - , $xml->field({name => "number_next"}, $greatest_number + 1) - ); - binmode STDOUT, ':utf8'; - print $xml->openerp - ( $xml->data(@$xml_data) - , $xml->data - ( {noupdate => "1"} - , @$xml_data_noupdate ) - ); - - my $out = IO::Wrap::wraphandle(\*STDERR); - print STDERR "csv_lines_rejected=".Data::Dumper::Dumper($csv_lines_rejected); - } - -main; diff --git a/data/members.xml b/data/members.xml deleted file mode 120000 index 80cfc17..0000000 --- a/data/members.xml +++ /dev/null @@ -1 +0,0 @@ -../sec/data/members.xml \ No newline at end of file diff --git a/data/membership.xml b/data/membership.xml deleted file mode 100644 index e231e1c..0000000 --- a/data/membership.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - Standard member - 25.00 - 0.00 - - - service - - produce - True - True - - - Student member - 15.00 - 0.00 - - - service - - produce - True - True - - - Unemployed member - 15.00 - 0.00 - - - service - - produce - True - True - - - Retired member - 15.00 - 0.00 - - - service - - produce - True - True - - - Vélorution ÎdF member - 15.00 - 0.00 - - - service - - produce - True - True - - - diff --git a/data/partner.xml b/data/partner.xml deleted file mode 100644 index 0ede69d..0000000 --- a/data/partner.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - Organisation - - - Company - - - Association - - - - Bike workshop - - - - Member - - - diff --git a/data/product.xml b/data/product.xml deleted file mode 100644 index 5d36b44..0000000 --- a/data/product.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - Others - - - diff --git a/data/products_categories.xml b/data/products_categories.xml new file mode 100644 index 0000000..7d2d3a2 --- /dev/null +++ b/data/products_categories.xml @@ -0,0 +1,22 @@ + + + + + + + + Tous + + + + + Cotisations + + + + + Animations + + + + diff --git a/data/products_products.xml b/data/products_products.xml new file mode 100644 index 0000000..53596d9 --- /dev/null +++ b/data/products_products.xml @@ -0,0 +1,62 @@ + + + + + 1.0 + Autre produit + service + AP + + + + + + produce + + 15.0 + Cotisation individuelle + + 0.0 + + CI + + service + + + + produce + + 35.0 + Cotisation familliale + + 0.0 + + + CF + + service + + + + produce + 1.0 + Atelier d’auto-réparation + service + ATM + + + + + + produce + 1.0 + Formations + service + FOR + + + + + + + diff --git a/static/src/img/icon.png b/static/src/img/icon.png new file mode 100644 index 0000000..ded842d Binary files /dev/null and b/static/src/img/icon.png differ diff --git a/static/src/img/logo.png b/static/src/img/logo.png new file mode 100644 index 0000000..fa7169c Binary files /dev/null and b/static/src/img/logo.png differ diff --git a/view/members.xml b/view/members.xml index 9ac5a06..59d1c5e 100644 --- a/view/members.xml +++ b/view/members.xml @@ -1,17 +1,19 @@ - - - res.partner.form - res.partner - - - - - - - - - - - - + + + res.partner.form + res.partner + + + + 1 + + + + + + + + + +