Browse Source

[MERGE][S0001] Fournisseur Principale

pull/7/head
Thibault Francois 9 years ago
parent
commit
865e4f19bc
  1. 4
      beesdoo_base/wizard/new_member_card.py
  2. 2
      beesdoo_product/__openerp__.py
  3. 13
      beesdoo_product/models/beesdoo_product.py
  4. 13
      beesdoo_product/views/beesdoo_product.xml
  5. 2
      beesdoo_purchase/__init__.py
  6. 31
      beesdoo_purchase/__openerp__.py
  7. 2
      beesdoo_purchase/models/__init__.py
  8. 1
      beesdoo_purchase/security/ir.model.access.csv
  9. 14
      beesdoo_purchase/views/purchase_order.xml

4
beesdoo_base/wizard/new_member_card.py

@ -3,8 +3,8 @@ from openerp import models, fields, api
class NewMemberCardWizard(models.TransientModel):
"""
A transient model for the creation of a new card.
The user can only define the raison why a new card is
A transient model for the creation of a new card.
The user can only define the raison why a new card is
needed and the eater/worker that is concerned.
"""
_name = 'membercard.new.wizard'

2
beesdoo_product/__openerp__.py

@ -20,7 +20,7 @@
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['beesdoo_base', 'product'],
'depends': ['beesdoo_base', 'product', 'point_of_sale'],
# always loaded
'data': [

13
beesdoo_product/models/beesdoo_product.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp.tools.translate import _
class BeesdooProduct(models.Model):
_inherit = "product.template"
@ -9,6 +10,18 @@ class BeesdooProduct(models.Model):
fair_label = fields.Many2one('beesdoo.product.label', domain = [('type', '=', 'fair')])
origin_label = fields.Many2one('beesdoo.product.label', domain = [('type', '=', 'delivery')])
main_seller_id = fields.Many2one('res.partner', compute='_compute_main_seller_id', store=True)
@api.one
@api.depends('seller_ids', 'seller_ids.date_start')
def _compute_main_seller_id(self):
# Calcule le vendeur associé qui a la date de début la plus récente et plus petite qu’aujourd’hui
sellers_ids = self.seller_ids.sorted(key=lambda seller: seller.date_start, reverse=True)
print sellers_ids
self.main_seller_id = sellers_ids and sellers_ids[0].name or False
class BeesdooProductLabel(models.Model):
_name = "beesdoo.product.label"

13
beesdoo_product/views/beesdoo_product.xml

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="beesdoo_product_form">
<field name="name">bees.product.template.form</field>
<field name="model">product.template</field>
@ -14,6 +16,17 @@
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_form2">
<field name="name">bees.product.template.form2</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<div name="weight" position="after">
<field name="main_seller_id" string="Fournisseur Principal" />
</div>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_label_form">
<field name="name">bees.product.label.form</field>
<field name="model">beesdoo.product.label</field>

2
beesdoo_purchase/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import models

31
beesdoo_purchase/__openerp__.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
{
'name': "Bees Purchase",
'summary': """
Extension du module Purchase""",
'description': """
Long description of module's purpose
""",
'author': "Beescoop - Cellule IT",
'website': "https://github.com/beescoop/Obeesdoo",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
'category': 'Purchase',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['purchase','beesdoo_product'],
# always loaded
'data': [
'views/purchase_order.xml',
'security/ir.model.access.csv',
],
# only loaded in demonstration mode
'demo': [],
}

2
beesdoo_purchase/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-

1
beesdoo_purchase/security/ir.model.access.csv

@ -0,0 +1 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink

14
beesdoo_purchase/views/purchase_order.xml

@ -0,0 +1,14 @@
<openerp>
<data>
<record model="ir.ui.view" id="beesdoo_purchase_order_form_view">
<field name="name">beesdoo.purchase.order.form.view</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="arch" type="xml">
<field name="product_id" position="attributes">
<attribute name="domain">[('main_seller_id','=', parent.partner_id)]</attribute>
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save