diff --git a/beesdoo_purchase/__init__.py b/beesdoo_purchase/__init__.py new file mode 100644 index 0000000..0f7cb6b --- /dev/null +++ b/beesdoo_purchase/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +import models \ No newline at end of file diff --git a/beesdoo_purchase/__openerp__.py b/beesdoo_purchase/__openerp__.py new file mode 100644 index 0000000..283d686 --- /dev/null +++ b/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': [], +} \ No newline at end of file diff --git a/beesdoo_purchase/models/__init__.py b/beesdoo_purchase/models/__init__.py new file mode 100644 index 0000000..667b7e3 --- /dev/null +++ b/beesdoo_purchase/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import purchase_order \ No newline at end of file diff --git a/beesdoo_purchase/models/purchase_order.py b/beesdoo_purchase/models/purchase_order.py new file mode 100644 index 0000000..d9d41a5 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/beesdoo_purchase/security/ir.model.access.csv b/beesdoo_purchase/security/ir.model.access.csv new file mode 100644 index 0000000..58262d4 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/beesdoo_purchase/views/purchase_order.xml b/beesdoo_purchase/views/purchase_order.xml new file mode 100644 index 0000000..7db8df9 --- /dev/null +++ b/beesdoo_purchase/views/purchase_order.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file