Skip to content

Commit

Permalink
FJG: merge awesomefoodcoops/9.0 cd42c279612a7d1b94be9a932d5a1676404e18d6
Browse files Browse the repository at this point in the history
  • Loading branch information
fjg committed Jan 28, 2021
1 parent 22a95b8 commit 02644b4
Show file tree
Hide file tree
Showing 99 changed files with 8,683 additions and 2,765 deletions.
18 changes: 11 additions & 7 deletions coop_badge_reader/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,21 @@ def action_grace_partner(self):
be the next shift time
'''
self.ensure_one()

current_extension = self.extension_ids.filtered('current_extension')

if current_extension:
return current_extension.date_stop

# Only grace extensions for suspended user with no extension
if self.cooperative_state != 'suspended' or \
(self.extension_ids and any(self.extension_ids.mapped(
'current_extension'))):
if self.cooperative_state != 'suspended':
return False

shift_ext_env = self.env['shift.extension']
ext_type_env = self.env['shift.extension.type']
date_start_str = fields.Date.context_today(self)
grace_ext_type = ext_type_env.search([('is_grace_period', '=', True)],
limit=1)
grace_ext_type = ext_type_env.sudo().search([
('is_grace_period', '=', True)], limit=1)

if not grace_ext_type:
return False
Expand All @@ -131,13 +135,13 @@ def action_grace_partner(self):
next_shift_date or date_stop_str

# Create extension
shift_ext_env.create({
res = shift_ext_env.sudo().create({
'date_start': date_start_str,
'date_stop': date_stop_str,
'partner_id': self.id,
'type_id': grace_ext_type.id
})
return True
return res.date_stop

@api.multi
def set_badge_distributed(self):
Expand Down
7 changes: 7 additions & 0 deletions coop_badge_reader/static/www/controllers/c_partner_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ angular.module('starter').controller('PartnerFormCtrl', ['$scope', '$state', '$
$document[0].getElementById('sound_res_partner_' + partner_res.bootstrap_cooperative_state).play();
$scope.partner = partner_res;
$scope.contact_us_message = $sce.trustAsHtml(partner_res.contact_us_message);
if (partner_res.cooperative_state == 'delay' && grace_result) {
var date_stop_str = grace_result.slice(8, 10) + '/' + grace_result.slice(5, 7) + '/' + grace_result.slice(0, 4);
$scope.warning_message = $sce.trustAsHtml("Un délai de grâce jusqu'a " + date_stop_str + " ou jusqu'à votre prochain service vous a été attribué. Vous pouvez faire vos courses !");
} else if (partner_res.cooperative_state == 'suspended') {
console.log(partner_res)
$scope.fail_message = $sce.trustAsHtml("Nous n'avons pas pu vous attribuer de délai de grâce, vous devez rattraper vos services avant de faire vos courses.")
}
});
});
}
Expand Down
1 change: 1 addition & 0 deletions coop_badge_reader/static/www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ div.jumbotron{
.img-badge-partner-form{
width: 280px;
height: 280px;
object-fit: contain;
}

.img-partner-list{
Expand Down
8 changes: 7 additions & 1 deletion coop_badge_reader/static/www/views/v_partner_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ <h3>Peut acheter :
<h3 style="display: none;">
<span class="label label-danger" ng-show="partner.badge_to_distribute">Badge à distribuer</span>
</h3>
<h3 style="text-align: left; margin-top: 20px;">
<h3 ng-show="warning_message" class="text-warning" style="text-align: left; margin-top: 20px;">
<span ng-bind-html="warning_message"></span>
</h3>
<h3 ng-show="fail_message" class="text-danger" style="text-align: left; margin-top: 20px;">
<span ng-bind-html="fail_message"></span>
</h3>
<h3 ng-show="contact_us_message" style="text-align: left; margin-top: 20px;">
<span ng-bind-html="contact_us_message"></span>
</h3>
</div>
Expand Down
6 changes: 6 additions & 0 deletions coop_default_pricetag/data/pricetag_model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
<field name="report_model">coop_default_pricetag.report_pricetag_barcode</field>
</record>

<record id="pricetag_model_simple_barcode" model="pricetag.model">
<field name="name">Pricetag Barcode</field>
<field name="pricetag_paperformat_id" ref="coop_default_pricetag.paperformat_pricetag"/>
<field name="report_model">coop_default_pricetag.report_pricetag_simple_barcode</field>
</record>

</odoo>
7 changes: 6 additions & 1 deletion coop_default_pricetag/model/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from openerp import api, fields, models, _
from openerp.exceptions import UserError
import openerp.addons.decimal_precision as dp


class ProductTemplate(models.Model):
Expand Down Expand Up @@ -101,7 +102,11 @@ def _compute_pricetag_rackinfos(self):
'Mercuriale Product', help="A product in mercuriale has price"
" that changes very regularly.")

weight_net = fields.Float('Net Weight', default=0)
weight_net = fields.Float(
'Net Weight',
digits=dp.get_precision('Stock Weight'),
default=0,
)

price_volume = fields.Char(
compute='_compute_price_volume', string='Price by liter')
Expand Down
16 changes: 16 additions & 0 deletions coop_default_pricetag/report/coop_custom_product_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,20 @@
<field name="attachment_use" eval="0"/>
</record>

<!-- barcode -->
<report
id="pricetag_simple_barcode"
model="report.pricetag"
string="Small Pricetags with Barcode"
report_type="qweb-pdf"
name="coop_default_pricetag.report_pricetag_simple_barcode"
file="coop_default_pricetag.report_pricetag_simple_barcode"
attachment_use="False"
/>

<record id="coop_default_pricetag.pricetag_simple_barcode" model="ir.actions.report.xml">
<field name="paperformat_id" ref="coop_default_pricetag.paperformat_pricetag"/>
<field name="attachment_use" eval="0"/>
</record>

</odoo>
5 changes: 5 additions & 0 deletions coop_default_pricetag/report/report_pricetag.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ class ReportPricetag(models.AbstractModel):
class ReportPricetagBarcode(models.AbstractModel):
_name = 'report.coop_default_pricetag.report_pricetag_barcode'
_inherit = 'report.coop_default_pricetag.report_pricetag_base'


class ReportPricetagSimpleBarcode(models.AbstractModel):
_name = 'report.coop_default_pricetag.report_pricetag_simple_barcode'
_inherit = 'report.coop_default_pricetag.report_pricetag_base'
43 changes: 42 additions & 1 deletion coop_default_pricetag/report/report_pricetag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@
</div>
<div class="label_bottom">
<div class="product_shelf_origin">
<t name="pricetag_origine" t-if="product['product'].pricetag_origin">Origine: <t t-esc="product['product'].pricetag_origin"/><br/></t>
<t name="pricetag_origine" t-if="product['product'].pricetag_origin">Origine: <t t-esc="product['product'].pricetag_origin"/></t>
</div>
<div class="product_shelf_rackinfo_barcode">
<t t-if="product['product'].pricetag_rackinfos"><t t-esc="product['product'].pricetag_rackinfos"/></t>
<img t-if="product['product'].barcode" class="barcode_image" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product['product'].barcode, 200, 40)"/>
</div>
<div style="text-align:center;" t-if="product['product'].barcode">
<span t-field="product['product'].barcode" />
</div>
<div class="pricetag_shelf_coopinfos">
<t t-if="product['product'].pricetag_coopinfos"><t t-esc="product['product'].pricetag_coopinfos"/> </t>
</div>
Expand All @@ -94,4 +97,42 @@
</t>
</template>

<!-- Simple Barcode -->
<template id="report_pricetag_simple_barcode">
<t t-call="report.html_container">
<div class="page">
<t t-foreach="Products" t-as="product">
<t t-foreach="product['line'].quantity" t-as="q">
<div class="sblabel_container">
<div class="pricetag pricetag-barcode">
<div class="sblabel_top">
<div class="product_name">
<t t-esc="product['product'].name"/>
</div>
</div>
<div class="sb_weight_price">
<div class="sblabel_left">
<t t-if="product['product'].weight_net"><t t-esc="product['product'].weight_net"/> kg <br/>
<t t-esc="product['product'].price_weight_net"/> €/kg<br/></t>
</div>
<div class="sblabel_right">
<t t-esc="'%0.2f' % (product['product'].list_price)"/>€
</div>
</div>
<div class="label_bottom">
<div class="product_shelf_rackinfo_barcode">
<img t-if="product['product'].barcode" class="simple_barcode_image" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product['product'].barcode, 200, 40)"/>
</div>
<div style="text-align:center;" t-if="product['product'].barcode">
<span t-field="product['product'].barcode" />
</div>
</div>
</div>
</div>
</t>
</t>
</div>
</t>
</template>

</odoo>
35 changes: 35 additions & 0 deletions coop_default_pricetag/static/src/css/pricetag.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,38 @@
.pricetag.pricetag-barcode .product_shelf_coopinfos {
height: 45%;
}
.sblabel_container{
page-break-inside: avoid;
width:4.5cm; height:3.45cm; float:left;
margin-left:0cm;
margin-right:0cm;
margin-top:0cm;
margin-bottom:0cm;
padding:0cm;
}
.pricetag.pricetag-barcode .product_shelf_rackinfo_barcode .simple_barcode_image {
padding: 0;
height: 25px;
width: 100%;
position: absolute;
right: 0;
top: -5px;
z-index: -9999;
}
.sb_weight_price{
width:100%; height:30%; float:left;
font-size: 10px;
}
.sb_weight_price .sblabel_left{
width:45%; height:12%; float:left;
text-align:left; font-size:11px;
}
.sb_weight_price .sblabel_right{
width:55%; height:30%; float:right;
text-align:right; font-size:22px; font-weight:bold;
margin-right:0.4cm;
}
.sblabel_top{
width:100%; height:21%; float:left;
margin-bottom:0.2cm;
}
5 changes: 3 additions & 2 deletions coop_membership/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


{
'name': 'Coop - Membership',
'version': '9.0.2.0.0',
'version': '9.0.3.0.0',
'category': 'Custom',
'summary': 'Custom settings for membership',
'author': 'La Louve',
Expand All @@ -28,6 +27,7 @@
'create_users_partners',
'l10n_fr_pos_cert_base',
'purchase_discount',
'hr_skill',
],
'data': [
'data/update_template_name_ftop.yml',
Expand Down Expand Up @@ -80,6 +80,7 @@
'views/view_shift_credit_config.xml',
'views/action.xml',
'views/menu.xml',
'views/shift_template_operation.xml',

'report/member_contract_template.xml',

Expand Down
5 changes: 0 additions & 5 deletions coop_membership/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,6 @@ def subscribe_discovery_meeting(self, **post):
# (6, 0, (contract.ids))]
template_email.sudo().send_mail(attendee_id)

template_email_confirm = request.env.ref(
'coop_membership.registration_confirm_meeting_email')
if template_email_confirm:
template_email_confirm.sudo().send_mail(attendee_id)

value = {
'website': website
}
Expand Down
23 changes: 0 additions & 23 deletions coop_membership/data/email_template_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,29 +268,6 @@ If you think there was a mistake or wish to subscribe to another team please con
</field>
</record>

<record id="registration_confirm_meeting_email" model="mail.template">
<field name="name">Registration Confirm Meeting Email</field>
<field name="model_id" ref="event.model_event_registration"/>
<field name="email_from">${(object.company_id.email or '')|safe}</field>
<field name="email_to" >${object.email|safe}</field>
<field name="lang">${(object.partner_id.lang)|safe}</field>
<field name="reply_to">${object.company_id.email|safe}</field>
<field name="subject">Your registration to a welcome meeting on ${object.convert_event_date_begin()} at ${object.get_time_meeting()}</field>
<field name="body_html"><![CDATA[
<p>Hello,</p>
<br/>
<p>You have just registered to a welcome meeting that will take place on ${object.convert_event_date_begin()} at ${object.get_time_meeting()}. Thanks for your interest in what we do!</p>
<p>The meeting will take place at this address ${object.get_address_meeting()}.</p>
<p>You should receive a reminder email three days before the meeting.</p>
<p>If you wish to cancel or postpone your attendance, please write to ${object.get_email_contact_meeting()}.</p>
<br/>
<p>See you soon at the co-op!</p>
<br />
<img src="/coop_membership/static/description/image_lalouve.png"/>
]]>
</field>
</record>

<record id="registration_reminder_meeting_email" model="mail.template">
<field name="name">Registration Reminder Meeting Email</field>
<field name="model_id" ref="event.model_event_registration"/>
Expand Down
Loading

0 comments on commit 02644b4

Please sign in to comment.