Browse Source
Merge pull request #85 from coopiteasy/12.0-mig-easy_my_coop_eater
[12.0] [MIG] easy_my_coop_eater
pull/103/head
Rémy Taymans
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
0 additions and
72 deletions
-
easy_my_coop_eater/__init__.py
-
easy_my_coop_eater/__manifest__.py
-
easy_my_coop_eater/models/coop.py
-
easy_my_coop_eater/models/product.py
-
easy_my_coop_eater/view/product_view.xml
|
@ -1 +0,0 @@ |
|
|
from . import models |
|
|
|
|
@ -1,17 +0,0 @@ |
|
|
# Copyright 2013-2017 Open Architects Consulting SPRL. |
|
|
|
|
|
# Copyright 2018- Coop IT Easy SCRLfs |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
{ |
|
|
|
|
|
"name": "Easy My Coop Eater/worker", |
|
|
|
|
|
"version": "12.0.1.0.0", |
|
|
|
|
|
"depends": ["easy_my_coop", "partner_age"], |
|
|
|
|
|
"author": "Coop IT Easy SCRLfs", |
|
|
|
|
|
"license": "AGPL-3", |
|
|
|
|
|
"category": "Cooperative management", |
|
|
|
|
|
"website": "https://coopiteasy.be", |
|
|
|
|
|
"summary": """ |
|
|
|
|
|
This module allows to manage the activity of the cooperator in the supermarket. |
|
|
|
|
|
""", |
|
|
|
|
|
"data": ["view/product_view.xml"], |
|
|
|
|
|
"installable": True, |
|
|
|
|
|
} |
|
|
|
|
@ -1,29 +0,0 @@ |
|
|
from odoo import api, models |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SubscriptionRequest(models.Model): |
|
|
|
|
|
_inherit = "subscription.request" |
|
|
|
|
|
|
|
|
|
|
|
def get_eater_vals(self, partner, share_product_id): |
|
|
|
|
|
vals = {} |
|
|
|
|
|
eater = share_product_id.eater |
|
|
|
|
|
|
|
|
|
|
|
if partner.is_company or partner.age < 18: |
|
|
|
|
|
eater = "eater" |
|
|
|
|
|
|
|
|
|
|
|
vals["eater"] = eater |
|
|
|
|
|
|
|
|
|
|
|
return vals |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
def validate_subscription_request(self): |
|
|
|
|
|
self.ensure_one() |
|
|
|
|
|
invoice = super( |
|
|
|
|
|
SubscriptionRequest, self |
|
|
|
|
|
).validate_subscription_request()[0] |
|
|
|
|
|
partner = invoice.partner_id |
|
|
|
|
|
|
|
|
|
|
|
vals = self.get_eater_vals(partner, self.share_product_id) |
|
|
|
|
|
partner.write(vals) |
|
|
|
|
|
|
|
|
|
|
|
return invoice |
|
|
|
|
@ -1,10 +0,0 @@ |
|
|
from odoo import fields, models |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProductTemplate(models.Model): |
|
|
|
|
|
_inherit = "product.template" |
|
|
|
|
|
|
|
|
|
|
|
eater = fields.Selection( |
|
|
|
|
|
[("eater", "Eater"), ("worker_eater", "Worker and Eater")], |
|
|
|
|
|
string="Eater/Worker", |
|
|
|
|
|
) |
|
|
|
|
@ -1,15 +0,0 @@ |
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
|
|
<odoo> |
|
|
|
|
|
<record id="product_template_form_view_eater" model="ir.ui.view"> |
|
|
|
|
|
<field name="name">product.template.share.form</field> |
|
|
|
|
|
<field name="model">product.template</field> |
|
|
|
|
|
<field name="inherit_id" |
|
|
|
|
|
ref="easy_my_coop.product_template_share_form_view"/> |
|
|
|
|
|
<field name="arch" type="xml"> |
|
|
|
|
|
<xpath expr="//field[@name='minimum_quantity']" position="after"> |
|
|
|
|
|
<field name="eater" |
|
|
|
|
|
attrs="{'invisible':[('is_share','=',False)]}"/> |
|
|
|
|
|
</xpath> |
|
|
|
|
|
</field> |
|
|
|
|
|
</record> |
|
|
|
|
|
</odoo> |
|
|
|