diff --git a/beesdoo_inventory/__init__.py b/beesdoo_inventory/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/beesdoo_inventory/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/beesdoo_inventory/__manifest__.py b/beesdoo_inventory/__manifest__.py new file mode 100644 index 0000000..1e8266b --- /dev/null +++ b/beesdoo_inventory/__manifest__.py @@ -0,0 +1,30 @@ +{ + 'name': "Beesdoo Inventory", + + 'summary': """ + Adds a responsible, a max shipping date and a button to copy quantity to + stock pickings.""", + + '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': '12.0.1.0.0', + + # any module necessary for this one to work correctly + 'depends': ['delivery', 'beesdoo_base'], + + # always loaded + 'data': [ + 'views/stock.xml' ], + + # only loaded in demonstration mode + 'demo': [], +} diff --git a/beesdoo_inventory/i18n/fr_BE.po b/beesdoo_inventory/i18n/fr_BE.po new file mode 100644 index 0000000..b2e4091 --- /dev/null +++ b/beesdoo_inventory/i18n/fr_BE.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * beesdoo_inventory +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-13 15:22+0000\n" +"PO-Revision-Date: 2016-11-13 15:22+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: beesdoo_inventory +#: model:ir.model.fields,field_description:beesdoo_inventory.field_stock_picking_max_shipping_date +msgid "End Shipping Date" +msgstr "End Shipping Date" + +#. module: beesdoo_inventory +#: model:ir.ui.view,arch_db:beesdoo_inventory.beesdoo_stock_form_view +msgid "Max shipping date" +msgstr "Max shipping date" + +#. module: beesdoo_inventory +#: model:ir.model.fields,field_description:beesdoo_inventory.field_stock_picking_responsible +msgid "Responsible" +msgstr "Responsable" + +#. module: beesdoo_inventory +#: model:ir.model,name:beesdoo_inventory.model_stock_picking +msgid "Transfer" +msgstr "Transfert" + diff --git a/beesdoo_inventory/models/__init__.py b/beesdoo_inventory/models/__init__.py new file mode 100644 index 0000000..12bab77 --- /dev/null +++ b/beesdoo_inventory/models/__init__.py @@ -0,0 +1 @@ +from . import stock diff --git a/beesdoo_inventory/models/stock.py b/beesdoo_inventory/models/stock.py new file mode 100644 index 0000000..0751215 --- /dev/null +++ b/beesdoo_inventory/models/stock.py @@ -0,0 +1,37 @@ +from odoo import _, api, fields, models + +class StockPicking(models.Model): + _inherit = 'stock.picking' + + max_shipping_date = fields.Datetime("End Shipping Date") + responsible = fields.Many2one('res.partner', string="Responsible", default=lambda self: self.env.user.partner_id.id) + + def _add_follower(self): + if(self.responsible): + types = self.env['mail.message.subtype'].search(['|',('res_model','=','stock.picking'),('name','=','Discussions')]) + if not self.env['mail.followers'].search([('res_id', '=', self.id), + ('res_model', '=', 'stock.picking'), + ('partner_id', '=', self.responsible.id)]): + 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 + + @api.multi + def copy_qty(self): + self.ensure_one() + for pack_operation in self.pack_operation_product_ids: + pack_operation.qty_done = pack_operation.product_qty + return True \ No newline at end of file diff --git a/beesdoo_inventory/views/stock.xml b/beesdoo_inventory/views/stock.xml new file mode 100644 index 0000000..f815e9d --- /dev/null +++ b/beesdoo_inventory/views/stock.xml @@ -0,0 +1,34 @@ + + + + beesdoo.stock.tree.view + stock.picking + + + + + + + + + + beesdoo.stock.form.view + stock.picking + + + + + + + + + + + [('main_seller_id', '=', parent.partner_id)] + + + +