Browse Source

Merge pull request #111 from beescoop/12.0-mig-beesdoo-inventory

[MIG] beesdoo_inventory: migrate to 12.0
pull/130/head
Rémy Taymans 5 years ago
committed by GitHub
parent
commit
efe029de84
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      beesdoo_inventory/__init__.py
  2. 30
      beesdoo_inventory/__manifest__.py
  3. 37
      beesdoo_inventory/i18n/fr_BE.po
  4. 1
      beesdoo_inventory/models/__init__.py
  5. 37
      beesdoo_inventory/models/stock.py
  6. 34
      beesdoo_inventory/views/stock.xml

1
beesdoo_inventory/__init__.py

@ -0,0 +1 @@
from . import models

30
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': [],
}

37
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"

1
beesdoo_inventory/models/__init__.py

@ -0,0 +1 @@
from . import stock

37
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

34
beesdoo_inventory/views/stock.xml

@ -0,0 +1,34 @@
<?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="scheduled_date" position="after">
<field name="max_shipping_date" placeholder="Max shipping date" />
</field>
<field name="backorder_id" position="after">
<field name="responsible" />
</field>
<button name="action_assign" position="after">
<button name="copy_qty" string="Copy Pack Quantity" states="partially_available,assigned" type="object" class="oe_highlight"
attrs="{'invisible': ['|', ('picking_type_code', '!=', 'incoming')]}"/>
</button>
<xpath expr="//field[@name='product_id']" position="attributes">
<attribute name="domain">[('main_seller_id', '=', parent.partner_id)]</attribute>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save