Browse Source

[MERGE][TASK S0024] Bon de livraison : ajout d'info

pull/14/head
Thibault Francois 8 years ago
parent
commit
f5a9105d28
  1. 2
      beesdoo_inventory/__init__.py
  2. 31
      beesdoo_inventory/__openerp__.py
  3. 2
      beesdoo_inventory/models/__init__.py
  4. 28
      beesdoo_inventory/models/stock.py
  5. 29
      beesdoo_inventory/views/stock.xml

2
beesdoo_inventory/__init__.py

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

31
beesdoo_inventory/__openerp__.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
{
'name': "beesdoo_inventory",
'summary': """
Modification of inventory data for the needs of beescoop
- SOO24 - Bon de livraison""",
'description': """
""",
'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': 'Sales Management',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['delivery'],
# always loaded
'data': [
'views/stock.xml' ],
# only loaded in demonstration mode
'demo': [],
}

2
beesdoo_inventory/models/__init__.py

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

28
beesdoo_inventory/models/stock.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
class StockPicking(models.Model):
_inherit = 'stock.picking'
max_shipping_date = fields.Datetime("End Shipping Date")
responsible = fields.Many2one('res.partner', string="Responsible")
def _add_follower(self):
if(self.responsible):
types = self.env['mail.message.subtype'].search(['|',('res_model','=','stock.picking'),('name','=','Discussions')])
self.env['mail.followers'].create({'res_model' : 'stock.picking',
'res_id' : self.id,
'partner_id' : self.responsible.id,
'subtype_ids': [(6, 0, types.ids)]})
@api.multi
def write(self, values):
res = super(StockPicking, self).write(values)
self._add_follower()
return res
@api.model
def create(self, values):
picking = super(StockPicking, self).create(values)
picking._add_follower()
return picking

29
beesdoo_inventory/views/stock.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="beesdoo_stock_tree_view">
<field name="name">beesdoo.stock.tree.view</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="responsible" />
</field>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_stock_form_view">
<field name="name">beesdoo.stock.form.view</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml">
<field name="min_date" position="after">
<field name="max_shipping_date" placeholder="Max shipping date" />
</field>
<field name="backorder_id" position="after">
<field name="responsible" />
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save