Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11.0 implemted printing invoice lines in receipts #1186

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pos_invoice_pay/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"category": "Point of Sale",
# "live_test_url": "http://apps.it-projects.info/shop/product/pos-invoice-pay?version=11.0",
"images": ["images/pos_invoice_pay_main.png"],
"version": "11.0.1.2.3",
"version": "11.0.1.3.0",
"application": False,
"author": "IT-Projects LLC, Artyom Losev",
"support": "[email protected]",
Expand Down
7 changes: 7 additions & 0 deletions pos_invoice_pay/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
`1.3.0`
-------

**New:** Implement printing invoice lines in receipts
**Fix:** Fixed field properties typo in sale_order_cashier_selection and invoice_cashier_selection
**Fix:** Fixed "'bool' object has no attribute 'mapped'" error in get_sale_details
Copy link
Collaborator

@yelizariev yelizariev Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Описания фиксов слишком техническое. Надо писать когда они происходят, а не в каких функциях


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

`1.2.3`
-------

Expand Down
7 changes: 5 additions & 2 deletions pos_invoice_pay/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def _get_default_writeoff_account(self):
return acc if acc else False

show_invoices = fields.Boolean(help="Show invoices in POS", default=True)
show_invoice_lines_in_receipt = fields.Boolean(
help="Show invoice lines in receipt", default=False
)
show_sale_orders = fields.Boolean(help="Show sale orders in POS", default=True)
pos_invoice_pay_writeoff_account_id = fields.Many2one(
"account.account",
Expand All @@ -168,12 +171,12 @@ def _get_default_writeoff_account(self):
invoice_cashier_selection = fields.Boolean(
string="Select Invoice Cashier",
help="Ask for a cashier when fetch invoices",
defaul=True,
default=True,
)
sale_order_cashier_selection = fields.Boolean(
string="Select Sale Order Cashier",
help="Ask for a cashier when fetch orders",
defaul=True,
default=True,
)


Expand Down
6 changes: 6 additions & 0 deletions pos_invoice_pay/report/report.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2018 Artyom Losev
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2019 Eugene Molotov <https://it-projects.info/team/em230418>
# License MIT (https://opensource.org/licenses/MIT).

from odoo import api, models
Expand All @@ -15,6 +16,11 @@ def get_sale_details(self, date_start=False, date_stop=False, configs=False):
date_start, date_stop, configs
)

# reference:
# https://github.com/odoo/odoo/blob/560dba5313c5ca5265190dacc3bce7cbe509d30a/addons/point_of_sale/models/pos_order.py#L1120-L1121
if not configs:
configs = self.env["pos.config"].search([])

payments = self.env["account.payment"].search(
[
("datetime", ">=", date_start),
Expand Down
51 changes: 51 additions & 0 deletions pos_invoice_pay/static/src/xml/pos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,29 @@
</div>
<br />

<t t-if='widget.pos.config.show_invoice_lines_in_receipt'>
<!-- based on https://github.com/odoo/odoo/blob/5235a49a5cd0f79f5590c96afa26dce25465fe06/addons/point_of_sale/static/src/xml/pos.xml#L1466-L1489 -->
<table class='receipt-orderlines'>
<colgroup>
<col width='50%' />
<col width='25%' />
<col width='25%' />
</colgroup>
<tr t-foreach="order.invoice_to_pay.lines" t-as="orderline">
<td>
<t t-esc="orderline.name" />
</td>
<td class="pos-right-align">
<t t-esc="orderline.qty" />
</td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(orderline.amount)" />
</td>
</tr>
</table>
<br />
</t>

<t t-esc="widget.pos.company.name" /><br />
Phone: <t t-esc="widget.pos.company.phone || ''" /><br />
User: <t
Expand Down Expand Up @@ -583,6 +606,34 @@
</t>
</div>
<br />
<!-- Orderlines -->
<t t-if='widget.pos.config.show_invoice_lines_in_receipt'>
<div class='orderlines' line-ratio='0.6'>
<t t-foreach='order.invoice_to_pay.lines' t-as='line'>
<line line-ratio='1'>
<left>
<t t-esc="line.name" />
</left>
</line>
<line indent='1'>
<left>
<value value-autoint='on'>
<t t-esc='line.qty' />
</value>
x
<value value-autoint='on'>
<t t-esc='line.price_unit' />
</value>
</left>
<right>
<value>
<t t-esc='line.amount' />
</value>
</right>
</line>
</t>
</div>
</t>
<div>
<line>
<left>Subtotal:</left>
Expand Down
4 changes: 4 additions & 0 deletions pos_invoice_pay/view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<label for="invoice_cashier_selection" />
<field name="invoice_cashier_selection" />
</div>
<div attrs="{'invisible':[('show_invoices','=',False)]}">
<label for="show_invoice_lines_in_receipt" />
<field name="show_invoice_lines_in_receipt" />
</div>
</div>
</div>
<div id="show_sale_orders" class="col-xs-12 col-md-6 o_setting_box">
Expand Down