[13.0][MIG] stock_picking_auto_print

This commit is contained in:
Bhavesh Odedra
2020-04-02 22:25:00 +05:30
parent 1fcec0a73a
commit c07612da20
5 changed files with 24 additions and 10 deletions

View File

@@ -0,0 +1 @@
../../../../stock_picking_auto_print

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -5,12 +5,12 @@
{
"name": "Direct Print",
"summary": "Auto print when DO is ready",
"version": "11.0.1.0.0",
"version": "13.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Generic Modules/Base",
"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"],
"maintainers": ["bodedra"],
"installable": True,

View File

@@ -2,7 +2,7 @@
# Copyright (C) 2019 Open Source Integrators
# 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):
@@ -41,7 +41,6 @@ class StockPicking(models.Model):
)
return report_id
@api.multi
def _stock_picking_default_auto_print_report(self):
user_company_id = self.env.user.company_id.id
report_action_pool = self.env["ir.actions.report"]
@@ -78,18 +77,16 @@ class StockPicking(models.Model):
try:
action_report.print_document(picking.id)
except:
except Exception:
pass
return True
@api.multi
def write(self, vals):
res = super(StockPicking, self).write(vals)
if "date_done" in vals:
self._stock_picking_default_auto_print_report()
return res
@api.multi
def action_assign(self):
res = super(StockPicking, self).action_assign()
for picking in self:

View File

@@ -11,9 +11,19 @@ class StockPikcing(TransactionCase):
self.stock_location = self.env.ref("stock.stock_location_stock")
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(
{
@@ -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):
""" Auto print when DO is ready or done