Merge pull request #6 from savoirfairelinux/7.0_bill_of_lading_webkit

[ADD] stock_bill_of_lading_webkit: Module for print a Bill of Lading, which is a document issued by a carrier to a shipper of goods.
This commit is contained in:
Pedro M. Baeza
2014-08-04 21:30:28 +02:00
16 changed files with 823 additions and 25 deletions

View File

@@ -1,23 +1,24 @@
language: python
python:
- "2.7"
env:
- VERSION="7.0" ODOO_REPO="odoo/odoo"
- VERSION="7.0" ODOO_REPO="OCA/OCB"
virtualenv:
system_site_packages: true
install:
- git clone https://github.com/OCA/maintainer-quality-tools.git $HOME/maintainer-quality-tools
- export PATH=$HOME/maintainer-quality-tools/travis:$PATH
- $HOME/maintainer-quality-tools/travis/travis_install_nightly 7.0
- pip install coveralls flake8
- git clone https://github.com/OCA/webkit-tools -b 7.0 $HOME/webkit-tools
services:
- postgresql
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly ${VERSION}
- git clone https://github.com/OCA/webkit-tools ${HOME}/webkit-tools -b ${VERSION}
script:
- travis_run_flake8
- travis_run_tests 7.0 openerp_test $HOME/webkit-tools
- travis_run_flake8
- travis_run_tests ${VERSION} ${HOME}/webkit-tools
after_success:
coveralls

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import stock
from . import report

View File

@@ -0,0 +1,67 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
{
'name': 'Bill of Lading using Webkit Library',
'version': '1.0',
'category': 'Reports/Webkit',
'description': """
A Bill of Lading is a document issued by a carrier to a shipper of goods.
It is a negotiable instrument, and it serves three purposes:
- it is a receipt for the goods shipped;
- it evidences the contract of carriage;
- it serves as a document of title (i.e. ownership).
This document could be different from a Delivery Order as it has some legal
issues.
Two reports are provided in this module
- Bill of Lading for Delivey Orders;
- Bill of Lading for Incoming Shipment (the use-case is shipment from an
international Warehouse
to the local Warehouse).
This module also add a new field for a warehouse to pick form or deliver to;
this field will be used if the default warehouse_id is not set
(normally from a PO).
Contributors
------------
* Marc Cassuto (marc.cassuto@savoirfairelinux.com)
* Mathieu Benoit (mathieu.benoit@savoirfairelinux.com)
* Camptocamp with its original module stock_picking_webkit
""",
'author': 'Savoir-faire Linux',
'website': 'http://www.savoirfairelinux.com',
'depends': [
'base',
'report_webkit',
'base_headers_webkit',
'stock',
'delivery'
],
'data': ['report.xml', 'stock_view.xml'],
'installable': True,
'auto_install': False,
}

View File

@@ -0,0 +1,103 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * stock_bill_of_lading_webkit
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-09 15:06+0000\n"
"PO-Revision-Date: 2014-05-09 11:14-0500\n"
"Last-Translator: Marc Cassuto <marc.cassuto@savoirfairelinux.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:58
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:56
msgid "Origin"
msgstr "Origine"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:59
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:57
msgid "Scheduled Date"
msgstr "Date prévue"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:76
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:74
msgid "Description"
msgstr "Description"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:20
msgid "Ship to:"
msgstr "Livré à:"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:61
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:59
msgid "Delivery Method"
msgstr "Méthode de livraison"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:53
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:51
msgid "Delivery Order"
msgstr "Ordre de livraison"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:75
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:73
msgid "Item"
msgstr "Item"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:77
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:75
msgid "Serial Number"
msgstr "N° lot / N° série"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:57
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:55
msgid "Contact"
msgstr "Contact"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:78
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:76
msgid "Weight (kg)"
msgstr "Poids (kg)"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:40
msgid "Ship to :"
msgstr "Livré à:"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:79
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:77
msgid "Quantity"
msgstr "Quantité"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:21
msgid "From :"
msgstr "De :"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:60
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:58
msgid "Total Weight"
msgstr "Poid total"
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:38
msgid "Customer name & address:"
msgstr "Nom et adresse du client:"

View File

