[MERGE] merge from trunk addons

bzr revid: mra@mra-laptop-20101014041725-iko68c8209h84rk7
This commit is contained in:
Mustufa Rangwala 2010-10-14 09:47:25 +05:30
commit 3b667a564e
66 changed files with 567 additions and 854 deletions

View File

@ -154,7 +154,7 @@ class account_account_type(osv.osv):
('expense','Profit & Loss (Expense Accounts)'),
('asset','Balance Sheet (Assets Accounts)'),
('liability','Balance Sheet (Liability Accounts)')
],'Type Heads', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)", required=True),
],'P&L / BS Category', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)", required=True),
'note': fields.text('Description'),
}
_defaults = {

View File

@ -2,11 +2,6 @@
<openerp>
<data>
<record id="res_roles_invoice0" model="res.roles">
<field eval="&quot;&quot;&quot;Invoice&quot;&quot;&quot;" name="name"/>
<field name="description">Assign this role to the persons that should have the rights to confirm a draft invoice.</field>
</record>
<record id="wkf" model="workflow">
<field name="name">account.invoice.basic</field>
<field name="osv">account.invoice</field>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Invoice" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Invoices" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="34.0" y1="28.0" width="530" height="786"/>
</pageTemplate>
@ -126,6 +126,7 @@
<paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Table" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="User Index 10" rightIndent="0.0" leftIndent="127.0" fontName="Helvetica"/>
<paraStyle name="Preformatted Text" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
@ -139,7 +140,7 @@
</para>
</td>
<td>
<para style="terp_default_8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_8">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_8">[[ o.address_invoice_id.street ]]</para>
<para style="terp_default_8">[[ o.address_invoice_id.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_8">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
@ -205,13 +206,13 @@
<para style="terp_tblheader_Details_Centre">Quantity</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Unit Price</para>
<para style="terp_tblheader_Details_Right">Unit Price </para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Disc.(%)</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Price</para>
<para style="terp_tblheader_Details_Right">Price</para>
</td>
</tr>
</blockTable>
@ -229,7 +230,7 @@
<para style="terp_default_Right_9">[[ formatLang(l.quantity)]] [[ (l.uos_id and l.uos_id.name) or '' ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.price_unit) ]][[ o.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(l.price_unit) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.discount, digits=get_digits(dp='Account')) ]] </para>
@ -281,7 +282,7 @@
<para style="terp_default_9">Net Total:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed) ]] [[ o.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]]</para>
</td>
</tr>
<tr>
@ -307,21 +308,23 @@
<para style="terp_tblheader_Details">Total:</para>
</td>
<td>
<para style="terp_default_Bold_Right_9">[[ formatLang(o.amount_total) ]] [[ o.currency_id.symbol ]]</para>
<para style="terp_default_Bold_Right_9">[[ formatLang(o.amount_total, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>
<para style="Text body"/>
<para style="Text body">
<font color="white"> </font>
</para>
<blockTable colWidths="167.0,59.0,56.0,247.0" style="Table9">
<tr>
<td>
<para style="terp_tblheader_Details">Tax</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Base</para>
<para style="terp_tblheader_Details_Right">Base </para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Amount</para>
<para style="terp_tblheader_Details_Right">Amount </para>
</td>
<td>
<para style="terp_default_8">
@ -341,7 +344,7 @@
<para style="terp_default_Right_8">[[ formatLang(t.base, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]]</para>
</td>
<td>
<para style="terp_default_Right_8">[[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount) ]] [[ o.currency_id.symbol ]]</para>
<para style="terp_default_Right_8">[[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]]</para>
</td>
<td>
<para style="terp_default_8">
@ -362,7 +365,7 @@
<blockTable colWidths="120.0,410.0" style="Table1">
<tr>
<td>
<para style="terp_default_Bold_9">Fiscal Position: </para>
<para style="terp_default_Bold_9">Fiscal Position Remark : </para>
</td>
<td>
<para style="terp_default_9">[[ (o.fiscal_position.note and format(o.fiscal_position and o.fiscal_position.note)) or removeParentNode('blockTable') ]]</para>
@ -373,4 +376,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Overdue Payment" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Overdue Payments" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="42.0" y1="28.0" width="511" height="786"/>
</pageTemplate>
@ -97,7 +97,7 @@
<para style="terp_default_9">[[ repeatIn(adr_get(o, 'invoice'),'addr') ]]</para>
</td>
<td>
<para style="terp_default_9">[[ o.name ]]</para>
<para style="terp_default_9">[[ o.title.name or '' ]] [[ o.name ]]</para>
<para style="terp_default_9">[[ addr['street'] ]]</para>
<para style="terp_default_9">[[ addr['street2'] or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ addr['zip'] ]] [[ addr['city'] ]]</para>
@ -138,7 +138,7 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="56.0,136.0,51.0,72.0,54.0,56.0,66.0,18.0" style="Table1">
<blockTable colWidths="57.0,136.0,51.0,72.0,54.0,56.0,66.0,18.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_Details">Date</para>
@ -168,7 +168,7 @@
</blockTable>
<section>
<para style="terp_default_8">[[repeatIn(getLines(o), 'line') ]]</para>
<blockTable colWidths="56.0,136.0,52.0,71.0,55.0,56.0,66.0,17.0" style="Table3">
<blockTable colWidths="57.0,136.0,52.0,71.0,55.0,56.0,66.0,17.0" style="Table3">
<tr>
<td>
<para style="terp_default_9">[[ formatLang(line['date'],date=True) ]]</para>
@ -197,7 +197,7 @@
</tr>
</blockTable>
</section>
<blockTable colWidths="244.0,71.0,56.0,56.0,66.0,17.0" style="Table2">
<blockTable colWidths="245.0,71.0,56.0,56.0,66.0,17.0" style="Table2">
<tr>
<td>
<para style="terp_default_8">

View File

@ -2,11 +2,6 @@
<openerp>
<data>
<record model="res.roles" id="crossovered_budget_role">
<field name="name">Crossovered Budget Validation</field>
<field name="description">Assign this role to the persons that should have the rights to Approve a confirm Budgets.</field>
</record>
<!-- Workflow definition -->
<record model="workflow" id="wkf_crossovered_budget">

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Invoice" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Invoices" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
</pageTemplate>
@ -185,7 +185,7 @@
</para>
</td>
<td>
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.address_invoice_id.street ]]</para>
<para style="terp_default_9">[[ o.address_invoice_id.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ o.address_invoice_id.zip or '' ]][[ o.address_invoice_id.city or '' ]]</para>
@ -232,7 +232,7 @@
<blockTable colWidths="179.0,179.0,180.0" style="Table_General_Detail_Content">
<tr>
<td>
<para style="terp_default_Centre_8">[[ o.name ]]<font color="white"> </font></para>
<para style="terp_default_Centre_8">[[ o.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(o.date_invoice,date=True) ]]</para>
@ -297,7 +297,7 @@
</para>
</td>
<td>
<para style="terp_default_Note">Note: [[ (a['note'] and format(a['note'] or '')) or removeParentNode('tr') ]]</para>
<para style="terp_default_Note">Note: [[ (a['note'] and format(a['note'])) or removeParentNode('tr') ]]</para>
<para style="terp_default_Note">
<font color="white"> </font>
</para>
@ -337,7 +337,7 @@
</para>
</td>
<td>
<para style="terp_default_9">[[ a['type']=='text' and format(a['name'] or '') or removeParentNode('blockTable') ]]</para>
<para style="terp_default_9">[[ a['type']=='text' and format(a['name']) or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_default_9">[[ a['type']=='text' and '' ]]</para>
@ -434,9 +434,6 @@
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_8">[[ repeatIn(o.tax_line,'t') ]]</para>
<blockTable colWidths="105.0,51.0,63.0,320.0" style="Table8">
@ -461,13 +458,10 @@
<font color="white"> </font>
</para>
</section>
<para style="terp_default_space">
<font color="white"> </font>
</para>
<blockTable colWidths="539.0" style="Table_Coment_Payment_Term">
<tr>
<td>
<para style="terp_default_9">[[ format(o.comment or '') or removeParentNode('blockTable') ]]</para>
<para style="terp_default_9">[[ format(o.comment or removeParentNode('blockTable')) ]]</para>
</td>
</tr>
</blockTable>
@ -477,7 +471,7 @@
<blockTable colWidths="539.0" style="Table_Payment_Terms">
<tr>
<td>
<para style="terp_default_9">[[ o.payment_term and o.payment_term.name + " :\n" + format(o.payment_term.note or '') or removeParentNode('blockTable') ]]</para>
<para style="terp_default_9"><font face="Helvetica" size="10.0">[[ o.payment_term and o.payment_term.name ]] </font>: <font face="Helvetica" size="10.0">[[ (o.payment_term and o.payment_term.note and format(o.payment_term.note)) or removeParentNode('blockTable') ]]</font></para>
</td>
</tr>
</blockTable>
@ -485,4 +479,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Invoice" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Invoices" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
</pageTemplate>
@ -189,7 +189,7 @@
</para>
</td>
<td>
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.address_invoice_id.street ]]</para>
<para style="terp_default_9">[[ o.address_invoice_id.street2 or removeParentNode('para')]]</para>
<para style="terp_default_9">[[ o.address_invoice_id.zip or '' ]][[ o.address_invoice_id.city or '' ]]</para>
@ -236,7 +236,7 @@
<blockTable colWidths="179.0,179.0,180.0" style="Table_General_Detail_Content">
<tr>
<td>
<para style="terp_default_Centre_9">[[ o.name ]]<font color="white"> </font></para>
<para style="terp_default_Centre_9">[[ o.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(o.date_invoice,date=True) ]]</para>
@ -438,9 +438,6 @@
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_8">[[ repeatIn(o.tax_line,'t') ]]</para>
<blockTable colWidths="120.0,49.0,60.0,310.0" style="Table8">
@ -500,4 +497,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>

View File

@ -214,11 +214,8 @@
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_9">[[repeatIn(o.line_ids, 'line') ]]</para>
<para style="terp_default_2">[[repeatIn(o.line_ids, 'line') ]]</para>
<blockTable colWidths="112.0,86.0,106.0,64.0,85.0,75.0" style="Table4">
<tr>
<td>
@ -237,12 +234,12 @@
<para style="terp_default_Right_9">[[formatLang(line.amount) or '-' ]] [[get_company_currency_symbol()]] </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.amount_currency) ]] [[get_company_currency_symbol()]] </para>
<para style="terp_default_Right_9">[[ formatLang(line.amount_currency) ]] [[ line.currency.symbol]] </para>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="304.0,64.0,85.0,75.0" style="Table5">
<blockTable colWidths="335.0,32.0,85.0,75.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">
@ -256,7 +253,7 @@
<para style="terp_default_Right_9">[[ formatLang(get_amount_total(o)) or '' ]] [[get_company_currency_symbol()]] </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(get_amount_total_in_currency(o)) or '' ]] [[get_company_currency_symbol()]] </para>
<para style="terp_default_Right_9">[[ formatLang(get_amount_total_in_currency(o)) or '' ]] [[get_company_currency_symbol()]] </para>
</td>
</tr>
</blockTable>

View File

@ -12,6 +12,7 @@
invoice_state: none
move_lines:
- company_id: base.main_company
date: '2010-05-11 15:18:57'
location_dest_id: stock.stock_location_customers
location_id: stock.stock_location_stock
name: HP CD writers

View File

