mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[13.0][MIG] stock_picking_auto_print
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
../../../../stock_picking_auto_print
|
||||||
6
setup/stock_picking_auto_print/setup.py
Normal file
6
setup/stock_picking_auto_print/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
@@ -5,12 +5,12 @@
|
|||||||
{
|
{
|
||||||
"name": "Direct Print",
|
"name": "Direct Print",
|
||||||
"summary": "Auto print when DO is ready",
|
"summary": "Auto print when DO is ready",
|
||||||
"version": "11.0.1.0.0",
|
"version": "13.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
||||||
"category": "Generic Modules/Base",
|
"category": "Generic Modules/Base",
|
||||||
"website": "http://www.opensourceintegrators.com",
|
"website": "http://www.opensourceintegrators.com",
|
||||||
"depends": ["sale_stock", "base_report_to_printer", ],
|
"depends": ["sale_stock", "base_report_to_printer"],
|
||||||
"data": ["views/ir_action_report_view.xml"],
|
"data": ["views/ir_action_report_view.xml"],
|
||||||
"maintainers": ["bodedra"],
|
"maintainers": ["bodedra"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Copyright (C) 2019 Open Source Integrators
|
# Copyright (C) 2019 Open Source Integrators
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import api, models
|
from odoo import models
|
||||||
|
|
||||||
|
|
||||||
class StockPicking(models.Model):
|
class StockPicking(models.Model):
|
||||||
@@ -41,7 +41,6 @@ class StockPicking(models.Model):
|
|||||||
)
|
)
|
||||||
return report_id
|
return report_id
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _stock_picking_default_auto_print_report(self):
|
def _stock_picking_default_auto_print_report(self):
|
||||||
user_company_id = self.env.user.company_id.id
|
user_company_id = self.env.user.company_id.id
|
||||||
report_action_pool = self.env["ir.actions.report"]
|
report_action_pool = self.env["ir.actions.report"]
|
||||||
@@ -78,18 +77,16 @@ class StockPicking(models.Model):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
action_report.print_document(picking.id)
|
action_report.print_document(picking.id)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
res = super(StockPicking, self).write(vals)
|
res = super(StockPicking, self).write(vals)
|
||||||
if "date_done" in vals:
|
if "date_done" in vals:
|
||||||
self._stock_picking_default_auto_print_report()
|
self._stock_picking_default_auto_print_report()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def action_assign(self):
|
def action_assign(self):
|
||||||
res = super(StockPicking, self).action_assign()
|
res = super(StockPicking, self).action_assign()
|
||||||
for picking in self:
|
for picking in self:
|
||||||
|
|||||||
@@ -11,9 +11,19 @@ class StockPikcing(TransactionCase):
|
|||||||
|
|
||||||
self.stock_location = self.env.ref("stock.stock_location_stock")
|
self.stock_location = self.env.ref("stock.stock_location_stock")
|
||||||
self.customer_location = self.env.ref("stock.stock_location_customers")
|
self.customer_location = self.env.ref("stock.stock_location_customers")
|
||||||
self.scrapped_location = self.env.ref("stock.stock_location_scrapped")
|
stock_location_locations_virtual = self.env["stock.location"].create(
|
||||||
|
{"name": "Virtual Locations", "usage": "view", "posz": 1}
|
||||||
|
)
|
||||||
|
self.scrapped_location = self.env["stock.location"].create(
|
||||||
|
{
|
||||||
|
"name": "Scrapped",
|
||||||
|
"location_id": stock_location_locations_virtual.id,
|
||||||
|
"scrap_location": True,
|
||||||
|
"usage": "inventory",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
uom_unit = self.env.ref("product.product_uom_unit")
|
uom_unit = self.env.ref("uom.product_uom_unit")
|
||||||
|
|
||||||
self.product_A = self.env["product.product"].create(
|
self.product_A = self.env["product.product"].create(
|
||||||
{
|
{
|
||||||
@@ -55,7 +65,7 @@ class StockPikcing(TransactionCase):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.uom_unit = self.env.ref("product.product_uom_unit")
|
self.uom_unit = self.env.ref("uom.product_uom_unit")
|
||||||
|
|
||||||
def test_stock_picking_auto_print(self):
|
def test_stock_picking_auto_print(self):
|
||||||
""" Auto print when DO is ready or done
|
""" Auto print when DO is ready or done
|
||||||
|
|||||||
Reference in New Issue
Block a user