Browse Source

S001

pull/3/head
EliseDup 9 years ago
parent
commit
fa68710b3b
  1. 2
      beesdoo_product/__openerp__.py
  2. 13
      beesdoo_product/models/beesdoo_product.py
  3. 5
      beesdoo_product/views/beesdoo_product.xml
  4. 2
      beesdoo_purchase/__init__.py
  5. 31
      beesdoo_purchase/__openerp__.py
  6. 3
      beesdoo_purchase/models/__init__.py
  7. 17
      beesdoo_purchase/models/purchase_order.py
  8. 1
      beesdoo_purchase/security/ir.model.access.csv
  9. 14
      beesdoo_purchase/views/purchase_order.xml

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

@ -8,7 +8,18 @@ class BeesdooProduct(models.Model):
local_label = fields.Many2one('beesdoo.product.label', domain = [('type', '=', 'local')])
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')
def _compute_main_seller_id(self):
# Ce champs doit être champs calculé qui va chercher
# le vendeur associé qui a la date de début la plus récente et plus petite qu’aujourd’hui
self.main_seller_id = sorted(self.seller_ids, key=lambda seller: seller.date_start, reverse=True)[0].name
class BeesdooProductLabel(models.Model):
_name = "beesdoo.product.label"

5
beesdoo_product/views/beesdoo_product.xml

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="beesdoo_product_form">
<record model="ir.ui.view" id="beesdoo_product_form">
<field name="name">bees.product.template.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view" />
@ -10,6 +12,7 @@
<field name="local_label" />
<field name="fair_label" />
<field name="origin_label" />
<field name="main_seller_id" string="Fournisseur Principal"/>
</field>
</field>
</record>

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': ['base','purchase','beesdoo_product'],
# always loaded
'data': [
'views/purchase_order.xml',
'security/ir.model.access.csv',
],
# only loaded in demonstration mode
'demo': [],
}

3
beesdoo_purchase/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
import purchase_order

17
beesdoo_purchase/models/purchase_order.py

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
product_id = fields.Many2one('product.product', string='Product',
domain=['&',('purchase_ok', '=', True),('template.main_seller_id','=','order_id.partner_id')], change_default=True, required=True)
@api.onchange('order_id')
def _onchange_order_id(self):
print "changed", self.order_id, self.order_id.partner_id

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>
</record>
-->
</data>
</openerp>
Loading…
Cancel
Save