@ -1,155 +0,0 @@
-
In order to test the delivery module, I will do Configuration -> Delivery -> Delivery Method
And there are two methods for doing that
Delivery based on order quantities,
Delivery based on delivered quantities.
-
I create the partner associated with the transport.
-
I create partner.
-
!record {model: res.partner, id: res_partner_thepost0}:
address:
- country_id: base.in
name: Micro Link
credit_limit: 0.0
name: The Post
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
-
I create associated product for delivery.
-
!record {model: product.product, id: product_product_deliverybypost0}:
categ_id: product.product_category_services
cost_method: standard
mes_type: fixed
name: Delivery Product
procure_method: make_to_stock
supply_method: buy
type: service
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
warranty: 0.0
-
I create the Delivery Method.
-
!record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}:
name: The OpenERP Experss
partner_id: res_partner_thepost0
product_id: product_product_deliverybypost0
-
I create a delivery grid record and define the region for which the tariffs in the grid will be applicable.
Then set the condition for which this rule is applicable.
-
!record {model: delivery.grid, id: delivery_grid_weight0}:
carrier_id: delivery_carrier_theopenerpexperss0
line_ids:
- list_price: 120.0
max_value: 250.0
name: Weight of product
operator: <=
standard_price: 60.0
type: weight
price_type: fixed
variable_factor: weight
- list_price: 0.0
max_value: 500.0
name: Price &gt;= 500
operator: <=
standard_price: 20.0
type: price
price_type: fixed
variable_factor: weight
country_ids:
- base.id
- base.be
- base.in
- base.io
name: Weight
sequence: 1
-
To check the Delivery based on order quantities , I have created sale order and picking_policy is direct .
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-11'
invoice_quantity: order
name: Test/delivery
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I create delivery.sale.order record.
-
!record {model: delivery.sale.order, id: delivery_sale_order_0}:
carrier_id: delivery_carrier_theopenerpexperss0
-
To add the delivery charges on the quotation, I click on Delivery costs button and select the carrier.
-
!python {model: delivery.sale.order}: |
self.delivery_set(cr, uid, [ref("delivery_sale_order_0")], {"lang": "en_US", "active_model":
"sale.order", "tz": False, "order_id": 8, "active_ids": [ref("sale_order_so0")],
"active_id": ref("sale_order_so0"), })
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
To check the Invoicing based on deliveries.I create new sale order and picking_policy is Complete Delivery.
-
!record {model: sale.order, id: sale_order_test_complete0}:
name: Test/Complete Deliver
carrier_id: delivery.delivery_carrier_theopenerpexperss0
invoice_quantity: procurement
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
partner_id: base.res_partner_4
partner_order_id: base.res_partner_address_7
partner_invoice_id: base.res_partner_address_7
partner_shipping_id: base.res_partner_address_7
pricelist_id: product.list0
order_policy: picking
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0}
-
I Create stock.invoice.onshipping
-
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
journal_id: account.sales_journal
type: out_invoice
-
I Create Invoice form picking.
-
!python {model: stock.invoice.onshipping}: |
so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0'))
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
"tz": False, "active_model": "stock.picking", "contact_display": "partner",
"active_ids": [so.picking_ids[0].id], "active_id": so.picking_ids[0].id })

View File

@ -2,10 +2,6 @@
<openerp>
<data>
<record id="PE_ADMIN" model="res.roles">
<field name="name">Email Administrator</field>
</record>
<record id="wkf_email_template_setting" model="workflow">
<field name="name">Email Template Workflow</field>
<field name="osv">email_template.account</field>

View File

@ -212,7 +212,7 @@ class event_event(osv.osv):
'register_current': fields.function(_get_register, method=True, string='Confirmed Registrations', multi='register_current',
help="Total of Open and Done Registrations"),
'register_prospect': fields.function(_get_register, method=True, string='Unconfirmed Registrations', multi='register_prospect',
help="Total of Prospect Registrations"),
help="Total of Prospect Registrati./event/event.py:41:ons"),
'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}),
'date_begin': fields.datetime('Beginning date', required=True, help="Beginning Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
'date_end': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
@ -263,8 +263,15 @@ class event_event(osv.osv):
return True
def _check_closing_date(self, cr, uid, ids):
for event in self.browse(cr, uid, ids):
if event.date_end < event.date_begin:
return False
return True
_constraints = [
(_check_recursion, 'Error ! You cannot create recursive event.', ['parent_id'])
(_check_recursion, 'Error ! You cannot create recursive event.', ['parent_id']),
(_check_closing_date, 'Error ! Closing Date cannot be set before Beginning Date.', ['date_end']),
]
def do_team_change(self, cr, uid, ids, team_id, context=None):

View File

@ -53,7 +53,7 @@
<record id="process_transition_employeeuser0" model="process.transition">
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Link a user to an employee&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;The field Relate'd user in the Employee form allows to link the OpenERP user (and his rights and role) to the employee.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;The Related user field on the Employee form allows to link the OpenERP user (and her rights) to the employee.&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="process_node_openerpuser0"/>
<field model="process.node" name="source_node_id" ref="process_node_employee0"/>
</record>

View File

@ -146,8 +146,8 @@
<field name="arch" type="xml">
<search string="Search Contract">
<group col='15' colspan='4'>
<filter string="Current" icon="terp-check" name="current" domain="[('date_end','&gt;=', time.strftime('%%Y-%%m-%%d'))]" context="{'group_by':'date_end'}" help="Contracts in progress"/>
<filter string="Overpassed" icon="terp-emblem-important" domain="[('date_end','&lt;', time.strftime('%%Y-%%m-%%d'))]" context="{'group_by':'date_end'}" help="Contracts whose end date already passed"/>
<filter string="Current" icon="terp-check" name="current" domain="['|',('date_end','&gt;=', time.strftime('%%Y-%%m-%%d')),('date_end','=',False)]" help="Contracts in progress"/>
<filter string="Overpassed" icon="terp-emblem-important" domain="[('date_end','&lt;', time.strftime('%%Y-%%m-%%d'))]" help="Contracts whose end date already passed"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="employee_id"/>
@ -157,9 +157,12 @@
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="20">
<filter string="Contract Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
<separator orientation="vertical"/>
<filter string="Working Schedule" icon="terp-go-week" domain="[]" context="{'group_by':'working_hours'}"/>
<filter string="Job" icon="terp-gtk-select-all" domain="[]" context="{'group_by':'job_id'}"/>
<separator orientation="vertical"/>
<filter string="Contract Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type_id'}"/>
</group>
</search>
</field>

View File

@ -2,16 +2,6 @@
<openerp>
<data>
<!-- Roles definition -->
<record id="HR" model="res.roles">
<field name="name">Human Resources - Expenses</field>
</record>
<record id="HR_INV" model="res.roles">
<field name="name">Human Resources - Expenses invoice</field>
</record>
<!-- Workflow definition -->
<record id="wkf_expenses" model="workflow">

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="HR Expenses" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Expenses" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="16.0" y1="57.0" width="522" height="728"/>
</pageTemplate>
@ -259,7 +259,7 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">[[ o.note or '' ]] [[ setTag('para','xpre') ]]</para>
<para style="terp_default_9">[[ setTag('para','xpre') ]] [[ o.note or '' ]]</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>

View File

@ -43,7 +43,7 @@
HR / Employees / Employees
then select the ones you want to choose, click on the print icon and select the option
'Print Summary of Employee's Holidays'
- The wizard allows you to choose if you want to print either the Confirmed & Validated holidays or only the Validated ones. These states must be set up by a user from the group 'HR' and with the role 'holidays'. You can define these features in the security tab from the user data in
- The wizard allows you to choose if you want to print either the Confirmed & Validated holidays or only the Validated ones. These states must be set up by a user from the group 'HR'. You can define these features in the security tab from the user data in
Administration / Users / Users
for example, you maybe will do it for the user 'admin'
.

View File

@ -2,12 +2,6 @@
<openerp>
<data>
<!-- Roles definition -->
<record model="res.roles" id="HR_holidays">
<field name="name">Leaves Manager</field>
</record>
<!-- Workflow definition -->
<record model="workflow" id="wkf_holidays">

View File

@ -22,7 +22,6 @@
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" invisible="1"/>
<field name="amount" sum="Total cost" invisible="1"/>
<field name="general_account_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
</tree>
</field>
</record>

View File

@ -49,13 +49,14 @@ The validation can be configured in the company:
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
'security/hr_timesheet_data.xml',
'security/hr_timesheet_sheet_security.xml',
'hr_timesheet_sheet_view.xml',
'hr_timesheet_workflow.xml',
'process/hr_timesheet_sheet_process.xml',
'board_hr_timesheet_view.xml',
'report/hr_timesheet_report_view.xml',
'wizard/hr_timesheet_current_view.xml',
'hr_timesheet_sheet_data.xml'
],
'demo_xml': ['hr_timesheet_sheet_demo.xml',

View File

@ -334,11 +334,16 @@ class hr_timesheet_sheet(osv.osv):
return time.strftime('%Y-12-31')
return time.strftime('%Y-%m-%d')
def _default_employee(self,cr, uid, context=None):
emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)], context=context)
return emp_ids and emp_ids[0] or False
_defaults = {
'date_from' : _default_date_from,
'date_current' : lambda *a: time.strftime('%Y-%m-%d'),
'date_to' : _default_date_to,
'state': 'new',
'employee_id': _default_employee,
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c)
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="ir_actions_server_timsheet_sheet" model="ir.actions.server">
<field eval="5" name="sequence"/>
<field eval="&quot;&quot;&quot;code&quot;&quot;&quot;" name="state"/>
<field eval="&quot;&quot;&quot;ir.actions.server&quot;&quot;&quot;" name="type"/>
<field name="model_id" ref="model_hr_timesheet_current_open"/>
<field eval="[(6,0,[])]" name="child_ids"/>
<field eval="&quot;&quot;&quot;action = self.pool.get('hr.timesheet.current.open').open_timesheet(cr, uid, object.id, context)&quot;&quot;&quot;" name="code"/>
<field eval="&quot;&quot;&quot;True&quot;&quot;&quot;" name="condition"/>
<field eval="&quot;&quot;&quot;My Timesheet&quot;&quot;&quot;" name="name"/>
</record>
<record id="menu_act_hr_timesheet_sheet_form_my_current" model="ir.ui.menu">
<field name="name">My Timesheet</field>
<field eval="1" name="sequence"/>
<field name="parent_id" ref="hr_attendance.menu_hr_time_tracking"/>
<field name="icon">STOCK_JUSTIFY_FILL</field>
<field name="action" ref="ir_actions_server_timsheet_sheet"/>
</record>
</data>
</openerp>

View File

@ -2,12 +2,6 @@
<openerp>
<data>
<!-- Roles definition -->
<record id="HR" model="res.roles">
<field name="name">Timesheets validation</field>
</record>
<!-- Workflow definition -->
<record id="wkf_timesheet" model="workflow">

View File

@ -96,10 +96,6 @@
Process Transition
-->
<record id="res_roles_hr0" model="res.roles">
<field eval="&quot;&quot;&quot;HR&quot;&quot;&quot;" name="name"/>
</record>
<record id="process_transition_attendancetimesheet0" model="process.transition">
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Sign in/out&quot;&quot;&quot;" name="name"/>

View File