@@ -0,0 +1,103 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * stock_bill_of_lading_webkit
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-09 15:06+0000\n"
"PO-Revision-Date: 2014-05-09 15:06+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: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:58
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:56
msgid "Origin"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:59
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:57
msgid "Scheduled Date"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:76
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:74
msgid "Description"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:20
msgid "Ship to:"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:61
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:59
msgid "Delivery Method"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:53
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:51
msgid "Delivery Order"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:75
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:73
msgid "Item"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:77
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:75
msgid "Serial Number"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:57
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:55
msgid "Contact"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:78
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:76
msgid "Weight (kg)"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:40
msgid "Ship to :"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:79
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:77
msgid "Quantity"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:21
msgid "From :"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_in.mako:60
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:58
msgid "Total Weight"
msgstr ""
#. module: stock_bill_of_lading_webkit
#: report:addons/stock_bill_of_lading_webkit/report/bol_out.mako:38
msgid "Customer name & address:"
msgstr ""

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report id="stock.bill_of_lading_out"
name="webkit.bill_of_lading_out"
auto="False"
model="stock.picking.out"
file="stock_bill_of_lading_webkit/report/bol_out.mako"
string="Bill of Lading"
report_type="webkit"
header="True"
webkit_header="base_headers_webkit.base_reports_portrait_header"/>
<report id="stock.bill_of_lading_in"
name="webkit.bill_of_lading_in"
auto="False"
model="stock.picking.in"
file="stock_bill_of_lading_webkit/report/bol_in.mako"
string="Bill of Lading (Return of Products)"
report_type="webkit"
header="True"
webkit_header="base_headers_webkit.base_reports_portrait_header"/>
</data>
</openerp>

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import stock_report

View File

@@ -0,0 +1,106 @@
## -*- coding: utf-8 -*-
<html>
<head>
<style type="text/css">
${css}
</style>
</head>
<body>
<%page expression_filter="entity"/>
<%
def carriage_returns(text):
return text.replace('\n', '<br />')
%>
%for picking in objects:
<% setLang(picking.partner_id.lang) %>
<div class="address">
<%
warehouse_addr = warehouse_address(picking)
%>
<table class="recipient">
<tr><td class="address_title">${_("Ship to :")}</td></tr>
<tr><td class="name">${warehouse_addr.title and warehouse_addr.title.name or ''} ${warehouse_addr.name }</td></tr>
%if warehouse_addr.contact_address:
<% address_lines = warehouse_addr.contact_address.split("\n") %>
%for part in address_lines:
%if part:
<tr><td>${part}</td></tr>
%endif
%endfor
%endif
</table>
<table class="invoice">
%if picking.partner_id:
<tr><td class="address_title">${_("From :")}</td></tr>
%if picking.partner_id.parent_id:
<tr><td>${picking.partner_id.parent_id.name or ''}</td></tr>
<tr><td>${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
<% address_lines = picking.partner_id.contact_address.split("\n")[1:] %>
%else:
<tr><td class="name">${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
<% address_lines = picking.partner_id.contact_address.split("\n") %>
%endif
%for part in address_lines:
%if part:
<tr><td>${part}</td></tr>
%endif
%endfor
%endif
</table>
</div>
<h1 style="clear:both;">${_(u'Delivery Order') } ${picking.name}</h1>
<table class="basic_table" width="100%">
<tr>
<td style="font-weight:bold;">${_("Contact")}</td>
<td style="font-weight:bold;">${_("Origin")}</td>
<td style="font-weight:bold;">${_("Scheduled Date")}</td>
<td style="font-weight:bold;">${_('Total Weight')}</td>
<td style="font-weight:bold;">${_('Delivery Method')}</td>
</tr>
<tr>
<td>${user.name}</td>
<td>${picking.origin or ''}</td>
<td>${formatLang(picking.min_date, date=True)}</td>
<td>${picking.weight}</td>
<td>${picking.carrier_id and picking.carrier_id.name or ''}</td>
</tr>
</table>
<table class="list_sale_table" width="100%" style="margin-top: 20px;">
<thead>
<tr>
<th style="text-align:left; ">${_("Item")}</th>
<th style="text-align:left; ">${_("Description")}</th>
<th style="text-align:left; ">${_("Serial Number")}</th>
<th style="text-align:right; ">${_("Weight (kg)")}</th>
<th class="amount">${_("Quantity")}</th>
</tr>
</thead>
<tbody>
%for line in picking.move_lines:
<%
weight = line.product_id.weight * line.product_qty
%>
<tr class="line">
<td style="text-align:left; " >${ line.product_id.name }</td>
<td style="text-align:left; " >${ line.product_id.description or '' }</td>
<td style="text-align:left; " >${ line.prodlot_id and line.prodlot_id.name or ''}</td>
<td style="text-align:right; " >${ formatLang(weight) }</td>
<td class="amount" >${ formatLang(line.product_qty) } ${line.product_uom.name}</td>
</tr>
%endfor
</table>
<br/>
%if picking.note :
<p class="std_text">${picking.note | carriage_returns}</p>
%endif
<p style="page-break-after: always"/>
<br/>
%endfor
</body>
</html>

View File

@@ -0,0 +1,133 @@
## -*- coding: utf-8 -*-
<html>
<head>
<style type="text/css">
${css}
</style>
</head>
<body>
<%page expression_filter="entity"/>
<%
def carriage_returns(text):
return text.replace('\n', '<br />')
%>
%for picking in objects:
<% setLang(picking.partner_id.lang) %>
<div class="address">
<%
invoice_addr = invoice_address(picking)
%>
<table class="recipient">
<tr><td class="address_title">${_("Contact info:")}</td></tr>
%if invoice_addr.phone:
<tr><td><b>${_("Phone:")}</b> ${invoice_addr.phone }</td></tr>
%endif
%if invoice_addr.mobile:
<tr><td><b>${_("Cell:")}</b> ${invoice_addr.mobile }</td></tr>
%endif
%if invoice_addr.email:
<tr><td><b>${_("Email:")}</b> ${invoice_addr.email }</td></tr>
%endif
</table>
<table class="invoice">
<tr><td class="address_title">${_("Customer name & address:")}</td></tr>
<tr><td>${invoice_addr.title and invoice_addr.title.name or ''} ${invoice_addr.name }</td></tr>
%if invoice_addr.contact_address:
<% address_lines = invoice_addr.contact_address.split("\n") %>
%for part in address_lines:
%if part:
<tr><td>${part}</td></tr>
%endif
%endfor
%endif
</table>
</div>
<div class="address">
<%
picking_addr = picking_address(picking)
%>
<table class="recipient">
<tr><td class="address_title">${_("Ship to:")}</td></tr>
%if picking.partner_id.parent_id:
<tr><td>${picking.partner_id.parent_id.name or ''}</td></tr>
<tr><td>${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
<% address_lines = picking.partner_id.contact_address.split("\n")[1:] %>
%else:
<tr><td >${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
<% address_lines = picking.partner_id.contact_address.split("\n") %>
%endif
%for part in address_lines:
%if part:
<tr><td>${part}</td></tr>
%endif
%endfor
</table>
<table class="invoice">
<tr><td class="address_title">${_("Pick from:")}</td></tr>
<tr><td>${picking_addr.title and picking_addr.title.name or ''} ${picking_addr.name }</td></tr>
%if picking_addr.contact_address:
<% address_lines = picking_addr.contact_address.split("\n") %>
%for part in address_lines:
%if part:
<tr><td>${part}</td></tr>
%endif
%endfor
%endif
</table>
</div>
<h1 style="clear:both;">${_(u'Delivery Order') } ${picking.name}</h1>
<table class="basic_table" width="100%">
<tr>
<td style="font-weight:bold;">${_("Customer Ref")}</td>
<td style="font-weight:bold;">${_("Origin")}</td>
<td style="font-weight:bold;">${_("Scheduled Date")}</td>
<td style="font-weight:bold;">${_('Total Weight')}</td>
<td style="font-weight:bold;">${_('Delivery Method')}</td>
</tr>
<tr>
<td>${picking.sale_id.client_order_ref if picking.sale_id else ''}</td>
<td>${picking.origin or ''}</td>
<td>${formatLang(picking.min_date, date=True)}</td>
<td>${picking.weight}</td>
<td>${picking.carrier_id and picking.carrier_id.name or ''}</td>
</tr>
</table>
<table class="list_sale_table" width="100%" style="margin-top: 20px;">
<thead>
<tr>
<th style="text-align:left; ">${_("Item")}</th>
<th style="text-align:left; ">${_("Description")}</th>
<th style="text-align:left; ">${_("Serial Number")}</th>
<th style="text-align:right; ">${_("Weight (kg)")}</th>
<th class="amount">${_("Quantity")}</th>
</tr>
</thead>
<tbody>
%for line in picking.move_lines:
<%
weight = line.product_id.weight * line.product_qty
%>
<tr class="line">
<td style="text-align:left; " >${ line.product_id.name }</td>
<td style="text-align:left; " >${ line.product_id.description or ''}</td>
<td style="text-align:left; " >${ line.prodlot_id and line.prodlot_id.name or ''}</td>
<td style="text-align:right; " >${ formatLang(weight) }</td>
<td class="amount" >${ formatLang(line.product_qty) } ${line.product_uom.name}</td>
</tr>
%endfor
</table>
<br/>
%if picking.note :
<p class="std_text">${picking.note | carriage_returns}</p>
%endif
<p style="page-break-after: always"/>
<br/>
%endfor
</body>
</html>

View File

@@ -0,0 +1,95 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
# Copyright (c) 2013 Agile Business Group (http://www.agilebg.com)
# @author Lorenzo Battistini
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from report import report_sxw
import time
class BillOfLadingOut(report_sxw.rml_parse):
def _get_invoice_address(self, picking):
if picking.sale_id:
return picking.sale_id.partner_invoice_id
partner_obj = self.pool.get('res.partner')
invoice_address_id = picking.partner_id.address_get(
adr_pref=['invoice']
)['invoice']
return partner_obj.browse(
self.cr, self.uid, invoice_address_id)
def _get_picking_address(self, picking):
# By default, print the warehouse selected manually
if picking.manual_warehouse_id:
return picking.manual_warehouse_id.partner_id
# if not set, print the shipping address of the default company's
# warehouse
partner_obj = self.pool.get('res.partner')
warehouse_address_id = picking.company_id.partner_id.address_get(
adr_pref=['shipping']
)['shipping']
return partner_obj.browse(
self.cr, self.uid, warehouse_address_id)
def __init__(self, cr, uid, name, context):
super(BillOfLadingOut, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'invoice_address': self._get_invoice_address,
'picking_address': self._get_picking_address,
})
report_sxw.report_sxw('report.webkit.bill_of_lading_out',
'stock.picking',
'addons/stock_bill_of_lading_webkit/report/bol_out.mako',
parser=BillOfLadingOut)
class BillOfLadingIn(report_sxw.rml_parse):
def _get_warehouse_address(self, picking):
# By default, print the warehouse selected from the related
# purchase order
if picking.purchase_id:
return picking.purchase_id.warehouse_id.partner_id
# else, print the warehouse selected manually
if picking.manual_warehouse_id:
return picking.manual_warehouse_id.partner_id
# if none of the above, print the shipping address of the default
# company's warehouse
partner_obj = self.pool.get('res.partner')
warehouse_address_id = picking.company_id.partner_id.address_get(
adr_pref=['shipping']
)['shipping']
return partner_obj.browse(
self.cr, self.uid, warehouse_address_id)
def __init__(self, cr, uid, name, context):
super(BillOfLadingIn, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'warehouse_address': self._get_warehouse_address,
})
report_sxw.report_sxw('report.webkit.bill_of_lading_in',
'stock.picking',
'addons/stock_bill_of_lading_webkit/report/bol_in.mako',
parser=BillOfLadingIn)

View File

@@ -0,0 +1,70 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from openerp.osv import fields, orm
class StockPickingOutWarehouse(orm.Model):
_inherit = "stock.picking.out"
_columns = {
'manual_warehouse_id': fields.many2one(
'stock.warehouse',
'Picking from',
readonly=True,
states={
'draft': [('readonly', False)],
'confirmed': [('readonly', False)],
'assigned': [('readonly', False)],
}
),
}
class StockPickingInWarehouse(orm.Model):
_inherit = "stock.picking.in"
_columns = {
'manual_warehouse_id': fields.many2one(
'stock.warehouse',
'Deliver to',
readonly=True,
states={
'draft': [('readonly', False)],
'confirmed': [('readonly', False)],
'assigned': [('readonly', False)],
}
),
}
class StockPickingWarehouse(orm.Model):
_inherit = "stock.picking"
_columns = {
'manual_warehouse_id': fields.many2one(
'stock.warehouse',
'Warehouse',
readonly=True,
states={
'draft': [('readonly', False)],
'confirmed': [('readonly', False)],
'assigned': [('readonly', False)],
}
),
}

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_picking_warehouse_form" model="ir.ui.view">
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet/group/group[1]/field[last()]" position="after">
<field name="manual_warehouse_id" widget="selection" />
</xpath>
</field>
</record>
<record id="view_picking_warehouse_out_form" model="ir.ui.view">
<field name="model">stock.picking.out</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet/group/group[1]/field[last()]" position="after">
<field name="manual_warehouse_id" widget="selection" />
</xpath>
</field>
</record>
<record id="view_picking_warehouse_in_form" model="ir.ui.view">
<field name="model">stock.picking.in</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet/group/group[1]/field[last()]" position="after">
<field name="manual_warehouse_id" widget="selection" />
</xpath>
</field>
</record>
</data>
</openerp>

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
###############################################################################
#
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
@@ -17,6 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
###############################################################################
from . import report

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
###############################################################################
#
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
###############################################################################
{
'name': 'Picking reports using Webkit Library',
@@ -34,7 +34,11 @@ Three reports are provided:
""",
'author': 'Camptocamp',
'website': 'http://www.openerp.com',
'depends': ['base', 'report_webkit', 'base_headers_webkit', 'stock', 'delivery'],
'depends': ['base',
'report_webkit',
'base_headers_webkit',
'stock',
'delivery'],
'data': ['report.xml',
'stock_view.xml',
],

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
###############################################################################
#
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
@@ -17,5 +17,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
###############################################################################
import stock_report

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
###############################################################################
#
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
@@ -19,12 +19,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
import operator
from report import report_sxw
import pooler
import time
class NullMove(object):
"""helper class to generate empty lines in the delivery report"""
def __init__(self):
@@ -32,8 +34,10 @@ class NullMove(object):
self.picking_id = NullObj()
self.product_qty = ''
class NullObj(object):
"""the null obj has any attribute you want with an empty string as the value"""
"""the null obj has any attribute you want with an empty string
as the value"""
def __getattr__(self, attr):
return ''
@@ -52,11 +56,14 @@ class PickingAgregation(object):
return hash((self.src_stock.id, self.dest_stock.id))
def __eq__(self, other):
return (self.src_stock.id, self.dest_stock.id) == (other.src_stock.id, other.dest_stock.id)
return (self.src_stock.id,
self.dest_stock.id) == (other.src_stock.id,
other.dest_stock.id)
def moves_by_product(self):
"""iterate over moves sorted by product default_code"""
return sorted(self.stock_moves, key=operator.attrgetter('product_id.default_code'))
return sorted(self.stock_moves,
key=operator.attrgetter('product_id.default_code'))
def moves_by_sale_order(self):
"""iterate over moves sorted by sale order name
@@ -65,7 +72,8 @@ class PickingAgregation(object):
the report displays an empty line
"""
origin = None
for move in sorted(self.stock_moves, key=operator.attrgetter('picking_id.origin')):
for move in sorted(self.stock_moves,
key=operator.attrgetter('picking_id.origin')):
if origin is None:
origin = move.picking_id.origin
else:
@@ -89,6 +97,7 @@ class PickingAgregation(object):
for p_code in sorted(products):
yield products[p_code], product_qty[p_code]
class PrintPick(report_sxw.rml_parse):
def __init__(self, cursor, uid, name, context):
@@ -104,7 +113,7 @@ class PrintPick(report_sxw.rml_parse):
def set_context(self, objects, data, ids, report_type=None):
"""Return res.partner.category"""
#!! data form is manually set in wizard
# data form is manually set in wizard
agreg = {}
for pick in objects:
for move in pick.move_lines:
@@ -115,7 +124,8 @@ class PrintPick(report_sxw.rml_parse):
for agr in agreg:
print agr
objects.append(PickingAgregation(agr[0], agr[1], agreg[agr]))
return super(PrintPick, self).set_context(objects, data, ids, report_type=report_type)
return super(PrintPick, self).set_context(objects, data, ids,
report_type=report_type)
class DeliverySlip(report_sxw.rml_parse):
@@ -135,7 +145,7 @@ class DeliverySlip(report_sxw.rml_parse):
self.localcontext.update({
'time': time,
'invoice_address': self._get_invoice_address,
})
})
report_sxw.report_sxw('report.webkit.aggregated_picking',
'stock.picking',