-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'refs/pull/143/head' of github.com:acsone/acsone-addons …
…into 10.0-abi_master
- Loading branch information
Showing
25 changed files
with
901 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=============== | ||
POS Cagnotte Coupon | ||
=============== | ||
|
||
This module add the possibility to buy/use coupon in Point of sale. | ||
|
||
Installation | ||
============ | ||
|
||
At the moment, this modules depends on: | ||
- https://github.com/odoo/odoo/pull/17580 | ||
- https://github.com/odoo/odoo/pull/17596 | ||
- https://github.com/odoo/odoo/pull/17598 | ||
|
||
Credits | ||
======= | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://www.acsone.eu/logo.png | ||
:alt: ACSONE SA/NV | ||
:target: https://www.acsone.eu | ||
|
||
This module is maintained by ACSONE SA/NV. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
'name': "POS Cagnotte Coupon", | ||
'version': '10.0.1.0.0', | ||
'author': 'Acsone SA/NV', | ||
'category': "Point Of Sale,Accounting & Finance", | ||
'website': 'http://www.acsone.eu', | ||
'depends': [ | ||
'cagnotte_coupon', | ||
'point_of_sale' | ||
], | ||
'data': [ | ||
'views/account_bank_statement.xml', | ||
'views/cagnotte_type.xml', | ||
'views/pos_order.xml', | ||
'views/pos_template.xml', | ||
], | ||
'qweb': [ | ||
'static/src/xml/pos.xml', | ||
], | ||
'license': 'AGPL-3', | ||
'installable': True, | ||
'application': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * pos_cagnotte_coupon | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-12-08 17:27+0000\n" | ||
"PO-Revision-Date: 2015-12-08 17:27+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#: field:account.cagnotte,account_bank_statement_line_ids:0 | ||
#: model:ir.model,name:pos_cagnotte_coupon.model_account_bank_statement | ||
msgid "Bank Statement" | ||
msgstr "Relevé bancaire" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#: model:ir.model,name:pos_cagnotte_coupon.model_account_bank_statement_line | ||
msgid "Bank Statement Line" | ||
msgstr "Ligne de relevé bancaire" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#: field:account.bank.statement.line,account_cagnotte_id:0 | ||
#: field:pos.order.line,account_cagnotte_id:0 | ||
msgid "Cagnotte" | ||
msgstr "Cagnotte" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#. openerp-web | ||
#: code:addons/pos_cagnotte_coupon/static/src/js/main.js:64 | ||
#, python-format | ||
msgid "Cagnotte without coupon" | ||
msgstr "Cagnotte sans coupon" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#. openerp-web | ||
#: code:addons/pos_cagnotte_coupon/static/src/xml/pos.xml:22 | ||
#, python-format | ||
msgid "Cancel" | ||
msgstr "Annuler" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#. openerp-web | ||
#: code:addons/pos_cagnotte_coupon/static/src/js/main.js:120 | ||
#, python-format | ||
msgid "Coupon not usable" | ||
msgstr "Coupon non utilisable" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#: model:ir.model,name:pos_cagnotte_coupon.model_account_journal | ||
msgid "Journal" | ||
msgstr "Journal" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#: model:ir.model,name:pos_cagnotte_coupon.model_pos_order_line | ||
msgid "Lines of Point of Sale" | ||
msgstr "Lignes de Points de Vente" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#: model:ir.model,name:pos_cagnotte_coupon.model_pos_order | ||
msgid "Point of Sale" | ||
msgstr "Point de Vente" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#. openerp-web | ||
#: code:addons/pos_cagnotte_coupon/static/src/xml/pos.xml:7 | ||
#: code:addons/pos_cagnotte_coupon/static/src/xml/pos.xml:17 | ||
#, python-format | ||
msgid "Set Coupon Code" | ||
msgstr "Mettre un code coupon" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#. openerp-web | ||
#: code:addons/pos_cagnotte_coupon/static/src/js/main.js:121 | ||
#, python-format | ||
msgid "The coupon code is not usable" | ||
msgstr "Le code coupon n'est pas utilisable" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#. openerp-web | ||
#: code:addons/pos_cagnotte_coupon/static/src/xml/pos.xml:19 | ||
#, python-format | ||
msgid "Validate" | ||
msgstr "Valider" | ||
|
||
#. module: pos_cagnotte_coupon | ||
#. openerp-web | ||
#: code:addons/pos_cagnotte_coupon/static/src/js/main.js:65 | ||
#, python-format | ||
msgid "You cannot use cagnotte without a coupon." | ||
msgstr "Vous ne pouvez pas utiliser une cagnotte sans coupon" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import account_bank_statement_line | ||
from . import account_cagnotte | ||
from . import account_journal | ||
from . import cagnotte_type | ||
from . import pos_order | ||
from . import pos_order_line | ||
from . import product_product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class AccountBankStatementLine(models.Model): | ||
_inherit = 'account.bank.statement.line' | ||
|
||
account_cagnotte_id = fields.Many2one( | ||
comodel_name='account.cagnotte', string="Cagnotte") | ||
|
||
@api.multi | ||
def _prepare_reconciliation_move_line(self, move, amount): | ||
self.ensure_one() | ||
values = super(AccountBankStatementLine, self).\ | ||
_prepare_reconciliation_move_line(move, amount) | ||
account_cagnotte = self.account_cagnotte_id | ||
if account_cagnotte: | ||
values['account_cagnotte_id'] = account_cagnotte.id | ||
return values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class AccountCagnotte(models.Model): | ||
_inherit = 'account.cagnotte' | ||
|
||
account_bank_statement_line_ids = fields.One2many( | ||
comodel_name='account.bank.statement.line', | ||
inverse_name='account_cagnotte_id', | ||
string="Bank Statement") | ||
|
||
@api.multi | ||
@api.depends( | ||
'account_bank_statement_line_ids.journal_entry_ids', | ||
'account_bank_statement_line_ids.amount') | ||
def _compute_solde_cagnotte(self): | ||
super(AccountCagnotte, self)._compute_solde_cagnotte() | ||
for rec in self: | ||
solde_cagnotte = rec.solde_cagnotte | ||
# remove amount of statement not done | ||
for bs_line in rec.account_bank_statement_line_ids: | ||
if not bs_line.journal_entry_ids: | ||
solde_cagnotte -= bs_line.amount | ||
rec.solde_cagnotte = solde_cagnotte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class AccountJournal(models.Model): | ||
_inherit = 'account.journal' | ||
|
||
has_cagnotte = fields.Boolean(compute='_compute_has_cagnotte') | ||
check_cagnotte_amount = fields.Boolean( | ||
compute='_compute_check_cagnotte_amount') | ||
|
||
@api.multi | ||
def _compute_has_cagnotte(self): | ||
CagnotteTypeObj = self.env['cagnotte.type'] | ||
for journal in self: | ||
cagnotte_type_count = CagnotteTypeObj.search_count([ | ||
('journal_id', '=', journal.id), | ||
('with_coupon_code', '=', True) | ||
]) | ||
journal.has_cagnotte = cagnotte_type_count > 0 | ||
|
||
@api.multi | ||
def _compute_check_cagnotte_amount(self): | ||
CagnotteTypeObj = self.env['cagnotte.type'] | ||
for journal in self: | ||
cagnotte_type_count = CagnotteTypeObj.search_count([ | ||
('journal_id', '=', journal.id), | ||
('with_coupon_code', '=', True), | ||
('check_cagnotte_amount', '=', True) | ||
]) | ||
journal.check_cagnotte_amount = cagnotte_type_count > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields | ||
|
||
|
||
class CagnotteType(models.Model): | ||
_inherit = 'cagnotte.type' | ||
|
||
check_cagnotte_amount = fields.Boolean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, api | ||
|
||
|
||
class PosOrder(models.Model): | ||
_inherit = 'pos.order' | ||
|
||
def _get_account_move_line_product_key(self, values): | ||
product_key = super(PosOrder, self).\ | ||
_get_account_move_line_product_key(values) | ||
account_cagnotte_id = values.get('account_cagnotte_id') | ||
if account_cagnotte_id: | ||
product_key += (values.get('account_cagnotte_id'), ) | ||
return product_key | ||
|
||
@api.model | ||
def _payment_fields(self, ui_paymentline): | ||
res = super(PosOrder, self)._payment_fields(ui_paymentline) | ||
res['account_cagnotte_id'] = ui_paymentline.get('account_cagnotte_id') | ||
return res | ||
|
||
@api.multi | ||
def _prepare_statement_line_payment_values(self, data): | ||
values = super(PosOrder, self).\ | ||
_prepare_statement_line_payment_values(data) | ||
values['account_cagnotte_id'] = data.get('account_cagnotte_id') | ||
return values | ||
|
||
@api.model | ||
def _prepare_product_account_move_line(self, line, partner_id, account_id): | ||
values = super(PosOrder, self)._prepare_product_account_move_line( | ||
line, partner_id, account_id) | ||
if not values.get('account_cagnotte_id'): | ||
values['account_cagnotte_id'] = getattr( | ||
line.account_cagnotte_id, 'id', False) | ||
return values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class PosOrderLine(models.Model): | ||
|
||
_inherit = 'pos.order.line' | ||
|
||
coupon_code = fields.Char() | ||
account_cagnotte_id = fields.Many2one( | ||
comodel_name='account.cagnotte', string="Cagnotte") | ||
|
||
@api.model | ||
def create(self, values): | ||
if values.get('product_id') and not values.get('account_cagnotte_id'): | ||
cagnotte_type = self.env['cagnotte.type'].search( | ||
[('product_id', '=', values['product_id'])]) | ||
if cagnotte_type: | ||
# create cagnotte | ||
cagnotte_vals = {'cagnotte_type_id': cagnotte_type.id} | ||
if values.get('coupon_code'): | ||
cagnotte_vals['coupon_code'] = values['coupon_code'] | ||
values['account_cagnotte_id'] = \ | ||
self.env['account.cagnotte'].create(cagnotte_vals).id | ||
res = super(PosOrderLine, self).create(values) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class ProductProduct(models.Model): | ||
|
||
_inherit = 'product.product' | ||
|
||
has_cagnotte = fields.Boolean(compute='_compute_has_cagnotte') | ||
|
||
@api.multi | ||
def _compute_has_cagnotte(self): | ||
CagnotteTypeObj = self.env['cagnotte.type'] | ||
for product in self: | ||
cagnotte_type_count = CagnotteTypeObj.search_count([ | ||
('product_id', '=', product.id), | ||
('with_coupon_code', '=', True) | ||
]) | ||
product.has_cagnotte = cagnotte_type_count > 0 |
Oops, something went wrong.