@ -81,7 +81,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
account_period = obj_acc_period.browse(cr, uid, data['period_id'], context=context)
send_ref = str(obj_company.partner_id.id) + str(account_period.date_start[5:7]) + str(account_period.date_stop[:4])
data_of_file = '<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-14.xml">'
data_of_file = '<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-16.xml">'
data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+ obj_company.name +'</NAME>\n\t\t<ADDRESS>'+address+'</ADDRESS>'
data_of_file +='\n\t\t<POSTCODE>'+post_code+'</POSTCODE>\n\t\t<CITY>'+city+'</CITY>\n\t\t<COUNTRY>'+country_code+'</COUNTRY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+((vat_no and str(vat_no[2:])) or '')+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t'
@ -127,4 +127,4 @@ class l10n_be_vat_declaration(osv.osv_memory):
l10n_be_vat_declaration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -80,20 +80,19 @@
</initialize>
<paraStyle name="P1" fontName="Helvetica-BoldOblique" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica-BoldOblique" fontSize="9.0" leading="11"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="9.0" leading="11"/>
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER"/>
<paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
<paraStyle name="P10" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P11" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER"/>
<paraStyle name="P12" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P13" fontName="Helvetica-BoldOblique" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P15" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
<paraStyle name="P16" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER"/>
<paraStyle name="P3" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER"/>
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER"/>
<paraStyle name="P8" fontName="Helvetica" fontSize="9.0" leading="11"/>
<paraStyle name="P9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P10" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P11" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER"/>
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER"/>
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P15" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
@ -112,30 +111,30 @@
<images/>
</stylesheet>
<story>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P15">[[repeatIn(objects,'o')]]</para>
<section>
<para style="P5">[[repeatIn(objects,'o')]]</para>
<blockTable colWidths="262.0,5.0,260.0" style="Table5">
<para style="P15">
<font color="white"> </font>
</para>
<blockTable colWidths="262.0,6.0,260.0" style="Table5">
<tr>
<td>
<para style="P10">
<para style="P15">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">
<para style="P9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P6">[[ o.user_id.address_id.title or '' ]] [[ o.user_id.address_id.name ]]</para>
<para style="P6">[[ o.user_id.address_id.street ]]</para>
<para style="P6">[[ o.user_id.address_id.street2 or removeParentNode('para') ]]</para>
<para style="P6">[[ o.user_id.address_id.zip or '' ]] [[ o.user_id.address_id.city or '' ]]</para>
<para style="P6">[[ (o.user_id.address_id.state_id and o.user_id.address_id.state_id.name) or removeParentNode('para')]] [[ (o.user_id.address_id.country_id and o.user_id.address_id.country_id.name) or '' ]]</para>
<para style="P6">
<para style="P14">[[ o.user_id.address_id.partner_id.title.name or '' ]] [[ o.user_id.address_id.partner_id.name ]]</para>
<para style="P14">[[ o.user_id.address_id.street ]]</para>
<para style="P14">[[ o.user_id.address_id.street2 or removeParentNode('para') ]]</para>
<para style="P14">[[ o.user_id.address_id.zip or '' ]] [[ o.user_id.address_id.city or '' ]]</para>
<para style="P14">[[ (o.user_id.address_id.state_id and o.user_id.address_id.state_id.name) or removeParentNode('para')]] [[ (o.user_id.address_id.country_id and o.user_id.address_id.country_id.name) or '' ]]</para>
<para style="P14">
<font color="white"> </font>
</para>
</td>
@ -150,7 +149,7 @@
<blockTable colWidths="527.0" style="Table4">
<tr>
<td>
<para style="P4">Lunch Order</para>
<para style="P11">Lunch Order</para>
</td>
</tr>
</blockTable>
@ -163,16 +162,16 @@
<blockTable colWidths="132.0,153.0,141.0,101.0" style="Table3">
<tr>
<td>
<para style="P7">Name</para>
<para style="P10">Name</para>
</td>
<td>
<para style="P11">Order</para>
<para style="P3">Order</para>
</td>
<td>
<para style="P11">Description</para>
<para style="P3">Description</para>
</td>
<td>
<para style="P12">Unit Price([[company.currency_id.code]])</para>
<para style="P4">Unit Price</para>
</td>
</tr>
</blockTable>
@ -180,37 +179,36 @@
<blockTable colWidths="132.0,153.0,142.0,101.0" style="Table1">
<tr>
<td>
<para style="P14">[[repeatIn(objects, 'o') ]]</para>
<para style="P14">[[ o.user_id.name ]]</para>
<para style="P5">[[ o.user_id.name ]]</para>
</td>
<td>
<para style="P16">[[o.product.name ]]</para>
<para style="P7">[[o.product.name ]]</para>
</td>
<td>
<para style="P8">[[ o.descript ]]</para>
<para style="P12">[[ o.descript ]]</para>
</td>
<td>
<para style="P15">[[formatLang(o.price) ]] [[company.currency_id.symbol]]</para>
<para style="P6">[[formatLang(o.price) ]] [[company.currency_id.symbol]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="132.0,153.0,142.0,101.0" style="Table2">
<tr>
<td>
<para style="P3">
<para style="P8">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<para style="P8">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P11">Total:</para>
<para style="P3">Total:</para>
</td>
<td>
<para style="P9">[[ formatLang(sum_price(objects)) ]] <font face="Helvetica">[[company.currency_id.symbol]]</font></para>
<para style="P13">[[ formatLang(sum_price(objects)) ]] <font face="Helvetica">[[company.currency_id.symbol]]</font></para>
</td>
</tr>
</blockTable>
@ -218,4 +216,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>

View File

@ -277,7 +277,7 @@
<para style="terp_tblheader_Details_Right">Unit Price</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Price<font size="8.0">([[ o.pricelist_id.currency_id. name ]])</font></para>
<para style="terp_tblheader_Details_Right">Price</para>
</td>
</tr>
</blockTable>

View File

@ -1925,8 +1925,7 @@ class bi_auto_configure_wizard(osv.osv_memory):
table_new = dbtab_obj.write(cr, uid, tables['id'], end_user_name)
if not(tables['table_db_name'].startswith('ir') or \
tables['table_db_name'].startswith('wkf') or \
tables['table_db_name'].startswith('res_groups') or \
tables['table_db_name'].startswith('res_role')) and \
tables['table_db_name'].startswith('res_groups')) and \
tables['table_db_name'] not in ['inherit', 'user_rule_group_rel',\
'group_rule_group_rel']:
vals = {}
@ -1999,8 +1998,8 @@ class bi_auto_configure_wizard(osv.osv_memory):
table['table_db_name'].startswith('wkf')) or \
(table['table_db_name'].startswith('res_groups')) or \
(table['table_db_name'] in \
['inherit', 'res_roles', 'user_rule_group_rel', \
'res_roles_users_rel', 'group_rule_group_rel']):
['inherit', 'user_rule_group_rel', \
'group_rule_group_rel']):
vals['hide'] = True
vals['active'] = False
make_id.append(table['id'])

View File

@ -7,12 +7,6 @@
<field name="on_create">True</field>
</record>
<!-- Roles definition -->
<record model="res.roles" id="role_pos">
<field name="name">POS - Confirmation</field>
</record>
<!--Activities-->
<record model="workflow.activity" id="act_draft">

View File

@ -36,12 +36,12 @@ class pos_details(report_sxw.rml_parse):
def _pos_sales_details(self,form,user):
data={}
self.cr.execute ("select po.name as pos_name,po.date_order,pt.name ,pol.qty,pol.price_unit,pol.discount,po.invoice_id,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,res_users as ru,res_company as rc " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('done','paid','invoiced') " \
self.cr.execute ("select po.name as pos_name,po.date_order,pt.name ,pp.default_code as code,pol.qty,pu.name as uom,pol.price_unit,pol.discount,po.invoice_id,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu,res_users as ru,res_company as rc " \
"where pt.id=pp.product_tmpl_id and pu.id=pt.uom_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('done','paid','invoiced') " \
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
"group by po.name,pol.qty,po.date_order,pt.name,pol.price_unit,pol.discount,po.invoice_id " \
"group by po.name,pol.qty,po.date_order,pt.name,pp.default_code,pu.name,pol.price_unit,pol.discount,po.invoice_id " \
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
data=self.cr.dictfetchall()
if data:

View File

@ -199,7 +199,7 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="67.0,65.0,143.0,59.0,40.0,47.0,88.0" style="Table4">
<blockTable colWidths="53.0,44.0,158.0,54.0,76.0,37.0,88.0" style="Table4">
<tr>
<td>
<para style="terp_tblheader_Details">Date</para>
@ -214,7 +214,7 @@
<para style="terp_tblheader_Details_Right">Price </para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Qty</para>
<para style="terp_tblheader_Details_Centre">Qty</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Disc(%) </para>
@ -226,7 +226,7 @@
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(pos_sales_details(data['form'],user), 'line_ids') ]]</para>
<blockTable colWidths="67.0,66.0,142.0,59.0,41.0,46.0,89.0" style="Table6">
<blockTable colWidths="54.0,44.0,159.0,54.0,75.0,36.0,89.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[[ formatLang(line_ids['date_order'],date_time = True) ]]</para>
@ -235,13 +235,13 @@
<para style="terp_default_9">[[ line_ids['pos_name'] ]]</para>
</td>
<td>
<para style="terp_default_9">[[ line_ids['name'] ]]</para>
<para style="terp_default_9">[ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]] [[ company.currency_id.symbol ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['qty']) ]]</para>
<para style="terp_default_Centre_9">[[ formatLang(line_ids['qty']) ]] [[ line_ids['uom'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(line_ids['discount']) ]]</para>
@ -275,7 +275,7 @@
<para style="terp_default_9">[[ p['name'] or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(p['amount']) or removeParentNode('font') ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ formatLang(p['amount']) or removeParentNode('tr') ]] [[ company.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>
@ -383,4 +383,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>

View File

@ -20,6 +20,7 @@
##############################################################################
import time
from datetime import datetime
from report import report_sxw
@ -38,7 +39,8 @@ class pos_details_summary(report_sxw.rml_parse):
'getsuminvoice': self._sum_invoice,
'gettaxamount': self._get_tax_amount,
'getsalestotal': self._get_sales_total,
'getperiod': self._get_period,
'getstartperiod': self._get_start_period,
'getendperiod': self._get_end_period,
'getcompany':self.get_company
})
@ -68,27 +70,26 @@ class pos_details_summary(report_sxw.rml_parse):
objects,
0.0 )
def _get_payments(self, objects, ignore_gift=False):
gift_journal_id = None
if ignore_gift:
config_journal_ids = self.pool.get("pos.config.journal").search(self.cr, self.uid, [('code', '=', 'GIFT')])
if len(config_journal_ids):
config_journal = self.pool.get("pos.config.journal").browse(self.cr, self.uid, config_journal_ids, {})[0]
gift_journal_id = config_journal.journal_id.id
def _get_payments(self, objects):
# gift_journal_id = None
# if ignore_gift:
# config_journal_ids = self.pool.get("pos.config.journal").search(self.cr, self.uid, [('code', '=', 'GIFT')])
# if len(config_journal_ids):
# config_journal = self.pool.get("pos.config.journal").browse(self.cr, self.uid, config_journal_ids, {})[0]
# gift_journal_id = config_journal.journal_id.id
result = {}
for obj in objects:
for payment in obj.statement_ids:
if gift_journal_id and gift_journal_id == payment.statement_id.journal_id.id:
continue
result[payment.statement_id.journal_id.name] = result.get(payment.statement_id.journal_id.name, 0.0) + payment.amount
for statement in obj.statement_ids:
if statement.journal_id:
result[statement.journal_id] = result.get(statement.journal_id, 0.0) + statement.amount
return result
def _paid_total(self, objects):
return sum(self._get_payments(objects, True).values(), 0.0)
return sum(self._get_payments(objects).values(), 0.0)
def _total_of_the_day(self, objects):
total_paid = sum(self._get_payments(objects, True).values(), 0.0)
total_paid = self._paid_total(objects)
total_invoiced = self._sum_invoice(objects)
return total_paid - total_invoiced
@ -119,16 +120,17 @@ class pos_details_summary(report_sxw.rml_parse):
def _get_sales_total(self, objects):
return reduce(lambda x, o: x + len(o.lines), objects, 0)
def _get_period(self, objects):
date_orders = [obj.date_order for obj in objects]
min_date = min(date_orders)
max_date = max(date_orders)
if min_date == max_date:
return '%s' % min_date
else:
return '%s - %s' % (min_date, max_date)
def _get_start_period(self, objects):
date_orders = sorted([obj.date_order for obj in objects])
min_date = date_orders[0]
return '%s' % min_date
def _get_end_period(self, objects):
date_orders = sorted([obj.date_order for obj in objects])
max_date = date_orders[-1]
return '%s' % max_date
report_sxw.report_sxw('report.pos.details_summary',
'pos.order',

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Detail of sales" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Details of Sales" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="27.0" y1="57.0" width="512" height="728"/>
<frame id="first" x1="28.0" y1="57.0" width="511" height="728"/>
</pageTemplate>
</template>
<stylesheet>
@ -20,9 +20,12 @@
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
@ -34,26 +37,12 @@
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
@ -61,33 +50,38 @@
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table9">
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table8">
<blockTableStyle id="Table9">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table11">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table8">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,1" stop="0,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,1" stop="1,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,2" stop="0,2"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,2" stop="1,2"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,3" stop="0,3"/>
@ -106,12 +100,8 @@
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P3" fontName="Helvetica-Bold" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
@ -150,14 +140,11 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="P3">
<para style="terp_header_Centre">Details of Sales</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="P3">Details of Sales</para>
<para style="P4">
<font color="white"> </font>
</para>
<blockTable colWidths="170.0,170.0,170.0" style="Table1">
<blockTable colWidths="149.0,124.0,119.0,120.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
@ -166,33 +153,44 @@
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Period</para>
<para style="terp_tblheader_General_Centre">Start Period</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">End Period</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="170.0,170.0,170.0" style="Table2">
<blockTable colWidths="148.0,124.0,119.0,119.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ '%s' % getcompany(objects)]]</para>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ '%s' % getperiod(objects) ]]</para>
<para style="terp_default_Centre_8">[[ '%s' % getstartperiod(objects) ]] </para>
</td>
<td>
<para style="terp_default_Centre_8">[[ '%s' % getendperiod(objects) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="256.0,256.0" style="Table4">
<section>
<para style="Standard">
<font color="white"> </font>
</para>
</section>
<blockTable colWidths="256.0,256.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_Details">Mode of Taxes</para>
</td>
<td>
<para style="P2">
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
@ -200,13 +198,13 @@
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(gettaxamount(objects).items(),'p') ]]</para>
<blockTable colWidths="256.0,256.0" style="Table6">
<blockTable colWidths="256.0,256.0" style="Table5">
<tr>
<td>
<para style="P6">[[ p[0] ]]</para>
<para style="P1">[[ p[0] ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ p[1] ]]</para>
<para style="terp_default_Right_9_Bold">[[ p[1] ]] [[company.currency_id.symbol]]</para>
</td>
</tr>
</blockTable>
@ -217,13 +215,13 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="256.0,256.0" style="Table3">
<blockTable colWidths="257.0,255.0" style="Table9">
<tr>
<td>
<para style="terp_tblheader_Details">Mode of Payment</para>
</td>
<td>
<para style="P2">
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
@ -231,13 +229,13 @@
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(getpayments(objects).items(),'t') ]]</para>
<blockTable colWidths="256.0,256.0" style="Table9">
<blockTable colWidths="255.0,255.0" style="Table11">
<tr>
<td>
<para style="P5">[[ t[0] ]]</para>
<para style="P2">[[ t[0] ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ '%.2f' % (t[1],) ]]</para>
<para style="terp_default_Right_9_Bold">[[ '%.2f' % (t[1],) ]] [[company.currency_id.symbol]]</para>
</td>
</tr>
</blockTable>
@ -248,25 +246,25 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="256.0,256.0" style="Table8">
<blockTable colWidths="257.0,255.0" style="Table8">
<tr>
<td>
<para style="terp_default_Bold_9">Summary</para>
<para style="terp_tblheader_Details">Summary</para>
</td>
<td>
<para style="P1">
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="256.0,256.0" style="Table7">
<blockTable colWidths="257.0,254.0" style="Table7">
<tr>
<td>
<para style="terp_default_Bold_9">Sales total</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ '%d' % getsalestotal(objects) ]] [[company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ '%d' % getsalestotal(objects) ]]</para>
</td>
</tr>
<tr>
@ -310,7 +308,7 @@
</td>
</tr>
</blockTable>
<para style="terp_default_9">
<para style="terp_default_8">
<font color="white"> </font>
</para>
</story>

View File

@ -149,16 +149,16 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="198.0,81.0,87.0,87.0,83.0" style="Tableau6">
<blockTable colWidths="301.0,58.0,34.0,57.0,61.0" style="Tableau6">
<tr>
<td>
<para style="terp_tblheader_Details">Product</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Qty</para>
<para style="terp_tblheader_Details_Centre">Qty</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Disc. (%)</para>
<para style="terp_tblheader_Details_Centre">Disc.(%)</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Unit Price</para>
@ -172,7 +172,7 @@
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
<section>
<para style="terp_default_8">[[ repeatIn(pos_payment(o), 'line_ids') ]]</para>
<blockTable colWidths="198.0,81.0,87.0,87.0,83.0" style="Tableau7">
<blockTable colWidths="301.0,58.0,34.0,57.0,61.0" style="Tableau7">
<tr>
<td>
<para style="terp_default_9">[ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
@ -184,7 +184,7 @@
<para style="terp_default_Right_9">[[ formatLang(line_ids['discount']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['total']) ]] [[ company.currency_id.symbol ]]</para>
@ -194,7 +194,7 @@
</blockTable>
</section>
</section>
<blockTable colWidths="198.0,81.0,87.0,87.0,83.0" style="Table1">
<blockTable colWidths="302.0,57.0,34.0,57.0,61.0" style="Table1">
<tr>
<td>
<para style="terp_default_9">
@ -215,7 +215,7 @@
<para style="terp_tblheader_Details">Net Total:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(pos_payment_total(o)) or removeParentNode('blockTable')]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ formatLang(pos_payment_total(o)) or removeParentNode('blockTable')]] [[ company.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Payment" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Payments" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="27.0" y1="57.0" width="512" height="728"/>
</pageTemplate>
@ -128,13 +128,13 @@
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="271.0,63.0,45.0,64.0,68.0" style="Table3">
<blockTable colWidths="301.0,57.0,35.0,57.0,61.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_Details">Product</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Qty</para>
<para style="terp_tblheader_General_Centre">Qty</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Disc(%)</para>
@ -149,7 +149,7 @@
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(pos_payment_date(data['form']), 'line_ids') ]]</para>
<blockTable colWidths="271.0,63.0,45.0,64.0,68.0" style="Table6">
<blockTable colWidths="301.0,58.0,34.0,57.0,61.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
@ -161,7 +161,7 @@
<para style="terp_default_Right_9">[[ formatLang(line_ids['discount']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]] </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['total']) ]] [[ company.currency_id.symbol ]]</para>
@ -169,7 +169,7 @@
</tr>
</blockTable>
</section>
<blockTable colWidths="271.0,63.0,45.0,64.0,68.0" style="Table5">
<blockTable colWidths="302.0,57.0,34.0,57.0,61.0" style="Table5">
<tr>
<td>
<para style="Table Contents">
@ -190,7 +190,7 @@
<para style="terp_tblheader_General_Right">Total:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(pos_payment_date_total(data['form'])) or removeParentNode('blockTable')]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ formatLang(pos_payment_date_total(data['form'])) or removeParentNode('blockTable')]] [[ company.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>

View File

@ -25,8 +25,7 @@ from report import report_sxw
class pos_user_product(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_user_product, self).__init__(cr, uid, name, context=context)
self.total = 0.0
super(pos_user_product, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'get_data':self._get_data,
@ -35,6 +34,7 @@ class pos_user_product(report_sxw.rml_parse):
})
def _get_data(self,o):
self.total = 0.0
data={}
sql1=""" SELECT distinct(o.id) from account_bank_statement s, account_bank_statement_line l,pos_order o,pos_order_line i where i.order_id=o.id and o.state='paid' and l.statement_id=s.id and l.pos_statement_id=o.id and s.id=%d"""%(o.id)
self.cr.execute(sql1)
@ -43,7 +43,7 @@ class pos_user_product(report_sxw.rml_parse):
for r in data:
a_l.append(r['id'])
if len(a_l):
sql2="""SELECT sum(qty) as qty,l.price_unit*sum(l.qty) as amt,t.name as name from product_product p, product_template t, pos_order_line l where order_id IN %s and p.product_tmpl_id=t.id and l.product_id=p.id group by t.name, l.price_unit""",(tuple(a_l),)
sql2="""SELECT sum(qty) as qty,l.price_unit*sum(l.qty) as amt,t.name as name, p.default_code as code, pu.name as uom from product_product p, product_template t,product_uom pu,pos_order_line l where order_id = %d and p.product_tmpl_id=t.id and l.product_id=p.id and pu.id=t.uom_id group by t.name,p.default_code,pu.name,l.price_unit"""%(o.id)
self.cr.execute(sql2)
data = self.cr.dictfetchall()
for d in data:
@ -58,7 +58,7 @@ class pos_user_product(report_sxw.rml_parse):
self.cr.execute(sql)
data = self.cr.fetchone()
return data[0]
def _get_total(self):
def _get_total(self,o):
return self.total
report_sxw.report_sxw('report.pos.user.product', 'account.bank.statement', 'addons/statement/report/pos_users_product.rml', parser=pos_user_product,header='internal')

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="User's Product" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="User's Product'" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
<frame id="first" x1="36.0" y1="57.0" width="520" height="728"/>
</pageTemplate>
</template>
<stylesheet>
@ -60,15 +60,8 @@
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
@ -82,7 +75,6 @@
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
@ -125,9 +117,6 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="P2">User's Product</para>
<para style="terp_default_8">
<font color="white"> </font>
@ -135,10 +124,7 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="96.0,96.0,96.0,96.0,96.0" style="Table1">
<blockTable colWidths="104.0,104.0,104.0,104.0,104.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">User</para>
@ -157,7 +143,7 @@
</td>
</tr>
</blockTable>
<blockTable colWidths="96.0,96.0,96.0,96.0,96.0" style="Table2">
<blockTable colWidths="104.0,104.0,104.0,104.0,104.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ get_user(objects) ]]</para>
@ -172,14 +158,14 @@
<para style="terp_default_Centre_8">[[ formatLang(statement.date,date = True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(statement.closing_date,date = True) ]]</para>
<para style="terp_default_Centre_8">[[ formatLang(statement.closing_date,date_time = True) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="161.0,161.0,161.0" style="Table3">
<blockTable colWidths="356.0,68.0,95.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_General">Product</para>
@ -196,22 +182,22 @@
<para style="terp_default_1">[[ repeatIn(get_data(statement), 'line_ids') and ' ' or removeParentNode('blockTable') ]]</para>
<section>
<para style="terp_default_1">[[ repeatIn(get_data(statement), 'line_ids')]]</para>
<blockTable colWidths="161.0,161.0,161.0" style="Table6">
<blockTable colWidths="356.0,69.0,95.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[[ line_ids['name'] ]]</para>
<para style="terp_default_9">[ [[line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
</td>
<td>
<para style="terp_default_9">[[ formatLang(line_ids['qty']) ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(line_ids['amt']) ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line_ids['amt']) ]] [[ company.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>
</section>
</section>
<blockTable colWidths="319.0,80.0,83.0" style="Table5">
<blockTable colWidths="357.0,69.0,94.0" style="Table5">
<tr>
<td>
<para style="P1">
@ -222,7 +208,7 @@
<para style="terp_tblheader_General_Right">Total :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(get_total()) ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ formatLang(get_total(statement)) ]] [[ company.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>

View File

@ -19,9 +19,8 @@
#
##############################################################################
import netsvc
import pooler, tools
import pooler
import tools
from osv import fields, osv
class Env(dict):
@ -139,7 +138,7 @@ class process_process(osv.osv):
if node.model_id and node.model_id.model == res_model:
try:
data['active'] = eval(node.model_states, expr_context)
except Exception, e:
except Exception:
pass
if not data['active']:
@ -169,23 +168,19 @@ class process_process(osv.osv):
button['state'] = b.state
button['action'] = b.action
buttons.append(button)
data['roles'] = roles = []
data['groups'] = groups = []
for r in tr.transition_ids:
if r.role_id:
role = {}
role['name'] = r.role_id.name
roles.append(role)
for r in tr.role_ids:
role = {}
role['name'] = r.name
roles.append(role)
if r.group_id:
groups.append({'name': r.group_id.name})
for r in tr.group_ids:
groups.append({'name': r.name})
transitions[tr.id] = data
# now populate resource information
def update_relatives(nid, ref_id, ref_model):
relatives = []
for tid, tr in transitions.items():
for dummy, tr in transitions.items():
if tr['source'] == nid:
relatives.append(tr['target'])
if tr['target'] == nid:
@ -349,7 +344,7 @@ class process_transition(osv.osv):
'target_node_id': fields.many2one('process.node', 'Target Node', required=True, ondelete='cascade'),
'action_ids': fields.one2many('process.transition.action', 'transition_id', 'Buttons'),
'transition_ids': fields.many2many('workflow.transition', 'process_transition_ids', 'ptr_id', 'wtr_id', 'Workflow Transitions'),
'role_ids': fields.many2many('res.roles', 'process_transition_roles_rel', 'tid', 'rid', 'Roles'),
'group_ids': fields.many2many('res.groups', 'process_transition_group_rel', 'tid', 'rid', string='Required Groups'),
'note': fields.text('Description', translate=True),
}
process_transition()

View File

@ -151,8 +151,6 @@
<field name="transition_id" ref="transition_confirm_quotation"/>
</record>
<!-- TODO: Transition roles (workflow transition ids) -->
</data>
</openerp>

View File

@ -282,9 +282,12 @@
</form>
</field>
</page>
<page string="Roles from Workflow">
<page string="Workflow Transitions">
<field name="transition_ids" colspan="4" nolabel="1"/>
</page>
<page string="Associated Groups">
<field name="group_ids" colspan="4" nolabel="1"/>
</page>
<page string="Notes">
<field name="note" nolabel="1" colspan="4"/>
</page>

View File

@ -238,7 +238,7 @@
</record>
<act_window
context="{'search_default_warehouse_id': [active_id]}"
context="{'search_default_warehouse_id': active_id}"
id="act_stock_warehouse_2_stock_warehouse_orderpoint"
name="Minimum Stock Rules"
res_model="stock.warehouse.orderpoint"

View File

@ -24,9 +24,9 @@ from mx import DateTime
from osv import osv
from tools.translate import _
import tools
import netsvc
import pooler
from tools.translate import _
class procurement_order(osv.osv):
_inherit = 'procurement.order'
@ -46,94 +46,96 @@ class procurement_order(osv.osv):
if not context:
context = {}
if use_new_cursor:
cr = pooler.get_db(use_new_cursor).cursor()
wf_service = netsvc.LocalService("workflow")
procurement_obj = self.pool.get('procurement.order')
if not ids:
ids = procurement_obj.search(cr, uid, [], order="date_planned")
for id in ids:
wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr)
if use_new_cursor:
cr.commit()
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
maxdate = DateTime.now() + DateTime.RelativeDateTime(days=company.schedule_range)
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
offset = 0
report = []
report_total = 0
report_except = 0
report_later = 0
allids = self.search(cr, uid, [])
while True:
cr.execute('select id from procurement_order where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
ids = map(lambda x: x[0], cr.fetchall())
for proc in procurement_obj.browse(cr, uid, ids):
if (maxdate.strftime('%Y-%m-%d') >= proc.date_planned):
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
else:
offset += 1
report_later += 1
for proc in procurement_obj.browse(cr, uid, ids):
if proc.state == 'exception':
report.append('PROC %d: on order - %3.2f %-5s - %s' % \
(proc.id, proc.product_qty, proc.product_uom.name,
proc.product_id.name))
report_except += 1
report_total += 1
try:
if use_new_cursor:
cr.commit()
cr = pooler.get_db(use_new_cursor).cursor()
wf_service = netsvc.LocalService("workflow")
procurement_obj = self.pool.get('procurement.order')
if not ids:
break
offset = 0
ids = []
while True:
report_ids = []
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
for proc in procurement_obj.browse(cr, uid, ids):
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) :
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
report_ids.append(proc.id)
else:
report_later += 1
report_total += 1
for proc in procurement_obj.browse(cr, uid, report_ids):
if proc.state == 'exception':
report.append('PROC %d: from stock - %3.2f %-5s - %s' % \
(proc.id, proc.product_qty, proc.product_uom.name,
proc.product_id.name,))
report_except += 1
ids = procurement_obj.search(cr, uid, [], order="date_planned")
for id in ids:
wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr)
if use_new_cursor:
cr.commit()
offset += len(ids)
if not ids: break
end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
if uid:
request = self.pool.get('res.request')
summary = '''Here is the procurement scheduling report.
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
maxdate = (DateTime.now() + DateTime.RelativeDateTime(days=company.schedule_range)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
offset = 0
report = []
report_total = 0
report_except = 0
report_later = 0
while True:
cr.execute("select id from procurement_order where state='confirmed' and procure_method='make_to_order' order by priority,date_planned limit 500 offset %s", (offset,))
ids = map(lambda x: x[0], cr.fetchall())
for proc in procurement_obj.browse(cr, uid, ids):
if maxdate >= proc.date_planned:
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
else:
offset += 1
report_later += 1
for proc in procurement_obj.browse(cr, uid, ids):
if proc.state == 'exception':
report.append('PROC %d: on order - %3.2f %-5s - %s' % \
(proc.id, proc.product_qty, proc.product_uom.name,
proc.product_id.name))
report_except += 1
report_total += 1
if use_new_cursor:
cr.commit()
if not ids:
break
offset = 0
ids = []
while True:
report_ids = []
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
for proc in procurement_obj.browse(cr, uid, ids):
if maxdate >= proc.date_planned:
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
report_ids.append(proc.id)
else:
report_later += 1
report_total += 1
for proc in procurement_obj.browse(cr, uid, report_ids):
if proc.state == 'exception':
report.append('PROC %d: from stock - %3.2f %-5s - %s' % \
(proc.id, proc.product_qty, proc.product_uom.name,
proc.product_id.name,))
report_except += 1
if use_new_cursor:
cr.commit()
offset += len(ids)
if not ids: break
end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
if uid:
request = self.pool.get('res.request')
summary = '''Here is the procurement scheduling report.
Start Time: %s
End Time: %s
Total Procurements processed: %d
Procurements with exceptions: %d
Skipped Procurements (scheduled date outside of scheduler range) %d
Exceptions:\n'''% (start_date, end_date, report_total, report_except, report_later)
summary += '\n'.join(report)
request.create(cr, uid,
{'name': "Procurement Processing Report.",
'act_from': uid,
'act_to': uid,
'body': summary,
})
Computation Started; %s
Computation Finished; %s
Total procurement: %d
Exception procurement: %d
Not run now procurement: %d
Exceptions;
'''% (start_date, end_date, report_total, report_except, report_later)
summary += '\n'.join(report)
request.create(cr, uid,
{'name': "Procurement calculation report.",
'act_from': uid,
'act_to': uid,
'body': summary,
})
if use_new_cursor:
cr.commit()
cr.close()
if use_new_cursor:
cr.commit()
finally:
if use_new_cursor:
try:
cr.close()
except Exception:
pass
return {}
def create_automatic_op(self, cr, uid, context=None):

View File

@ -24,7 +24,7 @@ import decimal_precision as dp
import math
from _common import rounding
import re
from tools.translate import _
def is_pair(x):
@ -502,6 +502,11 @@ class product_product(osv.osv):
if not len(ids):
ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context)
ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
if not len(ids):
ptrn=re.compile('(\[(.*?)\])')
res = ptrn.search(str(name))
if res:
ids = self.search(cr, user, [('default_code','ilike',res.group(2))]+ args, limit=limit, context=context)
else:
ids = self.search(cr, user, args, limit=limit, context=context)
result = self.name_get(cr, user, ids, context)

View File

@ -126,7 +126,7 @@
<xpath expr="/form/hpaned/child1/action[@string='My Delegated Tasks']" position="after">
<action colspan="4" height="100" name="%(action_view_my_project_issue_tree)d" string="My Issues" />
</xpath>
<xpath expr="/form/hpaned/child2/vpaned/child2/action[@string='Remaining Hours Per Project']" position="after">
<xpath expr="/form/hpaned/child2/vpaned/child2/action[@string='My Remaining Hours by Project']" position="after">
<action colspan="4" height="100" name="%(action_view_my_open_project_issue_tree)d" string="My Open Issues by Creation Date" />
</xpath>
</field>

View File

@ -149,7 +149,7 @@
<td>
<para style="terp_default_9">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
<para style="terp_default_Bold_9">Shipping address :</para>
<para style="terp_default_9">[[ addr.partner_id.title or '' ]] [[ addr.partner_id.name ]]</para>
<para style="terp_default_9">[[ addr.partner_id.title.name or '' ]] [[ addr.partner_id.name ]]</para>
<para style="terp_default_9">[[ addr.street ]]</para>
<para style="terp_default_9">[[ addr.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ addr.zip or '' ]] [[ addr.city or '' ]]</para>
@ -168,7 +168,7 @@
</para>
</td>
<td>
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_address_id.street ]]</para>
<para style="terp_default_9">[[ o.partner_address_id.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]]</para>
@ -186,12 +186,6 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_header">[[ o.state=='draft' and removeParentNode('para') ]] Purchase Order Confirmation N° [[ o.name ]]</para>
<para style="terp_header">[[ o.state&lt;&gt;'draft' and removeParentNode('para') ]] Request for Quotation N° [[ o.name ]]</para>
<para style="terp_default_8">
@ -250,7 +244,7 @@
<para style="terp_tblheader_Details_Right">Unit Price</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Net Price([[ o.pricelist_id.currency_id.code ]])</para>
<para style="terp_tblheader_Details_Right">Net Price</para>
</td>
</tr>
</blockTable>
@ -271,10 +265,10 @@
<para style="terp_default_Right_9">[[ formatLang(line.product_qty ) ]] [[ line.product_uom.name ]] </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.price_unit ) ]]</para>
<para style="Standard">[[ formatLang(line.price_unit, digits=get_digits(dp='Purchase Price') ) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.price_subtotal ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Purchase Price') ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
</td>
</tr>
<tr>
@ -320,7 +314,7 @@
<para style="terp_default_9">Net Total :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Purchase Price') ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
</td>
</tr>
<tr>
@ -346,7 +340,7 @@
<para style="terp_default_Bold_9">Total :</para>
</td>
<td>
<para style="terp_default_Bold_9_Right">[[ formatLang(o.amount_total ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
<para style="terp_default_Bold_9_Right">[[ formatLang(o.amount_total, digits=get_digits(dp='Purchase Price') ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
</td>
</tr>
</blockTable>
@ -364,4 +358,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>

View File

@ -88,7 +88,7 @@
</para>
</td>
<td>
<para style="terp_default_9">[[ (order.partner_id and order.partner_id.title) or '' ]] [[ order.partner_id.name ]]</para>
<para style="terp_default_9">[[ (order.partner_id and order.partner_id.title.name) or '' ]] [[ order.partner_id.name ]]</para>
<para style="terp_default_9">[[ (order.partner_address_id and order.partner_address_id.street) or '']]</para>
<para style="terp_default_9">[[ (order.partner_address_id.street2) or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ (order.partner_address_id and order.partner_address_id.zip) or '' ]][[ (order.partner_address_id and order.partner_address_id.city) or '' ]]</para>
@ -125,7 +125,7 @@
</blockTable>
<section>
<para style="terp_default_9">[[repeatIn(order.order_line,'order_line')]]</para>
<blockTable colWidths="370.0,100.0,39.0,20.0" style="Table_Product_Line">
<blockTable colWidths="371.0,100.0,39.0,20.0" style="Table_Product_Line">
<tr>
<td>
<para style="terp_default_9">[[ order_line.name ]]</para>

View File

@ -28,9 +28,6 @@ class stock_move(osv.osv):
'Purchase Order Line', ondelete='set null', select=True,
readonly=True),
}
_defaults = {
'purchase_line_id': False
}
def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None):
"""
@ -73,47 +70,39 @@ class stock_picking(osv.osv):
return picking.note + '\n' + picking.purchase_id.notes
else:
return picking.purchase_id.notes
return super(stock_picking, self)._get_comment_invoice(cursor, user,
picking)
return super(stock_picking, self)._get_comment_invoice(cursor, user, picking)
def _get_price_unit_invoice(self, cursor, user, move_line, type):
if move_line.purchase_line_id:
return move_line.purchase_line_id.price_unit
return super(stock_picking, self)._get_price_unit_invoice(cursor,
user, move_line, type)
return super(stock_picking, self)._get_price_unit_invoice(cursor, user, move_line, type)
def _get_discount_invoice(self, cursor, user, move_line):
if move_line.purchase_line_id:
return 0.0
return super(stock_picking, self)._get_discount_invoice(cursor, user,
move_line)
return super(stock_picking, self)._get_discount_invoice(cursor, user, move_line)
def _get_taxes_invoice(self, cursor, user, move_line, type):
if move_line.purchase_line_id:
return [x.id for x in move_line.purchase_line_id.taxes_id]
return super(stock_picking, self)._get_taxes_invoice(cursor, user,
move_line, type)
return super(stock_picking, self)._get_taxes_invoice(cursor, user, move_line, type)
def _get_account_analytic_invoice(self, cursor, user, picking, move_line):
if move_line.purchase_line_id:
return move_line.purchase_line_id.account_analytic_id.id
return super(stock_picking, self)._get_account_analytic_invoice(cursor,
user, picking, move_line)
return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id):
if move_line.purchase_line_id:
invoice_line_obj = self.pool.get('account.invoice.line')
invoice_line_obj.write(cursor, user, [invoice_line_id], {'note': move_line.purchase_line_id.notes,})
return super(stock_picking, self)._invoice_line_hook(cursor, user,
move_line, invoice_line_id)
invoice_line_obj.write(cursor, user, [invoice_line_id], {'note': move_line.purchase_line_id.notes,})
return super(stock_picking, self)._invoice_line_hook(cursor, user, move_line, invoice_line_id)
def _invoice_hook(self, cursor, user, picking, invoice_id):
purchase_obj = self.pool.get('purchase.order')
if picking.purchase_id:
purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoice_id': invoice_id,
})
return super(stock_picking, self)._invoice_hook(cursor, user,
picking, invoice_id)
purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoice_id': invoice_id,})
return super(stock_picking, self)._invoice_hook(cursor, user, picking, invoice_id)
stock_picking()
@ -132,11 +121,13 @@ class stock_partial_picking(osv.osv_memory):
pick_obj = self.pool.get('stock.picking')
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
has_product_cost = (pick.type == 'in' and pick.purchase_id)
for m in pick.move_lines:
if (m.product_id.cost_method == 'average'):
if pick.type == 'in' and pick.purchase_id and m.purchase_line_id:
res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit
res['move%s_product_currency'%(m.id)] = pick.purchase_id.pricelist_id.currency_id.id
if has_product_cost and m.product_id.cost_method == 'average' and m.purchase_line_id:
# We use the original PO unit purchase price as the basis for the cost, expressed
# in the currency of the PO (i.e the PO's pricelist currency)
res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit
res['move%s_product_currency'%(m.id)] = pick.purchase_id.pricelist_id.currency_id.id
return res
stock_partial_picking()
@ -154,10 +145,12 @@ class stock_partial_move(osv.osv_memory):
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
move_obj = self.pool.get('stock.move')
for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if (m.product_id.cost_method == 'average'):
if m.picking_id.type == 'in' and m.purchase_line_id and m.picking_id.purchase_id:
if m.picking_id.type == 'in' and m.product_id.cost_method == 'average' \
and m.purchase_line_id and m.picking_id.purchase_id:
# We use the original PO unit purchase price as the basis for the cost, expressed
# in the currency of the PO (i.e the PO's pricelist currency)
res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit
res['move%s_product_currency'%(m.id)] = m.picking_id.purchase_id.pricelist_id.currency_id.id
res['move%s_product_currency'%(m.id)] = m.picking_id.purchase_id.pricelist_id.currency_id.id
return res
stock_partial_move()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -133,10 +133,6 @@
Process Transition
-->
<record id="res_roles_salesman0" model="res.roles">
<field eval="&quot;&quot;&quot;Salesman&quot;&quot;&quot;" name="name"/>
</record>
<record id="process_transition_confirmquotation0" model="process.transition">
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Confirm Quotation&quot;&quot;&quot;" name="name"/>

View File

@ -132,7 +132,7 @@
<tr>
<td>
<para style="terp_default_Bold_9">Shipping address :</para>
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_shipping_id.street ]]</para>
<para style="terp_default_9">[[ o.partner_shipping_id.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ o.partner_shipping_id.zip or '' ]] [[ o.partner_shipping_id.city or '' ]]</para>
@ -142,7 +142,7 @@
<font color="white"> </font>
</para>
<para style="terp_default_Bold_9">Invoice address :</para>
<para style="terp_default_9">[[ o.partner_invoice_id.title or '' ]] [[ o.partner_invoice_id.name or '' ]]</para>
<para style="terp_default_9">[[ o.partner_invoice_id.title.name or '' ]] [[ o.partner_invoice_id.name or '' ]]</para>
<para style="terp_default_9">[[ o.partner_invoice_id.street ]] </para>
<para style="terp_default_9">[[ (o.partner_invoice_id.street2 and (', %s' % o.partner_invoice_id.street2)) or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ o.partner_invoice_id.zip or '' ]] [[ o.partner_invoice_id.city or '' ]]</para>
@ -155,7 +155,7 @@
</para>
</td>
<td>
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_order_id.street ]]</para>
<para style="terp_default_9">[[ o.partner_order_id.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ o.partner_order_id.zip or '' ]] [[ o.partner_order_id.city or '' ]]</para>
@ -234,7 +234,7 @@
<para style="terp_tblheader_Details_Right">Disc.(%)</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Price([[ o.pricelist_id.currency_id.code ]])</para>
<para style="terp_tblheader_Details_Right">Price</para>
</td>
</tr>
</blockTable>
@ -243,7 +243,7 @@
<blockTable colWidths="203.0,94.0,47.0,22.0,59.0,42.0,70.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">[[ line.name ]]</para>
<para style="terp_default_9">[[ line.name ]] </para>
</td>
<td>
<para style="terp_default_Centre_9">[[ ', '.join(map(lambda x: x.name, line.tax_id)) ]]</para>
@ -258,10 +258,10 @@
<para style="terp_default_Right_9">[[ formatLang(line.price_unit ) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.discount) ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line.discount, digits=get_digits(dp='Sale Price')) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.price_subtotal ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
</td>
</tr>
<tr>
@ -312,7 +312,7 @@
<para style="terp_default_9">Net Total :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed , digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
</td>
</tr>
<tr>
@ -325,7 +325,7 @@
<para style="terp_default_9">Taxes :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax , digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
</td>
</tr>
<tr>
@ -338,7 +338,7 @@
<para style="terp_default_Bold_9">Total :</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]] </para>
<para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total , digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id. symbol ]] </para>
</td>
</tr>
</blockTable>
@ -361,4 +361,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>

View File

@ -26,28 +26,12 @@ class stock_move(osv.osv):
_columns = {
'sale_line_id': fields.many2one('sale.order.line', 'Sale Order Line', ondelete='set null', select=True, readonly=True),
}
_defaults = {
'sale_line_id': False
}
def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None):
"""
Overrides the default stock valuation to take into account the currency that was specified
on the sale order in case the valuation data was not directly specified during picking
confirmation.
"""
reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context)
if move.product_id.cost_method != 'average' or not move.price_unit:
# no average price costing or cost not specified during picking validation, we will
# plug the sale line values if they are found.
if move.sale_line_id and move.picking_id.sale_id.pricelist_id:
reference_amount, reference_currency_id = move.sale_line_id.price_unit, move.picking_id.sale_id.pricelist_id.currency_id.id
return reference_amount, reference_currency_id
def _create_chained_picking(self, cr, uid, pick_name,picking,ptype,move, context=None):
res=super(stock_move, self)._create_chained_picking(cr, uid, pick_name,picking,ptype,move, context=context)
if picking.sale_id:
picking_obj = self.pool.get('stock.picking').write(cr,uid,[res],{'sale_id':picking.sale_id.id})
return res
self.pool.get('stock.picking').write(cr,uid,[res],{'sale_id':picking.sale_id.id})
return res
stock_move()
class stock_picking(osv.osv):
@ -66,11 +50,9 @@ class stock_picking(osv.osv):
return super(stock_picking, self).get_currency_id(cursor, user, picking)
def _get_payment_term(self, cursor, user, picking):
res = {}
if picking.sale_id and picking.sale_id.payment_term:
return picking.sale_id.payment_term.id
return super(stock_picking, self)._get_payment_term(cursor,
user, picking)
return super(stock_picking, self)._get_payment_term(cursor, user, picking)
def _get_address_invoice(self, cursor, user, picking):
res = {}
@ -78,47 +60,42 @@ class stock_picking(osv.osv):
res['contact'] = picking.sale_id.partner_order_id.id
res['invoice'] = picking.sale_id.partner_invoice_id.id
return res
return super(stock_picking, self)._get_address_invoice(cursor,
user, picking)
return super(stock_picking, self)._get_address_invoice(cursor, user, picking)
def _get_comment_invoice(self, cursor, user, picking):
if picking.note or (picking.sale_id and picking.sale_id.note):
return picking.note or picking.sale_id.note
return super(stock_picking, self)._get_comment_invoice(cursor, user,
picking)
return super(stock_picking, self)._get_comment_invoice(cursor, user, picking)
def _get_price_unit_invoice(self, cursor, user, move_line, type):
if move_line.sale_line_id and move_line.sale_line_id.product_id.id == move_line.product_id.id:
return move_line.sale_line_id.price_unit
return super(stock_picking, self)._get_price_unit_invoice(cursor,
user, move_line, type)
return super(stock_picking, self)._get_price_unit_invoice(cursor, user, move_line, type)
def _get_discount_invoice(self, cursor, user, move_line):
if move_line.sale_line_id:
return move_line.sale_line_id.discount
return super(stock_picking, self)._get_discount_invoice(cursor, user,
move_line)
return super(stock_picking, self)._get_discount_invoice(cursor, user, move_line)
def _get_taxes_invoice(self, cursor, user, move_line, type):
if move_line.sale_line_id and move_line.sale_line_id.product_id.id == move_line.product_id.id:
return [x.id for x in move_line.sale_line_id.tax_id]
return super(stock_picking, self)._get_taxes_invoice(cursor, user,
move_line, type)
return super(stock_picking, self)._get_taxes_invoice(cursor, user, move_line, type)
def _get_account_analytic_invoice(self, cursor, user, picking, move_line):
if picking.sale_id:
return picking.sale_id.project_id.id
return super(stock_picking, self)._get_account_analytic_invoice(cursor,
user, picking, move_line)
return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id):
sale_line_obj = self.pool.get('sale.order.line')
if move_line.sale_line_id:
sale_line_obj.write(cursor, user, [move_line.sale_line_id.id], {'invoiced':True,
'invoice_lines': [(4, invoice_line_id)],
})
return super(stock_picking, self)._invoice_line_hook(cursor, user,
move_line, invoice_line_id)
sale_line_obj.write(cursor, user, [move_line.sale_line_id.id],
{
'invoiced': True,
'invoice_lines': [(4, invoice_line_id)],
})
return super(stock_picking, self)._invoice_line_hook(cursor, user, move_line, invoice_line_id)
def _invoice_hook(self, cursor, user, picking, invoice_id):
sale_obj = self.pool.get('sale.order')
@ -126,8 +103,7 @@ class stock_picking(osv.osv):
sale_obj.write(cursor, user, [picking.sale_id.id], {
'invoice_ids': [(4, invoice_id)],
})
return super(stock_picking, self)._invoice_hook(cursor, user,
picking, invoice_id)
return super(stock_picking, self)._invoice_hook(cursor, user, picking, invoice_id)
def action_invoice_create(self, cursor, user, ids, journal_id=False,
group=False, type='out_invoice', context=None):
@ -227,47 +203,4 @@ class stock_picking(osv.osv):
stock_picking()
class stock_partial_picking(osv.osv_memory):
_inherit = 'stock.partial.picking'
def default_get(self, cr, uid, fields, context=None):
""" To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
pick_obj = self.pool.get('stock.picking')
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
for m in pick.move_lines:
if (m.product_id.cost_method == 'average'):
if pick.type == 'out' and pick.sale_id and m.sale_line_id:
res['move%s_product_price'%(m.id)] = m.sale_line_id.price_unit
res['move%s_product_currency'%(m.id)] = pick.sale_id.pricelist_id.currency_id.id
return res
stock_partial_picking()
class stock_partial_move(osv.osv_memory):
_inherit = "stock.partial.move"
def default_get(self, cr, uid, fields, context=None):
""" To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
move_obj = self.pool.get('stock.move')
for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if (m.product_id.cost_method == 'average'):
if m.picking_id.type == 'out' and m.sale_line_id and m.picking_id.sale_id:
res['move%s_product_price'%(m.id)] = m.sale_line_id.price_unit
res['move%s_product_currency'%(m.id)] = m.picking_id.sale_id.pricelist_id.currency_id.id
return res
stock_partial_move()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -83,8 +83,7 @@
<field name="type">form</field>
<field name="inherit_id" ref="crm.board_crm_form"/>
<field name="arch" type="xml">
<xpath expr="/form/hpaned/child2/action[@name='%(crm.act_sales_pipeline)d']" position="attributes">
<attribute name="string">My Sales Pipeline</attribute>
<xpath expr="/form/hpaned/child2/action[@name='%(crm.act_sales_pipeline)d']" position="replace">
</xpath>
</field>
</record>

View File

@ -191,7 +191,7 @@
<tr>
<td>
<para style="terp_default_Bold_9">Shipping address :</para>
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_shipping_id.street ]]</para>
<para style="terp_default_9">[[ o.partner_shipping_id.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ o.partner_shipping_id.city or '' ]] [[ o.partner_shipping_id.zip or '' ]]</para>
@ -214,7 +214,7 @@
</para>
</td>
<td>
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
<para style="terp_default_9">[[ o.partner_order_id.street ]]</para>
<para style="terp_default_9">[[ o.partner_order_id.street2 or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ o.partner_order_id.zip or '' ]] [[ o.partner_order_id.city or '' ]]</para>
@ -293,7 +293,7 @@
<para style="terp_tblheader_Details_Right">Disc.(%)</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Price([[ o.pricelist_id.currency_id.code ]])</para>
<para style="terp_tblheader_Details_Right">Price</para>
</td>
</tr>
</blockTable>
@ -384,7 +384,7 @@
<para style="terp_default_9">Net Total :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Sale Price') ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
</td>
</tr>
<tr>
@ -397,7 +397,7 @@
<para style="terp_default_9">Taxes :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax, digits=get_digits(dp='Sale Price') ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
</td>
</tr>
<tr>
@ -410,7 +410,7 @@
<para style="terp_default_Bold_9">Total :</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total, digits=get_digits(dp='Sale Price') ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Packing List" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Picking List" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="0.0" y1="57.0" width="538" height="728"/>
</pageTemplate>
@ -125,7 +125,7 @@
<tr>
<td>
<para style="terp_default_Bold_9">Shipping Address :</para>
<para style="terp_default_9">[[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]]</para>
<para style="terp_default_9">[[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title.name) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.street or '' ]]</para>
<para style="terp_default_9">[[ (picking.address_id and picking.address_id.street2) or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.zip or '' ]] [[ picking.address_id and picking.address_id.city or '' ]]</para>
@ -134,7 +134,7 @@
</td>
<td>
<para style="terp_default_Bold_9">Contact Address :</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.title or '' ]] [[ picking.address_id and picking.address_id.name or '' ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.title.name or '' ]] [[ picking.address_id and picking.address_id.name or '' ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.street or '' ]]</para>
<para style="terp_default_9">[[ (picking.address_id and picking.address_id.street2) or removeParentNode('para') ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.zip or '' ]] [[ picking.address_id and picking.address_id.city or '' ]]</para>
@ -181,7 +181,7 @@
<para style="terp_default_Centre_8">[[ picking.origin or '']]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ (picking.address_id and picking.address_id.title) or '' ]] [[ (picking.address_id and picking.address_id.name) or '' ]] </para>
<para style="terp_default_Centre_8">[[ (picking.address_id and picking.address_id.title.name) or '' ]] [[ (picking.address_id and picking.address_id.name) or '' ]] </para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(picking.min_date,date_time = True) ]]</para>
@ -214,8 +214,8 @@
</tr>
</blockTable>
<section>
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state == 'confirmed' or line.state=='done' or line.state=='assigned')],'move_lines') ]]</para>
[[ picking.move_lines or removeParentNode('section')]]
<para style="terp_default_2">[[ repeatIn([line for line in picking.move_lines if (line.state == 'confirmed' or line.state=='done' or line.state=='assigned')],'move_lines') ]]</para>
<para style="terp_default_2">[[ (picking.move_lines!=[] and removeParentNode('para')) or removeParentNode('section')]]</para>
<blockTable colWidths="256.0,74.0,58.0,60.0,73.0" style="Move_Line_Contect_Assign_State">
<tr>
<td>
@ -238,8 +238,8 @@
</section>
<para style="terp_default_Bold_9">[[ ([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting' )]) and 'Non Assigned Products:' or removeParentNode('para') ]]</para>
<section>
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting')],'move_lines') ]] </para>
[[ picking.move_lines or removeParentNode('section')]]
<para style="terp_default_2">[[ repeatIn([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting')],'move_lines') ]] </para>
<para style="terp_default_2">[[ (picking.move_lines!=[] and removeParentNode('para')) or removeParentNode('section')]]</para>
<blockTable colWidths="256.0,74.0,57.0,61.0,72.0" style="Move_Line_Content_Other_State">
<tr>
<td>

View File

@ -25,7 +25,6 @@ from operator import itemgetter
from itertools import groupby
from osv import fields, osv
from tools import config
from tools.translate import _
import netsvc
import tools
@ -731,21 +730,29 @@ class stock_picking(osv.osv):
'button_confirm', cr)
return True
def draft_validate(self, cr, uid, ids, *args):
def draft_validate(self, cr, uid, ids, context=None):
""" Validates picking directly from draft state.
@return: True
"""
if context is None:
context = {}
wf_service = netsvc.LocalService("workflow")
self.draft_force_assign(cr, uid, ids)
for pick in self.browse(cr, uid, ids):
move_ids = [x.id for x in pick.move_lines]
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
self.action_move(cr, uid, [pick.id])
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
return True
context.update({'active_ids':ids})
return {
'name': 'Make Picking',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.partial.picking',
'type': 'ir.actions.act_window',
'target': 'new',
'nodestroy': True,
'context':context
}
def cancel_assign(self, cr, uid, ids, *args):
""" Cancels picking and moves.
@return: True
@ -1101,8 +1108,6 @@ class stock_picking(osv.osv):
delivery moves with product_id, product_qty, uom
@return: Dictionary of values
"""
import pdb
#pdb.set_trace()
if context is None:
context = {}
else:
@ -1112,15 +1117,10 @@ class stock_picking(osv.osv):
product_obj = self.pool.get('product.product')
currency_obj = self.pool.get('res.currency')
uom_obj = self.pool.get('product.uom')
price_type_obj = self.pool.get('product.price.type')
sequence_obj = self.pool.get('ir.sequence')
wf_service = netsvc.LocalService("workflow")
partner_id = partial_datas.get('partner_id', False)
address_id = partial_datas.get('address_id', False)
delivery_date = partial_datas.get('delivery_date', False)
for pick in self.browse(cr, uid, ids, context=context):
new_picking = None
new_moves = []
complete, too_many, too_few = [], [], []
move_product_qty = {}
prodlot_ids = {}
@ -1194,7 +1194,7 @@ class stock_picking(osv.osv):
prodlot_id = prodlot_ids[move.id]
if prodlot_id:
defaults.update(prodlot_id=prodlot_id)
new_obj = move_obj.copy(cr, uid, move.id, defaults)
move_obj.copy(cr, uid, move.id, defaults)
move_obj.write(cr, uid, [move.id],
{
@ -1442,7 +1442,7 @@ class stock_move(osv.osv):
'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'),
'create_date': fields.datetime('Creation Date', readonly=True),
'date': fields.datetime('Date', required=True, help="Move date: scheduled date until move is done, then date of actual move processing", readonly=True),
'date_expected': fields.datetime('Scheduled Date', required=True, help="Scheduled date for the processing of this move"),
'date_expected': fields.datetime('Scheduled Date', states={'done': [('readonly', True)]},required=True, help="Scheduled date for the processing of this move"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')],states={'done': [('readonly', True)]}),
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True,states={'done': [('readonly', True)]}),
@ -1694,23 +1694,23 @@ class stock_move(osv.osv):
"""
moves = self.browse(cr, uid, ids)
self.write(cr, uid, ids, {'state': 'confirmed'})
i = 0
res_obj = self.pool.get('res.company')
location_obj = self.pool.get('stock.location')
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
def create_chained_picking(self, cr, uid, moves, context=None):
new_moves = []
res_obj = self.pool.get('res.company')
picking_obj = self.pool.get('stock.picking')
move_obj = self.pool.get('stock.move')
if context is None:
context = {}
for picking, todo in self._chain_compute(cr, uid, moves, context=context).items():
ptype = todo[0][1][5] and todo[0][1][5] or self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
pick_name = picking.name or ''
if picking:
pickid = self._create_chained_picking(cr, uid, pick_name,picking,ptype,todo,context)
else:
pickid = False
for move, (loc, auto, delay, journal, company_id, ptype) in todo:
for move, (loc, dummy, delay, dummy, company_id, ptype) in todo:
new_id = move_obj.copy(cr, uid, move.id, {
'location_id': move.location_dest_id.id,
'location_dest_id': loc.id,
@ -1728,7 +1728,6 @@ class stock_move(osv.osv):
})
new_moves.append(self.browse(cr, uid, [new_id])[0])
if pickid:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
if new_moves:
create_chained_picking(self, cr, uid, new_moves, context)
@ -1888,9 +1887,7 @@ class stock_move(osv.osv):
These reference values should possibly be converted before being posted in Journals to adapt to the primary
and secondary currencies of the relevant accounts.
"""
product_obj=self.pool.get('product.product')
product_uom_obj = self.pool.get('product.uom')
price_type_obj = self.pool.get('product.price.type')
# by default the reference currency is that of the move's company
reference_currency_id = move.company_id.currency_id.id
@ -1957,12 +1954,8 @@ class stock_move(osv.osv):
""" Makes the move done and if all moves are done, it will finish the picking.
@return:
"""
track_flag = False
partial_datas=''
picking_ids = []
product_uom_obj = self.pool.get('product.uom')
price_type_obj = self.pool.get('product.price.type')
product_obj = self.pool.get('product.product')
partial_obj=self.pool.get('stock.partial.picking')
partial_id=partial_obj.search(cr,uid,[])
if partial_id:
@ -1987,8 +1980,6 @@ class stock_move(osv.osv):
if move.move_dest_id.picking_id:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
else:
pass
if move.move_dest_id.auto_validate:
self.action_done(cr, uid, [move.move_dest_id.id], context=context)
@ -2253,20 +2244,12 @@ class stock_move(osv.osv):
like partner_id, address_id, delivery_date, delivery
moves with product_id, product_qty, uom
"""
import pdb
#pdb.set_trace()
res = {}
picking_obj = self.pool.get('stock.picking')
product_obj = self.pool.get('product.product')
currency_obj = self.pool.get('res.currency')
uom_obj = self.pool.get('product.uom')
price_type_obj = self.pool.get('product.price.type')
sequence_obj = self.pool.get('ir.sequence')
wf_service = netsvc.LocalService("workflow")
partner_id = partial_datas.get('partner_id', False)
address_id = partial_datas.get('address_id', False)
delivery_date = partial_datas.get('delivery_date', False)
new_moves = []
if context is None:
context = {}
@ -2533,16 +2516,16 @@ class stock_picking_move_wizard(osv.osv_memory):
def _get_picking(self, cr, uid, ctx=None):
if ctx is None:
ctx = {}
if ctx.get('action_id', False):
return ctx['action_id']
if ctx.get('active_id', False):
return ctx['active_id']
return False
def _get_picking_address(self, cr, uid, context=None):
picking_obj = self.pool.get('stock.picking')
if context is None:
context = {}
if context.get('action_id', False):
picking = picking_obj.browse(cr, uid, [context['action_id']])[0]
if context.get('active_id', False):
picking = picking_obj.browse(cr, uid, [context['active_id']])[0]
return picking.address_id and picking.address_id.id or False
return False

View File

@ -264,6 +264,7 @@
<field name="invoice_state">2binvoiced</field>
<field name="address_id" ref="base.main_address"/>
<field name="company_id" ref="base.main_company"/>
<field name="partner_id" ref="base.main_partner"/>
</record>
</data>
</openerp>

View File

@ -101,7 +101,7 @@
string="Split inventory lines" groups="base.group_extended"
type="action" icon="terp-stock_effects-object-colorize" states="draft"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id"/>
<field name="state" />
<field name="state" invisible="True"/>
</tree>
<form string="Products ">
<field colspan="4" context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" domain="[('type','&lt;&gt;','service')]"/>
@ -127,7 +127,7 @@
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date" string="Date"/>
<field name="state"/>
<field name="state" invisible="True"/>
</tree>
</field>
</page>
@ -394,7 +394,7 @@
<field name="date" string="Date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -624,7 +624,7 @@
<field name="invoice_state"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="confirmed,assigned" string="Approve Picking" type="action" icon="gtk-go-forward"/>
<button name="%(action_partial_picking)d" states="confirmed,assigned" string="Process" type="action" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -741,13 +741,13 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Confirm (Do Not Process Now)" type="object" icon="gtk-apply"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-apply"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve" type="action" icon="gtk-apply"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@ -816,7 +816,7 @@
<field name="invoice_state"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve Picking" type="action" icon="gtk-go-forward"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -872,7 +872,7 @@
<field name="date"/>
<field name="state"/>
<button name="%(action_partial_move)d" string="Partial" type="action" states="confirmed,assigned" icon="gtk-justify-fill"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
</tree>
<form string="Stock Moves">
<group colspan="2" col="4">
@ -931,13 +931,13 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-yes"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Done" type="action" icon="gtk-execute"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@ -1032,7 +1032,7 @@
<field name="invoice_state" groups="base.group_extended"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Receive products" type="action" icon="gtk-ok"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" confirm="This operation will cancel the shipment. Do you want to continue?" />
</tree>
</field>
@ -1146,13 +1146,13 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Products Received" type="action" icon="gtk-ok"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional Info" groups="base.group_extended,base.group_multi_company">
@ -1327,7 +1327,7 @@
<field name="date"/>
<field name="date_expected"/>
<field name="state"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-ok"/>
<button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -1395,7 +1395,7 @@
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="action_cancel" states="assigned,confirmed" string="_Cancel" type="object" icon="gtk-cancel"/>
<button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="assigned" string="Process" type="object" icon="gtk-jump-to"/>
</group>
</form>
</field>
@ -1499,7 +1499,7 @@
<field name="state"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="%(action_partial_move)d" string="Partial" type="action" states="confirmed,assigned" icon="gtk-justify-fill"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -1517,7 +1517,7 @@
<field name="product_qty" />
<field name="product_uom" string="UoM"/>
<field name="date"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -1583,7 +1583,7 @@
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="action_cancel" states="assigned,confirmed" string="_Cancel" type="object" icon="gtk-cancel"/>
<button name="%(action_partial_move)d" states="assigned,confirmed" string="Partial" type="action" icon="gtk-justify-fill"/>
<button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
@ -1611,7 +1611,6 @@
<filter string="Supplier" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Order" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'origin'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>

View File

@ -40,7 +40,6 @@ class stock_partial_move(osv.osv_memory):
if m.state in ('done', 'cancel'):
raise osv.except_osv(_('Invalid action !'), _('Cannot deliver products which are already delivered !'))
if 'move%s_product_id'%(m.id) not in self._columns:
self._columns['move%s_product_id'%(m.id)] = fields.many2one('product.product',string="Product")
if 'move%s_product_qty'%(m.id) not in self._columns:
@ -52,9 +51,9 @@ class stock_partial_move(osv.osv_memory):
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
if 'move%s_product_price'%(m.id) not in self._columns:
self._columns['move%s_product_price'%(m.id)] = fields.float("Price")
self._columns['move%s_product_price'%(m.id)] = fields.float("Cost", help="Unit Cost for this product line")
if 'move%s_product_currency'%(m.id) not in self._columns:
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency',string="Currency")
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency', string="Currency", help="Currency in which Unit cost is expressed")
return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
@ -109,14 +108,15 @@ class stock_partial_move(osv.osv_memory):
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
_moves_fields.update({
'move%s_product_price'%(m.id) : {
'string': _('Price'),
'string': _('Cost'),
'type' : 'float',
'help': _('Unit Cost for this product line'),
},
'move%s_product_currency'%(m.id): {
'string': _('Currency'),
'type' : 'float',
'type' : 'many2one',
'relation': 'res.currency',
'help': _("Currency in which Unit Cost is expressed"),
}
})
_moves_arch_lst += """
@ -162,8 +162,6 @@ class stock_partial_move(osv.osv_memory):
if m.state in ('done', 'cancel'):
continue
res['type'] = m.picking_id and m.picking_id.type or ''
if 'move%s_product_id'%(m.id) in fields:
res['move%s_product_id'%(m.id)] = m.product_id.id
if 'move%s_product_qty'%(m.id) in fields:
@ -171,10 +169,12 @@ class stock_partial_move(osv.osv_memory):
if 'move%s_product_uom'%(m.id) in fields:
res['move%s_product_uom'%(m.id)] = m.product_uom.id
if 'move%s_prodlot_id'%(m.id) in fields:
res['move%s_prodlot_id'%(m.id)] = m.prodlot_id.id
if m.product_id.cost_method == 'average' :
res['move%s_prodlot_id'%(m.id)] = m.prodlot_id.id
if m.picking_id.type == 'in' and m.product_id.cost_method == 'average':
# Always use default product cost and currency from Product Form,
# which belong to the Company owning the product
currency = m.product_id.company_id.currency_id.id
price = m.product_id.standard_price
currency = False
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:
@ -204,7 +204,7 @@ class stock_partial_move(osv.osv_memory):
'product_id' : getattr(partial, 'move%s_product_id'%(m.id)).id,
'product_qty' : getattr(partial, 'move%s_product_qty'%(m.id)),
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id,
'prodlot_id' : getattr(partial, 'move%s_prodlot_id'%(m.id)).id
'prodlot_id' : getattr(partial, 'move%s_prodlot_id'%(m.id)).id
}
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):

View File

@ -35,8 +35,8 @@ class stock_partial_picking(osv.osv_memory):
pick_obj = self.pool.get('stock.picking')
if not context:
context={}
moveids = []
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
need_product_cost = (pick.type == 'in')
for m in pick.move_lines:
if m.state in ('done', 'cancel'):
continue
@ -49,11 +49,11 @@ class stock_partial_picking(osv.osv_memory):
if 'move%s_prodlot_id'%(m.id) not in self._columns:
self._columns['move%s_prodlot_id'%(m.id)] = fields.many2one('stock.production.lot', string="Lot")
if (m.product_id.cost_method == 'average'):
if (need_product_cost and m.product_id.cost_method == 'average'):
if 'move%s_product_price'%(m.id) not in self._columns:
self._columns['move%s_product_price'%(m.id)] = fields.float("Price")
self._columns['move%s_product_price'%(m.id)] = fields.float("Cost", help="Unit Cost for this product line")
if 'move%s_product_currency'%(m.id) not in self._columns:
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency',string="Currency")
self._columns['move%s_product_currency'%(m.id)] = fields.many2one('res.currency', string="Currency", help="Currency in which Unit cost is expressed")
return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
@ -70,6 +70,7 @@ class stock_partial_picking(osv.osv_memory):
_moves_fields = result['fields']
if picking_ids and view_type in ['form']:
for pick in pick_obj.browse(cr, uid, picking_ids, context):
need_product_cost = (pick.type == 'in')
for m in pick.move_lines:
if m.state in ('done', 'cancel'):
continue
@ -107,17 +108,19 @@ class stock_partial_picking(osv.osv_memory):
<field name="move%s_product_uom" nolabel="1" />
<field name="move%s_prodlot_id" domain="[('product_id','=',move%s_product_id)]" groups="base.group_extended" />
"""%(m.id, m.id, m.id, m.id,m.id)
if (m.product_id.cost_method == 'average'):
if (need_product_cost and m.product_id.cost_method == 'average'):
_moves_fields.update({
'move%s_product_price'%(m.id) : {
'string': _('Price'),
'string': _('Cost'),
'type' : 'float',
'help': _('Unit Cost for this product line'),
},
'move%s_product_currency'%(m.id): {
'string': _('Currency'),
'type' : 'float',
'type' : 'many2one',
'relation': 'res.currency',
'help': _("Currency in which Unit Cost is expressed"),
}
})
_moves_arch_lst += """
@ -155,10 +158,10 @@ class stock_partial_picking(osv.osv_memory):
pick_obj = self.pool.get('stock.picking')
if not context:
context={}
moveids = []
if 'date' in fields:
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
need_product_cost = (pick.type == 'in')
for m in pick.move_lines:
if m.state in ('done', 'cancel'):
continue
@ -170,8 +173,10 @@ class stock_partial_picking(osv.osv_memory):
res['move%s_product_uom'%(m.id)] = m.product_uom.id
if 'move%s_prodlot_id'%(m.id) in fields:
res['move%s_prodlot_id'%(m.id)] = m.prodlot_id.id
if (m.product_id.cost_method == 'average'):
currency = False
if (need_product_cost and m.product_id.cost_method == 'average'):
# Always use default product cost and currency from Product Form,
# which belong to the Company owning the product
currency = m.product_id.company_id.currency_id.id
price = m.product_id.standard_price
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
@ -195,6 +200,7 @@ class stock_partial_picking(osv.osv_memory):
'delivery_date' : partial.date
}
for pick in pick_obj.browse(cr, uid, picking_ids):
need_product_cost = (pick.type == 'in')
for m in pick.move_lines:
if m.state in ('done', 'cancel'):
continue
@ -205,12 +211,12 @@ class stock_partial_picking(osv.osv_memory):
'prodlot_id' : getattr(partial, 'move%s_prodlot_id'%(m.id)).id
}
if (m.product_id.cost_method == 'average'):
if (need_product_cost and m.product_id.cost_method == 'average'):
partial_datas['move%s'%(m.id)].update({
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
})
res = pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
return {}
stock_partial_picking()

View File

@ -11,7 +11,7 @@
move_lines:
- company_id: base.main_company
date_expected: '2010-08-03 11:05:47'
date_planned: '2010-08-03 11:05:47'
date: '2010-08-03 11:05:47'
location_id: stock.stock_location_stock
product_id: product.product_product_pc1
product_qty: 3.0

View File

@ -20,6 +20,6 @@
##############################################################################
import stock_location
import mrp_pull
import procurement_pull
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -87,7 +87,7 @@ You can use the demo data as follow:
'author': 'OpenERP SA',
'depends': ['procurement','stock','sale'],
'init_xml': [],
'update_xml': ['stock_location_view.xml', 'security/ir.model.access.csv', 'mrp_pull_workflow.xml'],
'update_xml': ['stock_location_view.xml', 'security/ir.model.access.csv', 'procurement_pull_workflow.xml'],
'demo_xml': [
'stock_location_demo_cpu1.xml',
'stock_location_demo_cpu3.yml',

View File

@ -55,21 +55,21 @@ class procurement_order(osv.osv):
for proc in proc_obj.browse(cr, uid, ids, context=context):
line = None
for line in proc.product_id.flow_pull_ids:
if line.location_id==proc.location_id:
if line.location_id == proc.location_id:
break
assert line, 'Line can not be False if we are on this state of the workflow'
origin = (proc.origin or proc.name or '').split(':')[0] +':'+line.name
picking_id =picking_obj.create(cr, uid, {
picking_id = picking_obj.create(cr, uid, {
'origin': origin,
'company_id': line.company_id and line.company_id.id or False,
'type': line.picking_type,
'stock_journal_id': line.journal_id and line.journal_id.id or False,
'move_type': 'one',
'address_id': line.partner_address_id.id,
'note': line.name, # TODO: note on procurement ?
'note': _('Picking for pulled procurement coming from original location %s, pull rule %s, via original Procurement %s (#%d)') % (proc.location_id.name, line.name, proc.name, proc.id),
'invoice_state': line.invoice_state,
})
move_id =move_obj.create(cr, uid, {
move_id = move_obj.create(cr, uid, {
'name': line.name,
'picking_id': picking_id,
'company_id': line.company_id and line.company_id.id or False,
@ -88,7 +88,7 @@ class procurement_order(osv.osv):
'tracking_id': False,
'cancel_cascade': line.cancel_cascade,
'state': 'confirmed',
'note': line.name, # TODO: same as above
'note': _('Move for pulled procurement coming from original location %s, pull rule %s, via original Procurement %s (#%d)') % (proc.location_id.name, line.name, proc.name, proc.id),
})
if proc.move_id and proc.move_id.state in ('confirmed'):
move_obj.write(cr,uid, [proc.move_id.id], {
@ -97,6 +97,7 @@ class procurement_order(osv.osv):
proc_id = proc_obj.create(cr, uid, {
'name': line.name,
'origin': origin,
'note': _('Pulled procurement coming from original location %s, pull rule %s, via original Procurement %s (#%d)') % (proc.location_id.name, line.name, proc.name, proc.id),
'company_id': line.company_id and line.company_id.id or False,
'date_planned': proc.date_planned,
'product_id': proc.product_id.id,
@ -116,7 +117,10 @@ class procurement_order(osv.osv):
if proc.move_id:
move_obj.write(cr, uid, [proc.move_id.id],
{'location_id':proc.location_id.id})
self.write(cr, uid, [proc.id], {'state':'running', 'message':_('Pulled from another location via procurement %d')%proc_id})
self.write(cr, uid, [proc.id], {'state':'running','message':_('Moved from other location')})
# trigger direct processing (the new procurement shares the same planned date as the original one, which is already being processed)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
return False
procurement_order()
procurement_order()

View File

@ -5,65 +5,61 @@
-
!record {model: account.account.type, id: account_account_type_asset0}:
close_method: balance
code: asset
name: Asset
code: asset_test
name: Asset For Tests
sign: 1
-
I create a account type income.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: income
name: Income
code: income_test
name: Income For Tests
sign: 1
-
I create a account type Expense.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: expense
name: Expense
code: expense_test
name: Expense For Tests
sign: 1
-
I create a account type Receivable.
-
!record {model: account.account.type, id: account_account_type_receivable0}:
close_method: balance
code: receivable
name: Receivable
code: receivable_test
name: Receivable For Tests
sign: 1
-
I create a account Receivable.
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
code: 40000_test
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
name: Receivable For Tests
type: receivable
user_type: account_account_type_receivable0
-
I create a account Payable.
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
code: 440000_test
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
name: Payable For Tests
type: payable
user_type: account_account_type_expense0
-
I create a Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
code: pur_test
company_id: base.main_company
name: Purchase Journal
name: Purchase Journal For Tests
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
@ -72,33 +68,31 @@
I create a Sale Journal.
-
!record {model: account.journal, id: account_journal_salejouran0}:
code: sal
code: sal_test
company_id: base.main_company
name: Sale Journal
name: Sale Journal For Tests
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create a Sale Journal.
I create an Expense Account
-
!record {model: account.account, id: account_account_expenseaccount0}:
code: Expe
code: Expe_test
company_id: base.main_company
currency_mode: current
name: Expense Account
parent_left: 5
parent_right: 6
name: Expense Account For Tests
type: consolidation
user_type: account_account_type_asset0
-
I create Product Sale account.
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
code: 001_test
company_id: base.main_company
currency_mode: current
name: Product Sale
name: Product Sale For Tests
type: other
user_type: account_account_type_income0
@ -106,31 +100,31 @@
I create Product Product Purchase.
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
code: 0002_test
company_id: base.main_company
currency_mode: current
name: Product Purchase
name: Product Purchase For Tests
type: other
user_type: account_account_type_expense0
-
I create Supplier.
I create a Supplier.
-
!record {model: res.partner, id: res_partner_shawtrust0}:
address:
- country_id: base.in
- country_id: base.in
- street: St James House, Vicar Lane, Sheffield
lang: en_US
name: 'Shaw Trust '
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
-
I create product category.
I create a product category.
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create product and define the pulled flow condition for stock move.
I set shipping type Sending Goods. and set Procurement type move.
I create a product and define the pulled flow condition for stock move.
I set shipping type Sending Goods. and set Procurement type to move.
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: product_category_computer0
@ -176,7 +170,7 @@
property_stock_production: stock.location_production
qty_available: 15
-
I create procurement order.
I create a procurement order.
-
!record {model: procurement.order, id: procurement_order_test0}:
company_id: base.main_company
@ -191,7 +185,7 @@
product_uos: product.product_uom_unit
product_uos_qty: 0.0
-
I confirm procurement order.
I confirm the procurement order.
-
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test0}
-
@ -208,19 +202,18 @@
procurement_ids=self.search(cr, uid, [('id', '=', ref('procurement_order_test0'))])
if procurement_ids:
order=self.browse(cr,uid,procurement_ids)[0]
assert(order.state=='cancel')
assert(order.state=='cancel')
-
I check the new of procurement order create .
I check the new procurement order has been created .
-
!python {model: procurement.order }: |
from tools.translate import _
procurement_ids=self.search(cr, uid, [('name','=','E001')])
assert len(procurement_ids), "Procurement order hasn't Created."
assert len(procurement_ids), "Procurement order hasn't Created."
-
I check the Outgoing Picking is create for source location Shop 2 and destination shop1.
I check the Outgoing Picking is created for source location Shop 2 and destination shop1.
-
!python {model: stock.picking }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Testing pulled flow:E001'),('type','=','out')])
assert len(picking_id), "Picking hasn't Created."
assert len(picking_id), "Picking hasn't Created."

View File

@ -45,17 +45,13 @@
name: res_partner_microlinktechnologies0
min_qty: 5.0
path_ids:
- auto: auto
invoice_state: none
location_dest_id: stock.stock_location_stock
location_from_id: stock.stock_location_suppliers
- auto: auto
invoice_state: none
location_dest_id: stock_location.stock_location_qualitytest0
location_from_id: stock.stock_location_stock
- auto: auto
invoice_state: none
location_dest_id: stock.stock_location_stock
location_dest_id: stock.stock_location_components
location_from_id: stock_location.stock_location_qualitytest0
supply_method: buy
type: product