Commit c2afa838 by François C.

Merge branch 'dev_cooperatic' of…

Merge branch 'dev_cooperatic' of https://gl.cooperatic.fr/cooperatic-foodcoops/Odoo into dev_cooperatic
parents db1564c0 30e94f4c
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
], ],
'data': [ 'data': [
'static/src/xml/templates.xml', 'static/src/xml/templates.xml',
'data/ir_config_parameter_data.xml' 'data/ir_config_parameter_data.xml',
'views/product_template.xml',
], ],
'qweb': ['static/src/xml/label_print_button.xml'], 'qweb': ['static/src/xml/label_print_button.xml'],
'installable': True, 'installable': True,
......
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * cagette_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo 9.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: cagette_product
#: model:ir.model.fields,field_description:cagette_product.field_product_template_minimal_stock
msgid "Minimal stock"
msgstr "Stock minimum"
...@@ -27,6 +27,8 @@ import math ...@@ -27,6 +27,8 @@ import math
class ProductTemplate(models.Model): class ProductTemplate(models.Model):
_inherit = "product.template" _inherit = "product.template"
minimal_stock = fields.Integer(string="Minimal stock")
@api.constrains('barcode') @api.constrains('barcode')
def _check_barcode(self): def _check_barcode(self):
""" Vérification du code barre avant de sauvegarder une fiche article""" """ Vérification du code barre avant de sauvegarder une fiche article"""
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_lacagette_product_product" model="ir.ui.view">
<field name="name">template.minimal.stock.form</field>
<field name="model">product.template</field>
<field eval="7" name="priority"/>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<group name="group_lots_and_weight" position="inside">
<field name="minimal_stock" />
</group>
</field>
</record>
</odoo>
\ No newline at end of file
...@@ -56,11 +56,29 @@ class ResPartner(models.Model): ...@@ -56,11 +56,29 @@ class ResPartner(models.Model):
new_values['cooperative_state'] = p.target_status new_values['cooperative_state'] = p.target_status
if new_values['cooperative_state'] == "unsubscribed": if new_values['cooperative_state'] == "unsubscribed":
new_values['makeups_to_do'] = makeups_todo_after_unsubscribed new_values['makeups_to_do'] = makeups_todo_after_unsubscribed
new_values['final_' + p.shift_type + '_point'] = -2
if p.shift_type == 'standard': # Get points difference to set points to -2
new_values['display_std_points'] = -2 current_points = p['final_' + p.shift_type + '_point']
target_points = -2
points_diff = abs(current_points - target_points)
if points_diff != 0:
if current_points > target_points:
points_update = - points_diff
else: else:
new_values['display_ftop_points'] = -2 points_update = points_diff
data = {
'name': "Désinscription : passage à -2 pts",
'shift_id': False,
'type': p.shift_type,
'partner_id': p.id,
'point_qty': points_update
}
self.env['shift.counter.event'].create(data)
""" """
unlink model: "shift.template.registration" unlink model: "shift.template.registration"
to delete all future shifts linked to this coop. to delete all future shifts linked to this coop.
...@@ -73,16 +91,20 @@ class ResPartner(models.Model): ...@@ -73,16 +91,20 @@ class ResPartner(models.Model):
.search([('partner_id', '=', p.id), .search([('partner_id', '=', p.id),
('date_begin', '>', now)]): ('date_begin', '>', now)]):
sreg.unlink() sreg.unlink()
# Close extensions
# Close extensions
for ext in self.env['shift.extension']\ for ext in self.env['shift.extension']\
.search([('partner_id', '=', p.id), .search([('partner_id', '=', p.id),
('date_start', '<=', now), ('date_start', '<=', now),
('date_stop', '>=', now)]): ('date_stop', '>=', now)]):
ext.update({'date_stop': now}) ext.update({'date_stop': now})
try:
mail_template = self.env.ref('coop_membership.unsubscribe_email') mail_template = self.env.ref('coop_membership.unsubscribe_email')
if mail_template: if mail_template:
mail_template.send_mail(p.id) mail_template.send_mail(p.id)
except Exception as e:
_logger.error("run_process_target_status - send mail : %s - Process not interrupted", str(e))
p.update(new_values) p.update(new_values)
except Exception as e: except Exception as e:
_logger.error("run_process_target_status : %s", str(e)) _logger.error("run_process_target_status : %s", str(e))
...@@ -138,6 +160,8 @@ class ResPartner(models.Model): ...@@ -138,6 +160,8 @@ class ResPartner(models.Model):
def set_special_state(self, cr, uid, partner, context=None): def set_special_state(self, cr, uid, partner, context=None):
if partner['state'] == 'cancel_special':
partner['state'] = 'unsubscribed'
return self.write(cr, uid, [partner['id']], {'cooperative_state': partner['state']} , context=context) return self.write(cr, uid, [partner['id']], {'cooperative_state': partner['state']} , context=context)
def _write_state_change(self, state): def _write_state_change(self, state):
...@@ -146,7 +170,7 @@ class ResPartner(models.Model): ...@@ -146,7 +170,7 @@ class ResPartner(models.Model):
@api.multi @api.multi
def update(self, vals): def update(self, vals):
_logger.info("valeurs reçues pour update partner = %s", str(vals)) _logger.info("valeurs recues pour update partner = %s", str(vals))
state_to_record = "" state_to_record = ""
if 'cooperative_state' in vals: if 'cooperative_state' in vals:
state_to_record = vals['cooperative_state'] state_to_record = vals['cooperative_state']
...@@ -162,7 +186,7 @@ class ResPartner(models.Model): ...@@ -162,7 +186,7 @@ class ResPartner(models.Model):
@api.multi @api.multi
def write(self, vals): def write(self, vals):
_logger.info("valeurs reçues pour write partner = %s", str(vals)) _logger.info("valeurs recues pour write partner = %s", str(vals))
if 'cooperative_state' in vals: if 'cooperative_state' in vals:
self._write_state_change(vals['cooperative_state']) self._write_state_change(vals['cooperative_state'])
return super(ResPartner, self).write(vals) return super(ResPartner, self).write(vals)
......
...@@ -10,11 +10,11 @@ class ShiftCounterEvent(models.Model): ...@@ -10,11 +10,11 @@ class ShiftCounterEvent(models.Model):
def _update_partner_target_status(self, vals): def _update_partner_target_status(self, vals):
"""actions if point_qty is negative""" """actions when points are removed or added"""
conf = self.env['ir.config_parameter'] conf = self.env['ir.config_parameter']
suspension_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_suspended")) suspension_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_suspended"))
unsubscribe_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_unsubscribed")) unsubscribe_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_unsubscribed"))
if vals['point_qty'] < 0: if vals['point_qty'] != 0:
res_partner = self.env['res.partner'].search([('id', '=', vals['partner_id'])]) res_partner = self.env['res.partner'].search([('id', '=', vals['partner_id'])])
if res_partner: if res_partner:
p = res_partner[0] p = res_partner[0]
...@@ -36,13 +36,13 @@ class ShiftCounterEvent(models.Model): ...@@ -36,13 +36,13 @@ class ShiftCounterEvent(models.Model):
@api.model @api.model
def write(self, vals): def write(self, vals):
res = super(ShiftCounterEvent, self).write(vals) res = super(ShiftCounterEvent, self).write(vals)
_logger.info("Vals reçues = %s", str(vals)) _logger.info("Vals recues = %s", str(vals))
self._update_partner_target_status(vals) self._update_partner_target_status(vals)
return res return res
@api.model @api.model
def create(self, vals): def create(self, vals):
self._update_partner_target_status(vals) self._update_partner_target_status(vals)
_logger.info("Vals reçues creation = %s", str(vals)) _logger.info("Vals recues creation = %s", str(vals))
return super(ShiftCounterEvent, self).create(vals) return super(ShiftCounterEvent, self).create(vals)
...@@ -12,7 +12,7 @@ class ShiftTemplateRegistrationLine(models.Model): ...@@ -12,7 +12,7 @@ class ShiftTemplateRegistrationLine(models.Model):
def create(self, vals): def create(self, vals):
super_res = super(ShiftTemplateRegistrationLine, self.with_context( super_res = super(ShiftTemplateRegistrationLine, self.with_context(
dict(self.env.context, **{'creation_in_progress': True}))).create(vals) dict(self.env.context, **{'creation_in_progress': True}))).create(vals)
#_logger.info("valeurs reçues pour create shift.template.registration.line = %s", str(vals)) #_logger.info("valeurs recues pour create shift.template.registration.line = %s", str(vals))
if 'partner_id' in vals and 'shift_ticket_id' in vals: if 'partner_id' in vals and 'shift_ticket_id' in vals:
conf = self.env['ir.config_parameter'] conf = self.env['ir.config_parameter']
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<option value="">--Statuts spéciaux--</option> <option value="">--Statuts spéciaux--</option>
<option value="gone">Parti.e</option> <option value="gone">Parti.e</option>
<option value="associated">En binôme</option> <option value="associated">En binôme</option>
<option value="cancel_special">Annulation statut spécial</option>
</select> </select>
</field> </field>
</field> </field>
......
# -*- coding: utf-8 -*-
from . import models
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: BEES coop (<http://www.bees-coop.be/>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Beesdoo - Remove pos order line with quantity set to 0',
'version': '9.0.1.0.0',
'category': 'Custom',
'summary': 'Remove pos order line with quantity set to 0',
'description': """
This module fix the issue on picking when there is two lines on
the pos order for the same product, with one of lines with a 0 quantity.
The lines at 0 are removed before the pos order is processed to avoid
such issue.
""",
'author': 'BEES coop - Houssine BAKKALI',
'website': 'http://www.bees-coop.be',
'depends': [
'point_of_sale',
],
'data': [],
'installable': True,
}
# -*- coding: utf-8 -*-
from . import pos_order
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class PosOrder(models.Model):
_inherit = 'pos.order'
@api.model
def _process_order(self, order):
lines = order['lines']
order['lines'] = [l for l in lines if l[2]['qty'] !=0]
return super(PosOrder, self)._process_order(order)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment