[MERGE]: Merge with lp:~openerp-dev/openobject-addons/ron-dev-addons2
bzr revid: rpa@tinyerp.com-20101123120508-jjbld5da36xwy85r
This commit is contained in:
commit
3b9aac2a4a
|
@ -6,7 +6,8 @@
|
|||
id="report_shipping"
|
||||
model="stock.picking"
|
||||
name="sale.shipping"
|
||||
rml="delivery/report/shipping.rml"
|
||||
multi="True"
|
||||
rml="delivery/report/shipping.rml"
|
||||
string="Delivery order"/>
|
||||
|
||||
</data>
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
<!-- Delivery Carriers -->
|
||||
<menuitem id="menu_delivery" name="Delivery" parent="stock.menu_stock_configuration" sequence="4"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<record id="view_delivery_carrier_tree" model="ir.ui.view">
|
||||
<field name="name">delivery.carrier.tree</field>
|
||||
<field name="model">delivery.carrier</field>
|
||||
|
@ -266,10 +269,23 @@
|
|||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@string='Sales Order']/group[1]/button[@name='button_dummy']" position="after">
|
||||
<button name="%(action_delivery_cost)d" states="draft" string="Delivery Costs" type="action" icon="gtk-add" context="{'order_id':active_id}"/>
|
||||
<button name="%(action_delivery_cost)d" states="draft" string="Delivery Costs" type="action" icon="gtk-add" context="{'order_id':active_id}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_delivary_order_inherit_stock" model="ir.ui.view">
|
||||
<field name="name">stock.picking.out.form</field>
|
||||
<field name="type">form</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_out_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@string='Products']/group/button[@name='action_process']" position="after">
|
||||
<button name="%(report_shipping)d" string="Delivery Order" states="done,assigned" type="action" icon="gtk-print"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -30,6 +30,34 @@ from tools.translate import _
|
|||
def is_pair(x):
|
||||
return not x%2
|
||||
|
||||
def check_ean(eancode):
|
||||
if not eancode:
|
||||
return True
|
||||
if len(eancode) <> 13:
|
||||
return False
|
||||
try:
|
||||
int(eancode)
|
||||
except:
|
||||
return False
|
||||
oddsum=0
|
||||
evensum=0
|
||||
total=0
|
||||
eanvalue=eancode
|
||||
reversevalue = eanvalue[::-1]
|
||||
finalean=reversevalue[1:]
|
||||
|
||||
for i in range(len(finalean)):
|
||||
if is_pair(i):
|
||||
oddsum += int(finalean[i])
|
||||
else:
|
||||
evensum += int(finalean[i])
|
||||
total=(oddsum * 3) + evensum
|
||||
|
||||
check = int(10 - math.ceil(total % 10.0))
|
||||
|
||||
if check != int(eancode[-1]):
|
||||
return False
|
||||
return True
|
||||
#----------------------------------------------------------
|
||||
# UOM
|
||||
#----------------------------------------------------------
|
||||
|
@ -452,25 +480,9 @@ class product_product(osv.osv):
|
|||
return False
|
||||
|
||||
def _check_ean_key(self, cr, uid, ids):
|
||||
for partner in self.browse(cr, uid, ids):
|
||||
if not partner.ean13:
|
||||
continue
|
||||
if len(partner.ean13) <> 13:
|
||||
return False
|
||||
try:
|
||||
int(partner.ean13)
|
||||
except:
|
||||
return False
|
||||
sum=0
|
||||
for i in range(12):
|
||||
if is_pair(i):
|
||||
sum += int(partner.ean13[i])
|
||||
else:
|
||||
sum += 3 * int(partner.ean13[i])
|
||||
check = int(math.ceil(sum / 10.0) * 10 - sum)
|
||||
if check != int(partner.ean13[12]):
|
||||
return False
|
||||
return True
|
||||
for product in self.browse(cr, uid, ids):
|
||||
res = check_ean(product.ean13)
|
||||
return res
|
||||
|
||||
_constraints = [(_check_ean_key, 'Error: Invalid ean code', ['ean13'])]
|
||||
|
||||
|
@ -600,6 +612,13 @@ class product_packaging(osv.osv):
|
|||
}
|
||||
|
||||
|
||||
def _check_ean_key(self, cr, uid, ids):
|
||||
for pack in self.browse(cr, uid, ids):
|
||||
res = check_ean(pack.ean)
|
||||
return res
|
||||
|
||||
_constraints = [(_check_ean_key, 'Error: Invalid ean code', ['ean'])]
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
if not len(ids):
|
||||
return []
|
||||
|
|
|
@ -646,10 +646,7 @@ class purchase_order_line(osv.osv):
|
|||
return {'value': {'price_unit': price_unit or 0.0, 'name': name or '',
|
||||
'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}}
|
||||
prod= self.pool.get('product.product').browse(cr, uid, product)
|
||||
if prod.product_tmpl_id.seller_ids:
|
||||
seller_get_id = prod.product_tmpl_id.seller_ids[0].name.id
|
||||
else:
|
||||
seller_get_id = False
|
||||
|
||||
|
||||
lang=False
|
||||
if partner_id:
|
||||
|
@ -665,12 +662,22 @@ class purchase_order_line(osv.osv):
|
|||
date_order = time.strftime('%Y-%m-%d')
|
||||
qty = qty or 1.0
|
||||
seller_delay = 0
|
||||
|
||||
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
|
||||
for s in prod.seller_ids:
|
||||
if s.name.id == partner_id:
|
||||
seller_delay = s.delay
|
||||
temp_qty = s.qty # supplier _qty assigned to temp
|
||||
if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal.
|
||||
qty = temp_qty
|
||||
prod_suppl_name = s.product_name
|
||||
prod_suppl_code = s.product_code
|
||||
if not (prod_suppl_name or prod_suppl_code):
|
||||
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
|
||||
elif (not prod_suppl_name) or (not prod_suppl_code):
|
||||
prod_name= '[' + (prod_suppl_code or prod.default_code or '') + '] '+ (prod_suppl_name or prod.name or '')
|
||||
else:
|
||||
prod_name= '[' + prod_suppl_code + '] '+ prod_suppl_name
|
||||
if price_unit:
|
||||
price = price_unit
|
||||
else:
|
||||
|
@ -680,15 +687,7 @@ class purchase_order_line(osv.osv):
|
|||
'date': date_order,
|
||||
})[pricelist]
|
||||
dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S')
|
||||
if seller_get_id == partner_id:
|
||||
prod_suppl_name = self.pool.get('product.product').browse(cr, uid, prod.id).seller_ids[0].product_name
|
||||
prod_suppl_code = self.pool.get('product.product').browse(cr, uid, prod.id).seller_ids[0].product_code
|
||||
if prod_suppl_name == False or prod_suppl_code == False:
|
||||
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
|
||||
else:
|
||||
prod_name= '[' + prod_suppl_code + '] '+ prod_suppl_name
|
||||
else:
|
||||
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
|
||||
|
||||
|
||||
res = {'value': {'price_unit': price, 'name': name or prod_name,
|
||||
'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id),
|
||||
|
|
|
@ -21,17 +21,16 @@
|
|||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
-
|
||||
In order to test the purchase flow,I create a new record where "invoice_method" is From Manual
|
||||
-
|
||||
I create purchase order for iPod.
|
||||
-
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_po1}:
|
||||
company_id: base.main_company
|
||||
date_order: '2010-05-11'
|
||||
invoice_method: manual
|
||||
location_id: stock.stock_location_stock
|
||||
name: PO00010
|
||||
order_line:
|
||||
- date_planned: '2010-05-13'
|
||||
name: iPod
|
||||
|
@ -47,16 +46,16 @@
|
|||
Initially purchase order is in the draft state
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po1}:
|
||||
- state == 'draft'
|
||||
- state == 'draft'
|
||||
-
|
||||
I confirm the purchase order.
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po1}
|
||||
-
|
||||
-
|
||||
I check that the order which was initially in the draft state has transit to confirm state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po1}:
|
||||
- state == 'approved'
|
||||
- state == 'approved'
|
||||
-
|
||||
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
|
||||
-
|
||||
|
@ -68,7 +67,7 @@
|
|||
assert search_ids, _('Purchase order line is not created!')
|
||||
-
|
||||
To check that wizard "Create Invoices" gets opened
|
||||
-
|
||||
-
|
||||
I create purchase order line invoice entry.
|
||||
-
|
||||
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
|
||||
|
@ -77,7 +76,7 @@
|
|||
I create invoice for products in the purchase order.
|
||||
-
|
||||
!python {model: purchase.order.line_invoice}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
ids = []
|
||||
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po1"))
|
||||
for line in pur_id1.order_line:
|
||||
|
@ -99,13 +98,13 @@
|
|||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
|
||||
account_obj = self.pool.get('account.invoice')
|
||||
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
ids = account_obj.search(cr, uid, [('origin', '=', 'PO-'+str(pur_id1.id))])
|
||||
assert ids, _('Pending Invoice is not created!')
|
||||
-
|
||||
I check that the order which was initially in the confirmed state has transit to approved state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po1}:
|
||||
- state == 'approved'
|
||||
- state == 'approved'
|
||||
-
|
||||
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved.
|
||||
-
|
||||
|
|
|
@ -21,17 +21,16 @@
|
|||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
-
|
||||
In order to test the purchase flow,I create a new record where "invoice_method" is From Picking
|
||||
-
|
||||
I create purchase order for iPod.
|
||||
-
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_po2}:
|
||||
company_id: base.main_company
|
||||
date_order: '2010-05-11'
|
||||
invoice_method: picking
|
||||
location_id: stock.stock_location_stock
|
||||
name: PO00008
|
||||
order_line:
|
||||
- date_planned: '2010-05-13'
|
||||
name: iPod
|
||||
|
@ -47,16 +46,16 @@
|
|||
Initially purchase order is in the draft state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po2}:
|
||||
- state == 'draft'
|
||||
- state == 'draft'
|
||||
-
|
||||
I confirm the purchase order for iPod.
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po2}
|
||||
-
|
||||
-
|
||||
I check that the order which was initially in the draft state has transit to confirm state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po2}:
|
||||
- state == 'approved'
|
||||
- state == 'approved'
|
||||
-
|
||||
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line.
|
||||
-
|
||||
|
@ -68,7 +67,7 @@
|
|||
assert search_ids, _('Purchase order line is not created!')
|
||||
-
|
||||
To check that wizard "Create Invoices" gets opened.
|
||||
-
|
||||
-
|
||||
I create purchase order line invoice entry.
|
||||
-
|
||||
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
|
||||
|
@ -77,7 +76,7 @@
|
|||
I create invoice for products in the purchase order.
|
||||
-
|
||||
!python {model: purchase.order.line_invoice}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
ids = []
|
||||
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
|
||||
for line in pur_id1.order_line:
|
||||
|
@ -99,21 +98,21 @@
|
|||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
account_obj = self.pool.get('account.invoice')
|
||||
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
ids = account_obj.search(cr, uid, [('origin', '=', 'PO-'+str(pur_id1.id))])
|
||||
assert ids, _('Pending Invoice is not created!')
|
||||
-
|
||||
I check that the order which was initially in the confirmed state has transit to approved state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po2}:
|
||||
- state == 'approved'
|
||||
- state == 'approved'
|
||||
-
|
||||
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved.
|
||||
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
assert(pur_id.date_approve)
|
||||
-
|
||||
I check that an entry gets created in the stock.picking.
|
||||
I check that an entry gets created in the stock.picking.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
|
@ -130,8 +129,8 @@
|
|||
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
|
||||
assert search_id, 'No Incoming Product!'
|
||||
-
|
||||
Then I create an invoice from picking by clicking on "Create Invoice" wizard
|
||||
-
|
||||
Then I create an invoice from picking by clicking on "Create Invoice" wizard
|
||||
-
|
||||
!python {model: stock.invoice.onshipping}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
|
||||
|
|
|
@ -783,7 +783,7 @@
|
|||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="8">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'address_id'}"/>
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<separator orientation="vertical" />
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical" />
|
||||
|
@ -928,7 +928,7 @@
|
|||
</group>
|
||||
</form>
|
||||
</field>
|
||||
<group col="10" colspan="4">
|
||||
<group col="12" 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"/>
|
||||
|
@ -937,6 +937,7 @@
|
|||
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
|
||||
<button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
|
||||
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" states="done" type="action" icon="terp-gtk-go-back-rtl"/>
|
||||
<button name="%(act_stock_return_picking)d" string="Return Products" states="done" type="action" icon="gtk-execute"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
|
||||
|
@ -1158,6 +1159,7 @@
|
|||
<group colspan="1" states="done">
|
||||
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl"/>
|
||||
</group>
|
||||
<button name="%(act_stock_return_picking)d" string="Return Products" states="done" type="action" icon="gtk-execute"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Additional Info" groups="base.group_extended,base.group_multi_company">
|
||||
|
|
|
@ -63,7 +63,6 @@ class stock_invoice_onshipping(osv.osv_memory):
|
|||
|
||||
|
||||
_columns = {
|
||||
# 'journal_id': fields.many2one('account.journal', 'Destination Journal', required=True,selection=_get_journal_id),
|
||||
'journal_id': fields.selection(_get_journal_id, 'Destination Journal',required=True),
|
||||
'group': fields.boolean("Group by partner"),
|
||||
'invoice_date': fields.date('Invoiced date'),
|
||||
|
@ -86,7 +85,7 @@ class stock_invoice_onshipping(osv.osv_memory):
|
|||
raise osv.except_osv(_('Warning !'), _('None of these picking lists require invoicing.'))
|
||||
return res
|
||||
|
||||
|
||||
|
||||
|
||||
def create_invoice(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<act_window name="Return Picking"
|
||||
<act_window name="Return Picking"
|
||||
res_model="stock.return.picking"
|
||||
src_model="stock.picking"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="act_stock_return_picking"/>
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
multi="True"
|
||||
id="act_stock_return_picking"/>
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue